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

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


    List<DeploymentOption> deploymentOptions = new ArrayList<DeploymentOption>();
    if (deployExploded) {
      deploymentOptions.add(DeploymentOption.Explode);
    }
    // try to deploy
    DeploymentProgress progress = null;
    try {
      progress = deploymentManager.distribute(fileName, resourceURL, deploymentOptions.toArray(new DeploymentOption[deploymentOptions.size()]));
      execute(progress, IntegrationPlugin.Util.getString("distribute_failed", fileName)); //$NON-NLS-1$
    } catch (Exception e) {
      handleException(e);
    }
   
    // Now that we've successfully distributed the deployment, we need to
    // start it.
    String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
    try {
      progress = deploymentManager.start(deploymentNames);
      execute(progress, IntegrationPlugin.Util.getString("deployment_start_failed", fileName)); //$NON-NLS-1$
    } catch(Exception e) {
      try {
View Full Code Here


    DeploymentManager deploymentManager = getConnection()
        .getDeploymentManager();
   
    log.debug("Stopping deployment [" + this.deploymentUrl + "]..."); //$NON-NLS-1$ //$NON-NLS-2$
    DeploymentProgress progress = deploymentManager
        .stop(this.deploymentUrl);
    DeploymentStatus stopStatus = DeploymentUtils.run(progress);
    if (stopStatus.isFailed()) {
      log.error("Failed to stop deployment '" + this.deploymentUrl //$NON-NLS-1$
          + "'.", stopStatus.getFailure()); //$NON-NLS-1$
View Full Code Here

    // Now stop the original app.
    try {
      DeploymentManager deploymentManager = getConnection()
          .getDeploymentManager();
      DeploymentProgress progress = deploymentManager
          .stop(this.deploymentUrl);
      DeploymentUtils.run(progress);
    } catch (Exception e) {
      throw new RuntimeException("Failed to stop deployment [" //$NON-NLS-1$
          + this.deploymentUrl + "].", e); //$NON-NLS-1$
    }

    // And then remove it (this will delete the physical file/dir from the
    // deploy dir).
    try {
      DeploymentManager deploymentManager = getConnection()
          .getDeploymentManager();
      DeploymentProgress progress = deploymentManager
          .remove(this.deploymentUrl);
      DeploymentUtils.run(progress);
    } catch (Exception e) {
      throw new RuntimeException("Failed to remove deployment [" //$NON-NLS-1$
          + this.deploymentUrl + "].", e); //$NON-NLS-1$
View Full Code Here

   * @param archiveFileName
   * @throws Exception
   */
  private static void deployAndStart(DeploymentManager deploymentManager,
      URL contentURL, String archiveFileName) throws Exception {
    DeploymentProgress progress = null;
        DeploymentStatus distributeStatus;
        Exception distributeFailure = null;
        try {
            progress = deploymentManager.distribute(archiveFileName, contentURL, true);
            distributeStatus = run(progress);
            if (distributeStatus.isFailed()) {
                distributeFailure = (distributeStatus.getFailure() != null) ? distributeStatus.getFailure() :
                        new Exception("Distribute failed for unknown reason."); //$NON-NLS-1$
            }
        }
        catch (Exception e) {
            distributeFailure = e;
        }
        if (distributeFailure != null) {
            throw new Exception("Failed to distribute '" + contentURL + "' to '" + archiveFileName + "' - cause: "  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    + ThrowableUtil.getAllMessages(distributeFailure));
        }

        // Now that we've successfully distributed the deployment, we need to start it.
        String[] deploymentNames = progress.getDeploymentID().getRepositoryNames();
        DeploymentStatus startStatus;
        Exception startFailure = null;
        try {
            progress = deploymentManager.start(deploymentNames);
            startStatus = run(progress);
View Full Code Here

   @Override
   protected void tearDown() throws Exception
   {
      // Undeploy the test JAR
      log.info("Undeploying: " + repositoryNames);
      final DeploymentProgress stopProgress = deploymentManager.stop(repositoryNames);
      stopProgress.run();
      final DeploymentProgress removeProgress = deploymentManager.remove(repositoryNames);
      removeProgress.run();

      // Null out
      repositoryNames = null;
      deploymentManager = null;
      managementView = null;
View Full Code Here

    * @throws Exception
    */
   protected void deploy(final String deployName, final URL url) throws Exception
   {
      // Deploy
      final DeploymentProgress distributeProgress = deploymentManager.distribute(deployName, url, true);
      distributeProgress.run();
      repositoryNames = distributeProgress.getDeploymentID().getRepositoryNames();
      final DeploymentProgress startProgress = deploymentManager.start(repositoryNames);
      log.info("Deploying: " + repositoryNames);
      startProgress.run();

      // Reset the Management View
      managementView = this.getManagementView();
   }
View Full Code Here

      int p = urlString.indexOf(":/");
      contentURL = new URL("file" + 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

      assertNotNull(test2)
      // Remove
      mgtView.removeComponent(remove);
     
      // Redeploy
      DeploymentProgress progress = getDeploymentManager().redeploy(test1.getDeployment().getName());
      progress.run();
     
      mgtView = getManagementView();
      remove = mgtView.getComponent("ProfileServiceTestRemoveDataSource", locaDSType);
      assertNull(remove);     
   }
View Full Code Here

                  return;

               String[] names = jarNames.split(",");
               for (String name : names)
               {
                  DeploymentProgress distribute = getDeploymentManager().distribute(name, getManagedURL(name), copyContent);
                  //distribute.addProgressListener(LOG_PROGRESS_LISTENER);
                  distribute.run();
                  checkProgress(distribute);

                  deploymentNames.addAll(Arrays.asList(distribute.getDeploymentID().getRepositoryNames()));
               }
              
               // Check the resolution of repository names
               assertTrue("resolve repsoitory names",
                     Arrays.asList(getDeploymentManager().getRepositoryNames(names)).containsAll(deploymentNames));
              
              
               DeploymentProgress start = getDeploymentManager().start(deploymentNames.toArray(new String[ deploymentNames.size()]));
               start.run();
               if(checkStarted)
                  checkProgress(start);

               staticLog.info("Deployed package: " + deploymentNames);
            }
            catch (Exception ex)
            {
               // Throw this in testServerFound() instead.
               deploymentException = ex;
               staticLog.error("Caught exception when trying to deploy : " + jarNames, ex);
            }
         }

         protected void tearDown() throws Exception
         {
            if (jarNames == null)
               return;

            DeploymentProgress stop = getDeploymentManager().stop(deploymentNames.toArray(new String[ deploymentNames.size()]));
            stop.run();
            checkProgress(stop);

            DeploymentProgress undeploy = getDeploymentManager().remove(deploymentNames.toArray(new String[ deploymentNames.size()]));
            undeploy.run();
            checkProgress(undeploy);

            this.mv.load();
            for(String deploymentName : deploymentNames)
            {
View Full Code Here

   {
      final String deploymentName = getName() + ".ear";
      try
      {
         //
         DeploymentProgress start = distributeAndStart(NESTED_DEPLOYMENT, deploymentName, true, true);
         assertComplete(start);
         for(int i = 0; i < 5; i++)
         {
            // disable stopped check, as it was started before
            start = distributeAndStart(NESTED_DEPLOYMENT, deploymentName, true, false);
            assertComplete(start);
            assertDeploymentState(start.getDeploymentID(), DeploymentState.STARTED);

            Thread.sleep(5);
           
            redeployCheckComplete(deploymentName);
         }
View Full Code Here

TOP

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

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.