Package org.jboss.bootstrap.api.mc.server

Examples of org.jboss.bootstrap.api.mc.server.MCServer


    * @see org.jboss.arquillian.spi.TestEnricher#enrich(org.jboss.arquillian.spi.Context, java.lang.Object)
    */
   public void enrich(final Context context, final Object testCase)
   {
      // Obtain the server as set from the container
      final MCServer server = context.get(MCServer.class);
      assert server != null : "MC Server was not set by the container";

      // Get the Controller
      final KernelController controller = server.getKernel().getController();

      // Install the test instance itself into MC (so injections may be honored)
      final BeanMetaDataBuilder bmdb = BeanMetaDataBuilderFactory.createBuilder(BIND_NAME_TEST,
            testCase.getClass().getName()).setAccessMode(BeanAccessMode.ALL);
      try
View Full Code Here


            return null;
         }
      });

      // Create the Server
      final MCServer server = MCServerFactory.createServer();

      // Add the required bootstrap descriptors
      final List<BootstrapDescriptor> descriptors = server.getConfiguration().getBootstrapDescriptors();
      descriptors.add(ReloadedDescriptors.getClassLoadingDescriptor());
      descriptors.add(ReloadedDescriptors.getVdfDescriptor());

      // Start the server
      try
      {
         server.start();
      }
      catch (final Exception e)
      {
         throw new LifecycleException("Error in starting the Microcontainer server " + server, e);
      }

      // Install the ShrinkWrapDeployer
      final URL shrinkwrapDeployerJBossBeans = Thread.currentThread().getContextClassLoader()
            .getResource(FILENAME_SHRINKWRAP_DEPLOYER_XML);
      assert shrinkwrapDeployerJBossBeans != null : "ShrinkWrap Deployer beans XML not found";
      final MainDeployer mainDeployer = (MainDeployer) server.getKernel().getController()
            .getContextByClass(MainDeployer.class).getTarget();
      final VirtualFile file;
      try
      {
         file = VFS.getChild(shrinkwrapDeployerJBossBeans);
      }
      catch (final URISyntaxException e)
      {
         throw new LifecycleException("Could not create virtual file for " + shrinkwrapDeployerJBossBeans, e);
      }
      if (file == null)
      {
         throw new IllegalStateException();
      }
      final VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
      try
      {
         mainDeployer.addDeployment(deployment);
         mainDeployer.process();
         mainDeployer.checkComplete();
      }
      catch (final org.jboss.deployers.spi.DeploymentException de)
      {
         throw new LifecycleException("Could not install ShrinkWrapDeployer", de);
      }

      // Get the ShrinkWrapDeployer
      final ShrinkWrapDeployer deployer = (ShrinkWrapDeployer) server.getKernel().getController()
            .getInstalledContext(NAME_MC_SHRINKWRAP_DEPLOYER).getTarget();

      context.add(MCServer.class, server);
      context.add(ShrinkWrapDeployer.class, deployer);
   }
View Full Code Here

    * @see org.jboss.arquillian.spi.DeployableContainer#stop(org.jboss.arquillian.spi.Context)
    */
   @Override
   public void stop(final Context context) throws LifecycleException
   {
      final MCServer server = context.get(MCServer.class);
      // If we've got a server
      if (server != null && server.getState().equals(LifecycleState.STARTED))
      {
         // Bring it down
         try
         {
            server.stop();
         }
         catch (final Exception e)
         {
            throw new LifecycleException("Error in stopping the Microcontainer server " + server, e);
         }
View Full Code Here

    * @see org.jboss.arquillian.spi.TestEnricher#enrich(org.jboss.arquillian.spi.Context, java.lang.Object)
    */
   public void enrich(final Object testCase)
   {
      // Obtain the server as set from the container
      final MCServer server = mcServer.get();
      assert server != null : "MC Server was not set by the container";

      // Get the Controller
      final KernelController controller = server.getKernel().getController();

      // Install the test instance itself into MC (so injections may be honored)
      final BeanMetaDataBuilder bmdb = BeanMetaDataBuilderFactory.createBuilder(BIND_NAME_TEST,
            testCase.getClass().getName()).setAccessMode(BeanAccessMode.ALL);
      try
View Full Code Here

   @Inject
   private Instance<MCServer> mcServer;

   public void uninstall(@Observes BeforeUnDeploy event)
   {
      MCServer server = mcServer.get();
      if(server != null)
      {
         server.getKernel().getController().uninstall(ReloadedTestEnricher.BIND_NAME_TEST);
      }
   }
View Full Code Here

            return null;
         }
      });

      // Create the Server
      final MCServer server = MCServerFactory.createServer();

      // Add the required bootstrap descriptors
      final List<BootstrapDescriptor> descriptors = server.getConfiguration().getBootstrapDescriptors();
      descriptors.add(ReloadedDescriptors.getClassLoadingDescriptor());
      descriptors.add(ReloadedDescriptors.getVdfDescriptor());

      // Start the server
      try
      {
         server.start();
      }
      catch (final Exception e)
      {
         throw new LifecycleException("Error in starting the Microcontainer server " + server, e);
      }

      // Install the ShrinkWrapDeployer
      final URL shrinkwrapDeployerJBossBeans = Thread.currentThread().getContextClassLoader()
            .getResource(FILENAME_SHRINKWRAP_DEPLOYER_XML);
      assert shrinkwrapDeployerJBossBeans != null : "ShrinkWrap Deployer beans XML not found";
      final MainDeployer mainDeployer = (MainDeployer) server.getKernel().getController()
            .getContextByClass(MainDeployer.class).getTarget();
      final VirtualFile file;
      try
      {
         file = VFS.getChild(shrinkwrapDeployerJBossBeans);
      }
      catch (final URISyntaxException e)
      {
         throw new LifecycleException("Could not create virtual file for " + shrinkwrapDeployerJBossBeans, e);
      }
      if (file == null)
      {
         throw new IllegalStateException();
      }
      final VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(file);
      try
      {
         mainDeployer.addDeployment(deployment);
         mainDeployer.process();
         mainDeployer.checkComplete();
      }
      catch (final org.jboss.deployers.spi.DeploymentException de)
      {
         throw new LifecycleException("Could not install ShrinkWrapDeployer", de);
      }

      // Get the ShrinkWrapDeployer
      final ShrinkWrapDeployer deployer = (ShrinkWrapDeployer) server.getKernel().getController()
            .getInstalledContext(NAME_MC_SHRINKWRAP_DEPLOYER).getTarget();

      mcServer.set(server);
      shrinkwrapDeployer.set(deployer);
   }
