public void testSite() throws MalformedURLException, CoreException {
    String ident1 = "org.eclipse.test.feature_1.0.0.jar";

    ISite site = SiteManager.getSite(SOURCE_FILE_SITE, null);

    URL id = UpdateManagerUtils.getURL(site.getURL(), ident1, null);
    remoteFeature = new DefaultFeature(site);
    remoteFeature.setURL(id);
    assertEquals(site, remoteFeature.getSite());
  }
 /** the feature to test */
 private DefaultFeature getFeature() throws MalformedURLException, CoreException {
   if (remoteFeature == null) {
     ISite site = SiteManager.getSite(SOURCE_FILE_SITE, null);
     URL id =
         UpdateManagerUtils.getURL(
             site.getURL(), "org.eclipse.update.core.feature1_1.0.0.jar", null);
     remoteFeature = new DefaultFeature(site);
     remoteFeature.setURL(id);
   }
   return remoteFeature;
 }
  public void testIdentifier() throws CoreException, MalformedURLException {

    String id1 = "features/org.eclipse.test.feature_1.0.0.jar";
    String id2 = "features/org.eclipse_test_feature.jar";
    VersionedIdentifier ident1 = new VersionedIdentifier("org.test1.ident1", "1.0.0");
    VersionedIdentifier ident2 = new VersionedIdentifier("org.test1.ident2", "1.0.0");

    ISite site = SiteManager.getSite(SOURCE_FILE_SITE, null);

    URL url1 = UpdateManagerUtils.getURL(site.getURL(), id1, null);
    remoteFeature = new DefaultFeature(site);
    remoteFeature.setURL(url1);
    remoteFeature.setIdentifier(ident1);
    assertEquals(ident1.toString(), remoteFeature.getVersionedIdentifier().toString());

    URL url2 = UpdateManagerUtils.getURL(site.getURL(), id2, null);
    remoteFeature = new DefaultFeature(site);
    remoteFeature.setURL(url2);
    remoteFeature.setIdentifier(ident2);
    assertEquals(ident2.toString(), remoteFeature.getVersionedIdentifier().toString());
  }
  public boolean execute(IProgressMonitor pm, IOperationListener listener) throws CoreException {

    IStatus status = OperationsManager.getValidator().validatePendingConfig(feature);
    if (status != null && status.getCode() == IStatus.ERROR) {
      throw new CoreException(status);
    }
    try {
      targetSite.configure(feature);
      // ensureUnique();

      // Restart not needed
      boolean restartNeeded = false;

      // Check if this operation is cancelling one that's already pending
      IOperation pendingOperation = OperationsManager.findPendingOperation(feature);

      if (pendingOperation instanceof IUnconfigFeatureOperation) {
        // no need to do either pending change
        OperationsManager.removePendingOperation(pendingOperation);
      } else {
        OperationsManager.addPendingOperation(this);
      }

      markProcessed();
      if (listener != null) listener.afterExecute(this, null);

      restartNeeded = SiteManager.getLocalSite().save() && restartNeeded;

      // notify the model
      OperationsManager.fireObjectChanged(feature, null);

      return restartNeeded;
    } catch (CoreException e) {
      undo();
      UpdateUtils.logException(e);
      throw e;
    }
  }
 public static void main(final String[] args) throws Exception {
   File file = new File("../target/distribute-crawler-1.0-SNAPSHOT-release");
   System.setProperty("crawler.home", file.getCanonicalPath());
   System.out.println(System.getProperty("crawler.home"));
   SiteManager.me().init().start();
 }