@Test(expected = IllegalStateException.class)
 public void testGetWhenAmbiguousThrowsException() throws Exception {
   AddonRegistry registry =
       SimpleContainer.getFurnace(this.getClass().getClassLoader()).getAddonRegistry();
   Imported<PublishedService> instance = registry.getServices(PublishedService.class.getName());
   Assert.assertTrue(instance.isAmbiguous());
   instance.get();
 }
 @Test
 public void testTypedLookupReturnsProperType() throws Exception {
   AddonRegistry registry =
       SimpleContainer.getFurnace(this.getClass().getClassLoader()).getAddonRegistry();
   Imported<PublishedService> instance = registry.getServices(PublishedService.class);
   Assert.assertNotNull(instance);
   PublishedService service = instance.get();
   Assert.assertNotNull(service);
 }
Beispiel #3
0
 @Test
 public void testCreateTempProjectWithBuildSystem() throws Exception {
   ProjectProvider buildSystem = buildSystems.get();
   try {
     Project project = projectFactory.createTempProject(buildSystem);
     Assert.assertNotNull(project);
   } finally {
     buildSystems.release(buildSystem);
   }
 }
Beispiel #4
0
 @Test
 public void testCreateTempProjectWithBuildSystemAndFacets() {
   ProjectProvider buildSystem = buildSystems.get();
   try {
     Project project =
         projectFactory.createTempProject(
             buildSystem, Arrays.<Class<? extends ProjectFacet>>asList(WebResourcesFacet.class));
     Assert.assertNotNull(project);
     Assert.assertTrue(project.hasFacet(WebResourcesFacet.class));
   } finally {
     buildSystems.release(buildSystem);
   }
 }
Beispiel #5
0
  @Test
  public void testContainsProjectWithBuildSystem() {
    ProjectProvider buildSystem = buildSystems.get();
    try {
      Project project = projectFactory.createTempProject(buildSystem);
      Assert.assertNotNull(project);
      Resource<?> projectRoot = project.getRoot();
      Assert.assertTrue(projectFactory.containsProject(projectRoot, projectRoot, buildSystem));
      Assert.assertTrue(
          projectFactory.containsProject(projectRoot, projectRoot.getChild("src"), buildSystem));

      projectRoot.delete(true);
      Assert.assertFalse(projectFactory.containsProject(projectRoot, projectRoot, buildSystem));
    } finally {
      buildSystems.release(buildSystem);
    }
  }