View Full Code Here

    * @see org.jboss.arquillian.spi.client.container.DeployableContainer#stop()
    */
   @Override
   public void stop() throws LifecycleException
   {
      final MCServer server = mcServer.get();
      // If we've got a server
      if (server != null && server.getState().equals(LifecycleState.STARTED))
      {
         // Bring it down
         try
         {
            server.stop();
         }
         catch (final Exception e)
         {
            throw new LifecycleException("Error in stopping the Microcontainer server " + server, e);
         }
View Full Code Here

    * @see org.jboss.arquillian.spi.TestEnricher#enrich(org.jboss.arquillian.spi.Context, java.lang.Object)
    */
   public void enrich(final Context context, final Object testCase)
   {
      // Obtain the server as set from the container
      final MCServer server = context.get(MCServer.class);
      assert server != null : "MC Server was not set by the container";

      // Get the Controller
      final KernelController controller = server.getKernel().getController();

      // Install the test instance itself into MC (so injections may be honored)
      final BeanMetaDataBuilder bmdb = BeanMetaDataBuilderFactory.createBuilder(BIND_NAME_TEST,
            testCase.getClass().getName()).setAccessMode(BeanAccessMode.ALL);
      try
View Full Code Here

            return null;
         }
      });

      // Create the Server
      final MCServer server = MCServerFactory.createServer();

      // Add the required bootstrap descriptors
      final List<BootstrapDescriptor> descriptors = server.getConfiguration().getBootstrapDescriptors();
      descriptors.add(ReloadedDescriptors.getClassLoadingDescriptor());
      descriptors.add(ReloadedDescriptors.getVdfDescriptor());
      descriptors.add(ReloadedDescriptors.getThreadsDescriptor());
      descriptors.add(ShrinkWrapReloadedDescriptors.getTempFileProviderDescriptor());
      descriptors.add(ShrinkWrapReloadedDescriptors.getShrinkWrapDeployerDescriptor());

      // Start the server
      try
      {
         server.start();
      }
      catch (final Exception e)
      {
         throw new LifecycleException("Error in starting the Microcontainer server " + server, e);
      }

      // Get the ShrinkWrapDeployer
      final ShrinkWrapDeployer deployer = (ShrinkWrapDeployer) server.getKernel().getController().getInstalledContext(
            NAME_MC_SHRINKWRAP_DEPLOYER).getTarget();

      context.add(MCServer.class, server);
      context.add(ShrinkWrapDeployer.class, deployer);
   }
View Full Code Here

      context.add(ShrinkWrapDeployer.class, deployer);
   }

   public void stop(final Context context) throws LifecycleException
   {
      final MCServer server = context.get(MCServer.class);
      // If we've got a server
      if (server != null && server.getState().equals(LifecycleState.STARTED))
      {
         // Bring it down
         try
         {
            server.stop();
         }
         catch (final Exception e)
         {
            throw new LifecycleException("Error in stopping the Microcontainer server " + server, e);
         }
View Full Code Here

TOP

Related Classes of org.jboss.bootstrap.api.mc.server.MCServer

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.