Package org.jboss.test.deployers.deployer.support

Examples of org.jboss.test.deployers.deployer.support.TestSimpleDeployer


      super(name);
   }

   public void testRequiredState() throws Exception
   {
      TestSimpleDeployer missing = new TestSimpleDeployer();
      missing.addRequiredInput(Calendar.class); // I guess no calendar is present :-)
      assertTrue(missing.getInputs().contains(Calendar.class.getName()));

      TestSimpleDeployer all = new TestSimpleDeployer();
      all.addRequiredInput(DeploymentStage.class.getName());
      assertTrue(all.getInputs().contains(DeploymentStage.class.getName()));

      TestSimpleDeployer empty = new TestSimpleDeployer();

      DeployerClient main = createMainDeployer(missing, all, empty);

      String name = "simple";
      Deployment deployment = createSimpleDeployment(name);

      MutableAttachments attachments = (MutableAttachments) deployment.getPredeterminedManagedObjects();
      attachments.addAttachment(DeploymentStage.class, DeploymentStages.DESCRIBE);

      Set<String> singleton;
      main.deploy(deployment);
      try
      {
         DeploymentUnit unit = getDeploymentUnit(main, name);
         singleton = Collections.singleton(unit.getName());

         assertEmpty(missing.getDeployedUnits());
         assertEquals(singleton, all.getDeployedUnits());
         assertEquals(singleton, empty.getDeployedUnits());
      }
      finally
      {
         main.undeploy(deployment);
      }

      assertEmpty(missing.getUndeployedUnits());
      assertEquals(singleton, all.getUndeployedUnits());
      assertEquals(singleton, empty.getUndeployedUnits());       
   }
View Full Code Here


   }
  
   public void testCorrectOrder() throws Exception
   {
      DeployerClient main = createMainDeployer();
      TestSimpleDeployer deployer1 = new TestSimpleDeployer(1);
      addDeployer(main, deployer1);
      TestSimpleDeployer deployer2 = new TestSimpleDeployer(2);
      addDeployer(main, deployer2);
     
      Deployment deployment = createSimpleDeployment("correctOrder");
      main.addDeployment(deployment);
      main.process();
     
      assertEquals(1, deployer1.getDeployOrder());
      assertEquals(2, deployer2.getDeployOrder());
      assertEquals(-1, deployer1.getUndeployOrder());
      assertEquals(-1, deployer2.getUndeployOrder());

      main.removeDeployment(deployment);
      main.process();
     
      assertEquals(1, deployer1.getDeployOrder());
      assertEquals(2, deployer2.getDeployOrder());
      assertEquals(4, deployer1.getUndeployOrder());
      assertEquals(3, deployer2.getUndeployOrder());

      main.addDeployment(deployment);
      main.process();
     
      assertEquals(5, deployer1.getDeployOrder());
      assertEquals(6, deployer2.getDeployOrder());
      assertEquals(4, deployer1.getUndeployOrder());
      assertEquals(3, deployer2.getUndeployOrder());
   }
View Full Code Here

   }
  
   public void testWrongOrder() throws Exception
   {
      DeployerClient main = createMainDeployer();
      TestSimpleDeployer deployer1 = new TestSimpleDeployer(1);
      addDeployer(main, deployer1);
      TestSimpleDeployer deployer2 = new TestSimpleDeployer(2);
      addDeployer(main, deployer2);
     
      Deployment deployment = createSimpleDeployment("wrongOrder");
      main.addDeployment(deployment);
      main.process();
     
      assertEquals(1, deployer1.getDeployOrder());
      assertEquals(2, deployer2.getDeployOrder());
      assertEquals(-1, deployer1.getUndeployOrder());
      assertEquals(-1, deployer2.getUndeployOrder());

      main.removeDeployment(deployment);
      main.process();
     
      assertEquals(1, deployer1.getDeployOrder());
      assertEquals(2, deployer2.getDeployOrder());
      assertEquals(4, deployer1.getUndeployOrder());
      assertEquals(3, deployer2.getUndeployOrder());

      main.addDeployment(deployment);
      main.process();
     
      assertEquals(5, deployer1.getDeployOrder());
      assertEquals(6, deployer2.getDeployOrder());
      assertEquals(4, deployer1.getUndeployOrder());
      assertEquals(3, deployer2.getUndeployOrder());
   }
View Full Code Here

      assertTrue("Deployer2 should be before Deployer1", c1d2 < c1d1 && c1d2 < c2d1 && c2d2 < c1d1 && c2d2 < c2d1);
   }
  
   protected DeployerClient getMainDeployer()
   {
      deployer1 = new TestSimpleDeployer(DeploymentStages.POST_CLASSLOADER);
      deployer2 = new TestSimpleDeployer(DeploymentStages.REAL);
      return createMainDeployer(deployer1, deployer2);
   }
View Full Code Here

   public void testAddDeployers() throws Exception
   {
      DeployerClient main = createMainDeployer();
      assertEmpty(getDeployers(main));
     
      Deployer deployer = new TestSimpleDeployer();
      HashSet<Deployer> expected = new HashSet<Deployer>();
      expected.add(deployer);

      addDeployer(main, deployer);
      assertEquals(expected, getDeployers(main));
     
      deployer = new TestSimpleDeployer();
      expected.add(deployer);

      addDeployer(main, deployer);
      assertEquals(expected, getDeployers(main));
View Full Code Here

   public void testRemoveDeployers() throws Exception
   {
      DeployerClient main = createMainDeployer();
      assertEmpty(getDeployers(main));
     
      Deployer deployer1 = new TestSimpleDeployer("1");
      Deployer deployer2 = new TestSimpleDeployer("2");
      HashSet<Deployer> expected = new HashSet<Deployer>();
      expected.add(deployer1);
      expected.add(deployer2);
      addDeployer(main, deployer1);
      addDeployer(main, deployer2);
      assertEquals(expected, getDeployers(main));
     
      Deployer notPresent = new TestSimpleDeployer();
      removeDeployer(main, notPresent);
      assertEquals(expected, getDeployers(main));

      removeDeployer(main, deployer1);
      expected.remove(deployer1);
View Full Code Here

   public void testSetDeployers() throws Exception
   {
      DeployerClient main = createMainDeployer();
      assertEmpty(getDeployers(main));
     
      Deployer deployer1 = new TestSimpleDeployer();
      Deployer deployer2 = new TestSimpleDeployer();
      Set<Deployer> expected = new HashSet<Deployer>();
      expected.add(deployer1);
      expected.add(deployer2);
      setDeployers(main, expected);
      assertEquals(expected, getDeployers(main));
View Full Code Here

TOP

Related Classes of org.jboss.test.deployers.deployer.support.TestSimpleDeployer

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.