Package org.jboss.deployers.client.spi

Examples of org.jboss.deployers.client.spi.DeployerClient


      assertEquals(expected, deployer.getUndeployedUnits());
   }

   public void testSingleAndMultipleMix() throws Throwable
   {
      DeployerClient main = getMainDeployer();

      Deployment single = createSimpleDeployment("single");
      main.deploy(single);
      List<String> expected = new ArrayList<String>();
      expected.add(single.getName());
      assertEquals(expected, deployer.getDeployedUnits());

      Deployment normal = createSimpleDeployment("normal");
      main.addDeployment(normal);
      main.process();
      expected.add(normal.getName());
      assertEquals(expected, deployer.getDeployedUnits());

      main.undeploy(single);
      expected.clear();
      expected.add(single.getName());
      assertEquals(expected, deployer.getUndeployedUnits());

      main.removeDeployment(normal.getName());
      main.process();
      expected.add(normal.getName());
      assertEquals(expected, deployer.getUndeployedUnits());
   }
View Full Code Here


      assertEquals(expected, deployer.getUndeployedUnits());
   }

   public void testSingleAndMultipleMix2() throws Throwable
   {
      DeployerClient main = getMainDeployer();

      Deployment single = createSimpleDeployment("single");
      main.deploy(single);
      List<String> expected = new ArrayList<String>();
      expected.add(single.getName());
      assertEquals(expected, deployer.getDeployedUnits());

      Deployment normal = createSimpleDeployment("normal");
      main.addDeployment(normal);
      main.process();
      expected.add(normal.getName());
      assertEquals(expected, deployer.getDeployedUnits());

      main.removeDeployment(normal.getName());
      main.process();
      expected.clear();
      expected.add(normal.getName());
      assertEquals(expected, deployer.getUndeployedUnits());

      main.undeploy(single);
      expected.add(single.getName());
      assertEquals(expected, deployer.getUndeployedUnits());
   }
View Full Code Here

   public void testDeployment() throws Exception
   {
      TestDeploymentDeployer1 componentDeployer1 = new TestDeploymentDeployer1();
      TestRealDeployer1 realDeployer1 = new TestRealDeployer1();
      DeployerClient main = createMainDeployer(componentDeployer1, realDeployer1);
     
      Deployment deployment = createSimpleDeployment("deploy");
      MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();

      TestDeployment1 deployment1 = new TestDeployment1();
      TestMetaData1 component1 = new TestMetaData1("TestBean1");
      deployment1.addBean(component1);
      attachments.addAttachment(TestDeployment1.class, deployment1);

      main.addDeployment(deployment);
      main.process();

      assertEquals(Collections.singletonList(component1), realDeployer1.deployed);
     
      main.removeDeployment(deployment);
      main.process();
      assertEmpty(realDeployer1.deployed);
   }
View Full Code Here

   public void testMetaData() throws Exception
   {
      TestDeploymentDeployer1 componentDeployer1 = new TestDeploymentDeployer1();
      TestRealDeployer1 realDeployer1 = new TestRealDeployer1();
      DeployerClient main = createMainDeployer(componentDeployer1, realDeployer1);
     
      Deployment deployment = createSimpleDeployment("deploy");
      MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();

      TestMetaData1 component1 = new TestMetaData1("TestBean1");
      attachments.addAttachment(TestMetaData1.class, component1);

      main.addDeployment(deployment);
      main.process();

      assertEquals(Collections.singletonList(component1), realDeployer1.deployed);
     
      main.removeDeployment(deployment);
      main.process();
      assertEmpty(realDeployer1.deployed);
   }
View Full Code Here

      return suite(DeployerChangeStageTestCase.class);
   }

   public void testMainDeployerInUnit() throws Throwable
   {
      DeployerClient main = getMainDeployer();

      Deployment single = createSimpleDeployment("single");
      main.deploy(single);
      List<String> expected = new ArrayList<String>();
      expected.add(single.getName());
      assertEquals(expected, deployer.getDeployedUnits());
     
      DeploymentUnit unit = assertDeploymentUnit(main, single.getName());
      assertEquals(main, unit.getMainDeployer());
     
      main.undeploy(single);
      assertNull(unit.getMainDeployer());
   }
