Java 类org.eclipse.xtext.junit4.ui.util.IResourcesSetupUtil 实例源码

项目:packtpub-xtext-book-examples    文件:SmallJavaWorkbenchTest.java   
public void checkSmallJavaPrograms(final String program1, final String program2, final int expectedErrors) {
  try {
    final IFile file1 = IResourcesSetupUtil.createFile((this.TEST_PROJECT + "/src/test1.smalljava"), program1);
    final IFile file2 = IResourcesSetupUtil.createFile((this.TEST_PROJECT + "/src/test2.smalljava"), program2);
    IResourcesSetupUtil.waitForAutoBuild();
    IMarker[] _findMarkers = file1.findMarkers(EValidator.MARKER, true, 
      IResource.DEPTH_INFINITE);
    int _size = ((List<IMarker>)Conversions.doWrapArray(_findMarkers)).size();
    Assert.assertEquals(expectedErrors, _size);
    IMarker[] _findMarkers_1 = file2.findMarkers(EValidator.MARKER, true, 
      IResource.DEPTH_INFINITE);
    int _size_1 = ((List<IMarker>)Conversions.doWrapArray(_findMarkers_1)).size();
    Assert.assertEquals(expectedErrors, _size_1);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:gemoc-studio    文件:TFSM_PlainK3ExampleWizardTest.java   
@BeforeClass
public static void setUp(){
    TFSM_PlainK3ExampleWizard sample = new TFSM_PlainK3ExampleWizard();
    sample.performFinish();
    wsRoot = ResourcesPlugin.getWorkspace().getRoot();
    IResourcesSetupUtil.waitForAutoBuild();
}
项目:gemoc-studio    文件:SigPMLExampleTest.java   
@BeforeClass
public static void setUp(){
    SigPMLExampleWizard sample = new SigPMLExampleWizard();
    sample.performFinish();
    wsRoot = ResourcesPlugin.getWorkspace().getRoot();
    IResourcesSetupUtil.waitForAutoBuild();
}
项目:gemoc-studio    文件:TFSMExampleTest.java   
@BeforeClass
public static void setUp(){
    TFSMExampleWizard sample = new TFSMExampleWizard();
    sample.performFinish();
    wsRoot = ResourcesPlugin.getWorkspace().getRoot();
    IResourcesSetupUtil.waitForAutoBuild();
}
项目:dsl-devkit    文件:AbstractGeneratorTest.java   
/**
 * Clean up after all tests have terminated.
 */
@AfterClass
public static void cleanUp() {
  try {
    IResourcesSetupUtil.cleanWorkspace();
  } catch (CoreException e) {
    LOGGER.error(e.getMessage(), e);
  }
}
项目:dsl-devkit    文件:PluginTestProjectManager.java   
/** {@inheritDoc} */
@Override
public void setup(final Iterable<? extends TestSource> initialSources) {
  try {
    IResourcesSetupUtil.waitForAutoBuild();
    createPluginProject(injector, TEST_PROJECT_NAME);
  } catch (CoreException e) {
    throw new IllegalStateException("Failed to create plugin project");
  }
}
项目:packtpub-xtext-book-examples    文件:EntitiesWorkbenchTest.java   
public void checkEntityProgram(final String contents, final int expectedErrors) {
  try {
    final IFile file = IResourcesSetupUtil.createFile((this.TEST_PROJECT + "/src/test.entities"), contents);
    IResourcesSetupUtil.waitForAutoBuild();
    IMarker[] _findMarkers = file.findMarkers(EValidator.MARKER, true, 
      IResource.DEPTH_INFINITE);
    int _size = ((List<IMarker>)Conversions.doWrapArray(_findMarkers)).size();
    Assert.assertEquals(expectedErrors, _size);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:packtpub-xtext-book-examples    文件:EntitiesEditorTest.java   
public IFile createTestFile(final String contents) {
  try {
    return IResourcesSetupUtil.createFile((this.TEST_PROJECT + "/src/test.entities"), contents);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:dsl-devkit    文件:XtextTestProjectManager.java   
/** {@inheritDoc} */
@Override
public void build() {
  IResourcesSetupUtil.waitForAutoBuild();
}
项目:dsl-devkit    文件:AbstractGeneratorTest.java   
/**
 * Initializes a project with the given name, required bundles and sources.
 *
 * @param projectName
 *          the name of the project
 * @param folders
 *          the folders to create (source and source-generated folders will be created unless methods are overridden and specified as null or empty), or
 *          {@code null} if none
 * @param requiredBundles
 *          required bundles of the project to be created, or {@code null} if none
 * @param importedPackages
 *          imported packages of the project to be created, or {@code null} if none
 * @param exportedPackages
 *          exported packages of the project to be created, or {@code null} if none
 * @param sourceFileNames
 *          the source file names, mapping input filename to output filename
 * @throws CoreException
 *           the {@link CoreException}
 */
public void initializeProject(final String projectName, final List<String> folders, final List<String> requiredBundles, final List<String> importedPackages, final List<String> exportedPackages, final ImmutableMap<String, String> sourceFileNames) throws CoreException {
  // a project must be created
  createPluginProject(projectName, folders, requiredBundles, importedPackages, exportedPackages);
  // sources are copied into the project and then built by the Xtext builder
  addSourcesToWorkspace(projectName, sourceFileNames);

  // wait for build to finish, otherwise included catalog may not be resolvable
  IResourcesSetupUtil.waitForAutoBuild();
}
项目:dsl-devkit    文件:AbstractCheckTestCase.java   
/**
 * Creates a file with given name and contents.
 *
 * @param fileName
 *          the file name
 * @param content
 *          the file content
 * @return the file
 * @throws Exception
 *           the exception
 */
public IFile createFile(final String fileName, final String content) throws Exception { // NOPMD
  String fullFileName = getFullFileName(fileName);
  IFile file = IResourcesSetupUtil.createFile(fullFileName, content);
  getFiles().add(file);
  return file;
}