コード例 #1
0
 protected void assertFileDoesNotExist(File targetdir, String pattern) {
   DirectoryScanner ds = new DirectoryScanner();
   ds.setBasedir(targetdir);
   ds.setIncludes(new String[] {pattern});
   ds.scan();
   Assert.assertEquals(
       targetdir.getAbsolutePath() + "/" + pattern, 0, ds.getIncludedFiles().length);
 }
コード例 #2
0
  /** Returns approximate target platform version. */
  public static Version getEclipseVersion() {
    String location = EnvironmentUtil.getTargetPlatforn();

    DirectoryScanner ds = new DirectoryScanner();
    ds.setBasedir(new File(location, "plugins"));
    ds.setIncludes(new String[] {"org.eclipse.osgi_*.jar"});
    ds.scan();

    String[] files = ds.getIncludedFiles();
    if (files == null || files.length < 1) {
      throw new IllegalStateException(
          "Unable to determine version of the test target platform " + location);
    }

    String version =
        files[0].substring("org.eclipse.osgi_".length(), files[0].length() - ".jar".length());

    return Version.parseVersion(version);
  }
コード例 #3
0
 protected void assertDirectoryExists(File targetdir, String pattern) {
   DirectoryScanner ds = new DirectoryScanner();
   ds.setBasedir(targetdir);
   ds.setIncludes(new String[] {pattern});
   ds.scan();
   Assert.assertEquals(
       targetdir.getAbsolutePath() + "/" + pattern, 1, ds.getIncludedDirectories().length);
   Assert.assertTrue(
       targetdir.getAbsolutePath() + "/" + pattern,
       new File(targetdir, ds.getIncludedDirectories()[0]).exists());
 }