<commit_before>package edu.oregonstate.cope.eclipse.installer;

import static org.junit.Assert.assertTrue;

import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import edu.oregonstate.cope.clientRecorder.Properties;
import edu.oregonstate.cope.eclipse.COPEPlugin;
import edu.oregonstate.cope.eclipse.PopulatedWorkspaceTest;

public class InstallerTest extends PopulatedWorkspaceTest {

	private File[] rootFiles;
	private COPEPlugin plugin;

	@Before 
	public void setup() {
		plugin = COPEPlugin.getDefault();
		rootFiles = plugin.getLocalStorage().listFiles();
	}

	@Test
	public void testVersionedLocalStorage() throws Exception {
		assertPathHasCurrentVersion(plugin.getVersionedLocalStorage().toPath());
		assertPathHasCurrentVersion(plugin.getVersionedBundleStorage().toPath());
	}

	private void assertPathHasCurrentVersion(Path versionedPath) {
		Path path = versionedPath;
		assertTrue(path.endsWith(plugin.getPluginVersion().toString()));
	}

	@Test
	public void testEverythingIsInVersionedFiles() throws Exception {
		for (File file : rootFiles) {
			assertTrue(file.isDirectory());
			assertTrue(file.getName().matches("\\d+\\.\\d+\\.\\d+\\.qualifier"));

			List<String> versionedFileChildren = Arrays.asList(file.list());

			assertTrue(versionedFileChildren.contains("eventFiles"));
			assertTrue(versionedFileChildren.contains("workspace_id"));
			assertTrue(versionedFileChildren.contains("known-projects"));
		}
	}
	
	@Test
	public void testSnapshotAtUpdate() throws Exception {
		Properties properties = plugin.getWorkspaceProperties();
		
		new Installer().checkForPluginUpdate("v1", "v2");
		
		boolean zipExists = false;

		for(File file : plugin.getLocalStorage().listFiles()){
			if(file.toPath().endsWith(".zip"))
				zipExists = true;
		}
		
		assertTrue(zipExists);
	}
}
<commit_msg>Updated and fixed bugs in test.<commit_after>package edu.oregonstate.cope.eclipse.installer;

import static org.junit.Assert.assertTrue;

import java.io.File;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;

import edu.oregonstate.cope.clientRecorder.Properties;
import edu.oregonstate.cope.eclipse.COPEPlugin;
import edu.oregonstate.cope.eclipse.PopulatedWorkspaceTest;
import edu.oregonstate.cope.eclipse.SnapshotManager;

public class InstallerTest extends PopulatedWorkspaceTest {

	private static COPEPlugin plugin;
	private static SnapshotManager snapshotManager;

	@BeforeClass
	public static void beforeClass() throws Exception {
		PopulatedWorkspaceTest.beforeClass();
		plugin = COPEPlugin.getDefault();
		plugin.getSnapshotManager().knowProject(PopulatedWorkspaceTest.javaProject.getProject().getName());
	}

	@Test
	public void testVersionedLocalStorage() throws Exception {
		assertPathHasCurrentVersion(plugin.getVersionedLocalStorage().toPath());
		assertPathHasCurrentVersion(plugin.getVersionedBundleStorage().toPath());
	}

	private void assertPathHasCurrentVersion(Path versionedPath) {
		Path path = versionedPath;
		assertTrue(path.endsWith(plugin.getPluginVersion().toString()));
	}

	@Test
	public void testEverythingIsInVersionedFiles() throws Exception {
		for (File file : plugin.getLocalStorage().listFiles()) {
			assertTrue(file.isDirectory());
			assertTrue(file.getName().matches("\\d+\\.\\d+\\.\\d+\\.qualifier"));

			List<String> versionedFileChildren = Arrays.asList(file.list());

			assertTrue(versionedFileChildren.contains("eventFiles"));
			assertTrue(versionedFileChildren.contains("workspace_id"));
			assertTrue(versionedFileChildren.contains("known-projects"));
		}
	}

	@SuppressWarnings("static-access")
	@Test
	public void testSnapshotAtUpdate() throws Exception {
		Properties properties = plugin.getWorkspaceProperties();

		new Installer().checkForPluginUpdate("v1", "v2");

		boolean zipExists = false;

		for (File file : plugin.getVersionedLocalStorage().listFiles()) {
			if (file.toPath().toString().endsWith(".zip"))
				zipExists = true;
		}

		assertTrue(zipExists);
	}
}

{'fraction_non_alphanumeric': 0.12421001458434613, 'fraction_numerical': 0.0009722897423432182, 'mean_word_length': 5.835548172757475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6004890', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1211, 'n_words': 211}