コード例 #1
0
 /**
  * Creates an {@link IApiBaseline} from all jar'd projects listed in the '/test-search/baseline'
  * directory
  *
  * @return a new {@link IApiBaseline}
  */
 IApiBaseline createBaseline(final String name, final HashSet<String> projectnames)
     throws CoreException {
   File file = TEST_SRC_ROOT.append(BASELINE_DIR_NAME).toFile();
   if (!file.exists()) {
     fail("The baseline test directory must exist");
   }
   IApiBaseline base = ApiModelFactory.newApiBaseline(name, Util.getEEDescriptionFile());
   File[] jars =
       file.listFiles(
           new FileFilter() {
             public boolean accept(File pathname) {
               String name = pathname.getName();
               if (Util.isArchive(name)) {
                 if (projectnames != null) {
                   IPath path = new Path(pathname.getAbsolutePath());
                   return projectnames.contains(path.removeFileExtension().lastSegment());
                 } else {
                   return true;
                 }
               }
               return false;
             }
           });
   IApiComponent[] components = new IApiComponent[jars.length];
   for (int i = 0; i < jars.length; i++) {
     components[i] = ApiModelFactory.newApiComponent(base, jars[i].getAbsolutePath());
   }
   base.addApiComponents(components);
   return base;
 }
コード例 #2
0
 /**
  * Creates and returns a test baseline with the given id. Also adds it to the baseline manager
  *
  * @param id
  * @return
  */
 protected IApiBaseline getTestBaseline(String id) {
   IApiBaseline baseline = ApiModelFactory.newApiBaseline(id);
   fPMmanager.addApiBaseline(baseline);
   return baseline;
 }