Java Code Examples for org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil#cleanWorkspace()

The following examples show how to use org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil#cleanWorkspace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBuilderTest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Clean up by saving and closing editors, cleaning the workspace, waiting for auto builds and asserting clean
 * index.
 */
@After
final public void tearDown() throws Exception {

	// save the files as otherwise the projects cannot be deleted
	libraryManager.deleteAllNodeModulesFolders(new NullProgressMonitor());
	closeAllEditorsForTearDown();
	ProjectTestsUtils.closeAllProjectsInWorkspace();
	testedWorkspace.cleanBuild();
	IResourcesSetupUtil.cleanWorkspace();
	testedWorkspace.cleanBuild();
	assertEquals("Resources in index:\n" + getAllResourceDescriptionsAsString() + "\n", 0,
			countResourcesInIndex());

	final IProject[] projects = root().getProjects();
	assertTrue("Expected empty workspace. Projects were in workspace: " + Arrays.toString(projects),
			0 == projects.length);

	queuedBuildData.reset();
}
 
Example 2
Source File: PreferenceStoreAccessTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testProjectScope() throws Exception {
	try {
		IProject project = IResourcesSetupUtil.createProject("test");
		final List<String> keys = Lists.newArrayList();
		preferenceStoreAccess.getContextPreferenceStore(project).addPropertyChangeListener(new IPropertyChangeListener() {
			@Override
			public void propertyChange(PropertyChangeEvent event) {
				keys.add(event.getProperty());
			}
		});
		getWritable().setValue("newValue", 1);
		assertEquals(0, keys.size());
		preferenceStoreAccess.getWritablePreferenceStore(project).setValue("newValue", 2);
		assertEquals(1, keys.size());
		assertEquals("newValue", keys.get(0));
		assertEquals(1, getReadable().getInt("newValue"));
		assertEquals(2, preferenceStoreAccess.getContextPreferenceStore(project).getInt("newValue"));
	} finally {
		IResourcesSetupUtil.cleanWorkspace();
	}
}
 
Example 3
Source File: AbstractRefactoringSwtBotTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@BeforeClass
public static void initialize() {
  try {
    TargetPlatformUtil.setTargetPlatform(AbstractRefactoringSwtBotTest.class);
    IResourcesSetupUtil.cleanWorkspace();
    SWTWorkbenchBot _sWTWorkbenchBot = new SWTWorkbenchBot();
    AbstractRefactoringSwtBotTest.bot = _sWTWorkbenchBot;
    UIThreadRunnable.syncExec(new VoidResult() {
      @Override
      public void run() {
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceActive();
      }
    });
    SwtBotProjectHelper.newXtendProject(AbstractRefactoringSwtBotTest.bot, "test");
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 4
Source File: SourceMapFileLocatorPluginTest.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Imports and compiles test project
 *
 * @throws CoreException
 *             in case project cannot be loaded
 */
@BeforeClass
public static void setupEclipseWorkspace() throws CoreException {
	try {
		IResourcesSetupUtil.cleanWorkspace();
		importTestProject(new N4JSProjectName(("SVDemo")));
	} catch (Exception ex) {
		System.out.println("Cannot set up Eclipse workspace for smith.ui tests: " + ex);
		throw ex;
	}
}
 
Example 5
Source File: BuildAffectionTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@AfterClass
public static void tearDownProject() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
  final IWorkspace workspace = ResourcesPlugin.getWorkspace();
  final IWorkspaceDescription description = workspace.getDescription();
  description.setAutoBuilding(BuildAffectionTest.wasAutoBuilding);
  workspace.setDescription(description);
}
 
Example 6
Source File: ActiveAnnotationsProcessingInIDETest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@AfterClass
public static void deleteProjects() {
  try {
    IResourcesSetupUtil.cleanWorkspace();
    ActiveAnnotationsProcessingInIDETest.macroProject = null;
    ActiveAnnotationsProcessingInIDETest.userProject = null;
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 7
Source File: AbstractRefactoringSwtBotTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@AfterClass
public static void terminate() {
  try {
    AbstractRefactoringSwtBotTest.bot.closeAllEditors();
    IResourcesSetupUtil.cleanWorkspace();
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example 8
Source File: AbstractGeneratorTest.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Clean up after all tests have terminated.
 */
@AfterClass
public static void cleanUp() {
  try {
    IResourcesSetupUtil.cleanWorkspace();
  } catch (CoreException e) {
    LOGGER.error(e.getMessage(), e);
  }
}
 
Example 9
Source File: BuildAffectionTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpProject() throws Exception {
  TargetPlatformUtil.setTargetPlatform(BuildAffectionTest.class);
  IResourcesSetupUtil.cleanWorkspace();
  final IWorkspace workspace = ResourcesPlugin.getWorkspace();
  final IWorkspaceDescription description = workspace.getDescription();
  BuildAffectionTest.wasAutoBuilding = description.isAutoBuilding();
  description.setAutoBuilding(false);
  workspace.setDescription(description);
  WorkbenchTestHelper.createPluginProject(WorkbenchTestHelper.TESTPROJECT_NAME);
}
 
Example 10
Source File: MoreActiveAnnotationsTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
}
 
Example 11
Source File: AbstractXtendUITestCase.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDownProject() throws Exception {
	IResourcesSetupUtil.cleanWorkspace();
}
 
Example 12
Source File: AbstractJunitLibClasspathAdderTestCase.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDownProject() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
}
 
Example 13
Source File: AbstractXbaseUITestCase.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
	if (doCleanWorkspace())
		IResourcesSetupUtil.cleanWorkspace();
}
 
Example 14
Source File: Bug457681Test.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
}
 
Example 15
Source File: AbstractJunitLibClasspathAdderTestCase.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Before
public void setUpProject() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
  WorkbenchTestHelper.createPluginProject(WorkbenchTestHelper.TESTPROJECT_NAME, 
    XtendClasspathContainer.BUNDLE_IDS_TO_INCLUDE);
}
 
Example 16
Source File: XtendNatureAddingEditorCallbackTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@After
@Override
public void tearDown() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
}
 
Example 17
Source File: LiveShadowedAllContainerStateTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
  IResourcesSetupUtil.cleanWorkspace();
}
 
Example 18
Source File: Storage2UriMapperJdtImplTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Before
@After
public void cleanWorkspace() throws Exception {
	IResourcesSetupUtil.cleanWorkspace();
}
 
Example 19
Source File: EclipseWorkspaceConfigurationTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@After
public void tearDown() throws Exception {
	IResourcesSetupUtil.cleanWorkspace();
}
 
Example 20
Source File: TaskMarkerContributorTest.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@After
public void cleanUp() throws Exception {
	IResourcesSetupUtil.cleanWorkspace();
}