Esempio n. 1
0
  public void testSimpleExportProjectProvider2() throws Exception {
    doGenerate(
        new String[] {
          GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
          GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider4.class.getName()
        });
    assertTrue(target.exists());
    WritablePDOM wpdom =
        new WritablePDOM(
            target,
            new URIRelativeLocationConverter(BASEURI),
            LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
    verifyProject1Content(wpdom);

    wpdom.acquireReadLock();
    try {
      String fid = wpdom.getProperty(IIndexFragment.PROPERTY_FRAGMENT_ID);
      assertNotNull(fid);
      assertEquals(ACME_SDK_ID, fid); // check for custom export id
      String sdkVer = wpdom.getProperty(SDK_VERSION);
      assertNotNull(sdkVer);
      assertEquals("4.0.1", sdkVer); // check for custom property value
    } finally {
      wpdom.releaseReadLock();
    }
  }
Esempio n. 2
0
  private WritablePDOM generatePDOM(String testProject, Class<?> provider, final int[] stateCount)
      throws Exception {
    IIndexerStateListener listener = null;
    if (stateCount != null) {
      listener =
          new IIndexerStateListener() {
            @Override
            public void indexChanged(IIndexerStateEvent event) {
              stateCount[0]++;
            }
          };
      CCorePlugin.getIndexManager().joinIndexer(8000, new NullProgressMonitor());
      CCorePlugin.getIndexManager().addIndexerStateListener(listener);
    }

    URL url = FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path(testProject), null);
    String baseDir = FileLocator.toFileURL(url).getFile();

    doGenerate(
        new String[] {
          GeneratePDOMApplication.OPT_TARGET,
          target.getAbsolutePath(),
          GeneratePDOMApplication.OPT_PROJECTPROVIDER,
          provider.getName(),
          ExternalExportProjectProvider.OPT_SOURCE,
          baseDir,
          ExternalExportProjectProvider.OPT_FRAGMENT_ID,
          "generate.pdom.tests.id." + getName()
        });
    assertTrue(target.exists());
    if (listener != null) {
      CCorePlugin.getIndexManager().removeIndexerStateListener(listener);
    }
    return new WritablePDOM(
        target,
        new URIRelativeLocationConverter(BASEURI),
        LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
  }
Esempio n. 3
0
  public void testSimpleExportProjectProvider1() throws Exception {
    doGenerate(
        new String[] {
          GeneratePDOMApplication.OPT_TARGET, target.getAbsolutePath(),
          GeneratePDOMApplication.OPT_PROJECTPROVIDER, TestProjectProvider3.class.getName()
        });
    assertTrue(target.exists());
    WritablePDOM wpdom =
        new WritablePDOM(
            target,
            new URIRelativeLocationConverter(BASEURI),
            LanguageManager.getInstance().getPDOMLinkageFactoryMappings());
    verifyProject1Content(wpdom);

    String fid;
    wpdom.acquireReadLock();
    try {
      fid = wpdom.getProperty(IIndexFragment.PROPERTY_FRAGMENT_ID);
    } finally {
      wpdom.releaseReadLock();
    }
    assertNotNull(fid);
    assertTrue(fid.startsWith("export")); // check for default export id
  }