Package org.jboss.deployers.spi.management.deploy

Examples of org.jboss.deployers.spi.management.deploy.DeploymentManager


   }

   @Override
   protected void tearDown() throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      deployMgr.releaseProfile();
      super.tearDown();
   }
View Full Code Here


   }

   @SuppressWarnings("deprecation")
   protected void testDeployment(String name, String type, ManagedDeploymentTester tester) throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      URL contentURL = getDeployURL(name);
      assertNotNull(contentURL);
      getLog().debug(contentURL);
      // TODO - hack to get off JDK's url handling
      String urlString = contentURL.toExternalForm();
      int p = urlString.indexOf(":/");
      contentURL = new URL("vfszip" + urlString.substring(p));
      getLog().debug(contentURL);

      DeploymentStatus status;
      DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
      progress.addProgressListener(this);
      progress.run();
      String[] uploadedNames = {};
      try
      {
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         // It should not be running yet
         assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());

         // Get the unique deployment name
         uploadedNames = progress.getDeploymentID().getRepositoryNames();
         getLog().debug("Uploaded deployment names: "+Arrays.asList(uploadedNames));
         // Now start the deployment
         progress = deployMgr.start(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         try
         {
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
            // Check for a
            ManagementView mgtView = getManagementView();
            ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0]);
            assertNotNull(deployment);
            getLog().info("Found " + type + " deployment: " + deployment);
            Set<String> types = deployment.getTypes();
            if (types != null && types.isEmpty() == false)
               assertTrue("Missing type: " + type + ", available: " + types, types.contains(type));
            if (tester != null)
            {
               tester.testManagedDeployment();
            }
         }
         finally
         {
            //Thread.sleep(15 * 1000); // 15 secs >> more than it takes for reaper to run :-)

            // Stop/remove the deployment
            progress = deployMgr.stop(uploadedNames);
            progress.addProgressListener(this);
            progress.run();
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
         }
      }
      finally
      {
         progress = deployMgr.remove(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
View Full Code Here

    *
    */
   public void testNoSuchProfileException()
      throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager();
      ProfileKey badKey = new ProfileKey("no-such-profile");
      try
      {
         deployMgr.loadProfile(badKey);
         fail("Did not see NoSuchProfileException");
      }
      catch(NoSuchProfileException e)
      {
         assertTrue("NoSuchProfileException", e.getMessage().contains("no-such-profile"));
View Full Code Here

    {
        Properties env = new Properties();
        env.setProperty(Context.PROVIDER_URL, this.providerURL);
        ProfileService profileService;
        ManagementView managementView;
        DeploymentManager deploymentManager;
        ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
        try
        {
            Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
            if (this.principal != null)
View Full Code Here

//      testDeployment(name, "sar", null);
   }
  
   protected void testDeployment(String name, String type, ManagedDeploymentTester tester) throws Exception
   {
      DeploymentManager deployMgr = getDeploymentManager(getNamingContext(0));
      URL contentURL = getDeployURL(name);
      assertNotNull(contentURL);
      getLog().debug(contentURL);
      // TODO - hack to get off JDK's url handling
      String urlString = contentURL.toExternalForm();
      int p = urlString.indexOf(":/");
      contentURL = new URL("vfszip" + urlString.substring(p));
      getLog().debug(contentURL);

      DeploymentStatus status;
      DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
      progress.addProgressListener(this);
      progress.run();
      String[] uploadedNames = {};
      try
      {
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         // It should not be running yet
         assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());

         // Get the unique deployment name
         uploadedNames = progress.getDeploymentID().getRepositoryNames();
         getLog().debug("Uploaded deployment names: "+Arrays.asList(uploadedNames));
        
         // Now start the deployment
         progress = deployMgr.start(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         try
         {
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
            // Check for a
            ManagementView mgtView = getManagementView(getNamingContext(0));
            ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0]);
            assertNotNull(deployment);
            getLog().info("Found " + type + " deployment: " + deployment);
            Set<String> types = deployment.getTypes();
            if (types != null && types.isEmpty() == false)
               assertTrue("Missing type: " + type + ", available: " + types, types.contains(type));
            if (tester != null)
            {
               tester.testManagedDeployment();
            }
         }
         finally
         {
            //Thread.sleep(15 * 1000); // 15 secs >> more than it takes for reaper to run :-)

            // Stop/remove the deployment
            progress = deployMgr.stop(uploadedNames);
            progress.addProgressListener(this);
            progress.run();
            status = progress.getDeploymentStatus();
            assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
            assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
         }
      }
      finally
      {
         progress = deployMgr.remove(uploadedNames);
         progress.addProgressListener(this);
         progress.run();
         status = progress.getDeploymentStatus();
         assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
         assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
View Full Code Here

   }

   public void testWarDeployment()
      throws Exception
   {
      DeploymentManager mgtView = getDeploymentManager();
      URL contentURL = super.getDeployURL("testWarDeployment.war");
      DeploymentProgress progress = mgtView.distribute("testWarDeployment.war", contentURL, true);
      assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
   }
View Full Code Here

      assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
   }
   public void testEarDeployment()
      throws Exception
   {
      DeploymentManager mgtView = getDeploymentManager();
      URL contentURL = super.getDeployURL("testEarDeployment.ear");
      DeploymentProgress progress = mgtView.distribute("testEarDeployment.ear", contentURL, true);
      assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
   }
View Full Code Here

      throws Exception
   {
      URL contentURL = super.getDeployURL("testMCBeansDeployment.beans");

      // Distribute the content
      DeploymentManager mgtView = getDeploymentManager();
      DeploymentProgress progress = mgtView.distribute("testMCBeansDeployment.beans", contentURL, true);
      assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
      progress.addProgressListener(this);
      progress.run();
      DeploymentStatus status = progress.getDeploymentStatus();
      assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
      // It should not be running yet
      assertFalse("DeploymentStatus.isRunning", status.isRunning());
      assertFalse("DeploymentStatus.isFailed", status.isFailed());

      // Now start the deployment
      String[] names = {"testMCBeansDeployment.beans"};
      progress = mgtView.start(names);
      assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
      progress.addProgressListener(this);
      progress.run();
      status = progress.getDeploymentStatus();
      assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
View Full Code Here

      assertFalse("DeploymentStatus.isFailed", status.isFailed());     
   }
   public void testSarDeployment()
      throws Exception
   {
      DeploymentManager mgtView = getDeploymentManager();
      URL contentURL = super.getDeployURL("testSarDeployment.sar");
      DeploymentProgress progress = mgtView.distribute("testSarDeployment.sar", contentURL, true);
      assertEquals("DeploymentProgress.getDeploymentTargets", 2, progress.getDeploymentTargets().size());
   }
View Full Code Here

   protected void removeDeployment(String deployment)
      throws Exception
   {
      String names[] = new String[] {deployment};
      DeploymentManager deployMgr = getDeploymentManager();
      try
      {
         DeploymentProgress progress = deployMgr.stop(names);
         progress.run();
         assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
      }
      finally
      {
         DeploymentProgress progress = deployMgr.remove(names);
         progress.run();
         assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.deployers.spi.management.deploy.DeploymentManager

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.