Package org.jboss.forge.furnace

Examples of org.jboss.forge.furnace.Furnace


   }

   @Test
   public void testExportedInstanceExposesServiceTypeAndSourceAddon() throws Exception
   {
      Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
      Assert.assertNotNull(furnace);
      AddonRegistry registry = furnace.getAddonRegistry();
      boolean found = false;
      for (Addon addon : registry.getAddons())
      {
         ExportedInstance<ExportedInstanceApiTest> instance = addon.getServiceRegistry()
                  .getExportedInstance(ExportedInstanceApiTest.class);
View Full Code Here


   private boolean overwrite = true;

   @Override
   public void execute() throws MojoExecutionException, MojoFailureException
   {
      Furnace forge = new FurnaceImpl();
      if (!addonRepository.exists())
      {
         addonRepository.mkdirs();
      }
      else if (overwrite)
      {
         try
         {
            deleteDirectory(addonRepository);
            addonRepository.mkdirs();
         }
         catch (IOException e)
         {
            throw new MojoExecutionException("Could not delete " + addonRepository, e);
         }
      }
      AddonRepository repository = forge.addRepository(AddonRepositoryMode.MUTABLE, addonRepository);
      MavenAddonDependencyResolver addonResolver = new MavenAddonDependencyResolver(this.classifier);
      addonResolver.setSettings(settings);
      addonResolver.setResolveAddonAPIVersions(!skipAddonAPIVersionResolution);
      AddonManager addonManager = new AddonManagerImpl(forge, addonResolver);
View Full Code Here

   }

   @Test
   public void testIsAmbiguous() throws Exception
   {
      Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
      AddonRegistry registry = furnace.getAddonRegistry();
      Imported<MockInterface> services = registry.getServices(MockInterface.class);
      Assert.assertFalse(services.isUnsatisfied());
      Assert.assertTrue(services.isAmbiguous());
   }
View Full Code Here

   }

   @Test(expected = IllegalStateException.class)
   public void shouldBeAbleToUseFactoryDelegateTypesafely() throws Exception
   {
      Furnace instance = FurnaceFactory.getInstance();
      Assert.assertNotNull(instance);
      AddonRegistry registry = instance.getAddonRegistry();
      Assert.assertNotNull(registry);
   }
View Full Code Here

   }

   @Test
   public void testAddonDependenciesLoadedAcrossRepositories() throws Exception
   {
      Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
      Assert.notNull(furnace, "Furnace instance was null");
   }
View Full Code Here

   }

   @Test
   public void shouldBeAbleToPassPrimitivesIntoDelegate() throws Exception
   {
      Furnace instance = FurnaceFactory.getInstance();
      Assert.assertNotNull(instance);
      instance.setServerMode(false);
   }
View Full Code Here

   }

   @Test
   public void shouldBeAbleToPassClassesIntoDelegate() throws Exception
   {
      Furnace instance = FurnaceFactory.getInstance();
      File tempDir = File.createTempFile("test", "repository");
      tempDir.delete();
      tempDir.mkdir();
      tempDir.deleteOnExit();
      instance.addRepository(AddonRepositoryMode.IMMUTABLE, tempDir);
      instance.getRepositories().get(0).getAddonResources(AddonId.from("a", "1"));
   }
View Full Code Here

   }

   @Test(expected = IllegalStateException.class)
   public void shouldBeAbleToPassInterfacesIntoDelegate() throws Exception
   {
      Furnace instance = FurnaceFactory.getInstance();
      Set<Addon> addons = instance.getAddonRegistry().getAddons(AddonFilters.allStarted());
      Assert.assertNotNull(addons);
   }
View Full Code Here

   }

   @Test
   public void testAddonRepositoryIsCorrectInMultiViewEnvironment() throws Exception
   {
      Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
      Assert.assertNotNull(furnace);
      AddonRegistry registry = furnace.getAddonRegistry();
      AddonRepository rep1 = registry.getAddon(AddonId.from("dep1", "1")).getRepository();
      AddonRepository rep2 = registry.getAddon(AddonId.from("dep2", "2")).getRepository();
      AddonRepository rep3 = registry.getAddon(AddonId.from("dep3", "3")).getRepository();
      AddonRepository rep4 = registry.getAddon(AddonId.from("dep4", "4")).getRepository();
      AddonRepository rep5 = registry.getAddon(AddonId.from("dep5", "5")).getRepository();
View Full Code Here

   }

   @Test
   public void testAddonsLoadAPIClassesFromBootpathJAR() throws IOException, Exception
   {
      Furnace furnace = FurnaceFactory.getInstance();

      furnace.addRepository(AddonRepositoryMode.MUTABLE, repodir1);

      AddonDependencyResolver resolver = new MavenAddonDependencyResolver();
      AddonManager manager = new AddonManagerImpl(furnace, resolver);

      AddonId no_dep = AddonId.from("test:no_dep", "1.0.0.Final");
      AddonId one_dep = AddonId.from("test:one_dep", "1.0.0.Final");

      manager.install(no_dep).perform();
      manager.install(one_dep).perform();

      ConfigurationScanListener listener = new ConfigurationScanListener();
      ListenerRegistration<ContainerLifecycleListener> registration = furnace.addContainerLifecycleListener(listener);

      furnace.startAsync();

      while (!listener.isConfigurationScanned())
         Thread.sleep(100);

      registration.removeListener();

      Addon projectsAddon = furnace.getAddonRegistry().getAddon(no_dep);
      Addons.waitUntilStarted(projectsAddon, 10, TimeUnit.SECONDS);

      ClassLoader addonClassLoader = projectsAddon.getClassLoader().loadClass(Addon.class.getName()).getClassLoader();
      ClassLoader appClassLoader = Addon.class.getClassLoader();
      Assert.assertNotEquals(appClassLoader, addonClassLoader);

      Assert.assertTrue(projectsAddon.getStatus().isStarted());
      furnace.stop();
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.furnace.Furnace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.