View Full Code Here

      assertNull(unit.getMainDeployer());
   }

   public void testChangeStage() throws Throwable
   {
      DeployerClient main = getMainDeployer();

      Deployment single = createSimpleDeployment("single");
      assertEquals(DeploymentStages.NOT_INSTALLED, main.getDeploymentStage(single.getName()));
      main.deploy(single);
      List<String> expected = new ArrayList<String>();
      expected.add(single.getName());
      assertEquals(expected, deployer.getDeployedUnits());
      assertEquals(DeploymentStages.INSTALLED, main.getDeploymentStage(single.getName()));

      main.change(single.getName(), DeploymentStages.CLASSLOADER);
      assertEquals(expected, deployer.getUndeployedUnits());
      assertEquals(DeploymentStages.CLASSLOADER, main.getDeploymentStage(single.getName()));
     
      main.undeploy(single);
      assertEquals(DeploymentStages.NOT_INSTALLED, main.getDeploymentStage(single.getName()));
      assertEquals(expected, deployer.getDeployedUnits());
      assertEquals(expected, deployer.getUndeployedUnits());
      try
      {
         main.change(single.getName(), DeploymentStages.REAL);
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(DeploymentException.class, t);
      }
     
      deployer.clear();
      assertEquals(DeploymentStages.NOT_INSTALLED, main.getDeploymentStage(single.getName()));
      main.deploy(single);
      assertEquals(expected, deployer.getDeployedUnits());
      assertEquals(DeploymentStages.INSTALLED, main.getDeploymentStage(single.getName()));
      main.change(single.getName(), DeploymentStages.CLASSLOADER);
      assertEquals(DeploymentStages.CLASSLOADER, main.getDeploymentStage(single.getName()));
      deployer.clear();
      main.change(single.getName(), DeploymentStages.REAL);
      assertEquals(expected, deployer.getDeployedUnits());
      assertEquals(DeploymentStages.REAL, main.getDeploymentStage(single.getName()));
   }
View Full Code Here

      assertEquals(DeploymentStages.REAL, main.getDeploymentStage(single.getName()));
   }

   public void testChangeStageFail() throws Throwable
   {
      DeployerClient main = getMainDeployer();

      Deployment single = createSimpleDeployment("single");
      assertEquals(DeploymentStages.NOT_INSTALLED, main.getDeploymentStage(single.getName()));
      main.deploy(single);
      List<String> expected = new ArrayList<String>();
      expected.add(single.getName());
      assertEquals(expected, deployer.getDeployedUnits());
      assertEquals(DeploymentStages.INSTALLED, main.getDeploymentStage(single.getName()));

      main.change(single.getName(), DeploymentStages.CLASSLOADER);
      assertEquals(DeploymentStages.CLASSLOADER, main.getDeploymentStage(single.getName()));
      DeploymentUnit unit = assertDeploymentUnit(main, single.getName());
      DeploymentContext context = assertDeploymentContext(main, single.getName());
      unit.addAttachment("fail", deployer);
     
      deployer.clear();
      try
      {
         main.change(single.getName(), DeploymentStages.REAL);
         fail("Should not be here");
      }
      catch (Throwable t)
      {
         checkThrowable(DeploymentException.class, t);
      }
      assertEquals(expected, deployer.getFailed());
      assertEquals(DeploymentState.ERROR, context.getState());
      checkThrowable(DeploymentException.class, context.getProblem());
      assertEquals(DeploymentStages.NOT_INSTALLED, main.getDeploymentStage(single.getName()));
   }
View Full Code Here

      return suite(DeployerCheckCompleteTestCase.class);
   }

   public void testAllFailure() throws Exception
   {
      DeployerClient main = getMainDeployer();
      Deployment deployment = createSimpleDeployment("failure");
      makeFail(deployment, deployer);
      main.addDeployment(deployment);
      main.process();
      try
      {
         main.checkComplete(deployment);
         fail("Should not be here.");
      }
      catch (DeploymentException e)
      {
         assertInstanceOf(e, IncompleteDeploymentException.class);
View Full Code Here

      }
   }

   public void testAllSuccess() throws Exception
   {
      DeployerClient main = getMainDeployer();
      Deployment deployment = createSimpleDeployment("failure");
      main.addDeployment(deployment);
      main.process();
      main.checkComplete(deployment);
   }
View Full Code Here

      main.checkComplete(deployment);
   }

   public void testStructureFailure() throws Exception
   {
      DeployerClient main = getMainDeployer();
      MainDeployerImpl mainImpl = (MainDeployerImpl)main;
      StructuralDeployers sd = new StructuralDeployers()
      {
         public DeploymentContext determineStructure(Deployment deployment) throws DeploymentException
         {
            throw new DeploymentException("No such structure deployers.");
         }
      };
      mainImpl.setStructuralDeployers(sd);
      Deployment deployment = createSimpleDeployment("failure");
      makeFail(deployment, deployer);
      try
      {
         main.addDeployment(deployment);
         main.process();
      }
      catch (Throwable ignored)
      {
      }
      try
      {
         main.checkComplete();
         fail("Should not be here.");
      }
      catch (DeploymentException e)
      {
         assertInstanceOf(e, IncompleteDeploymentException.class);
View Full Code Here

TOP

Related Classes of org.jboss.deployers.client.spi.DeployerClient

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.