Package com.vmware.bdd.plugin.ambari.api.model.cluster

Examples of com.vmware.bdd.plugin.ambari.api.model.cluster.ApiRequest


      AmbariImpl spy = Mockito.spy(provider);
      AmbariManagerClientbuilder clientbuilder = makeClientBuilder();
      ApiManager apiManager = new FakeApiManager(clientbuilder) {
         @Override
         public ApiRequest stopAllServicesInCluster(String clusterName) throws AmbariApiException {
            ApiRequest apiRequest = new ApiRequest();
            apiRequest.setApiRequestInfo(new ApiRequestInfo());
            return apiRequest;
         }
      };

      Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
View Full Code Here


      AmbariManagerClientbuilder clientbuilder = makeClientBuilder();
      ApiManager apiManager = new FakeApiManager(clientbuilder) {
         @Override
         public ApiRequest startAllServicesInCluster(String clusterName) throws AmbariApiException {
            ApiRequest apiRequest = new ApiRequest();
            apiRequest.setApiRequestInfo(new ApiRequestInfo());
            return apiRequest;
         }
      };
      try {
         Mockito.when(spy.doSoftwareOperation(Mockito.anyString(), Mockito.<ApiRequest>any(),
View Full Code Here

      ClusterReport clusterReport = new ClusterReport(blueprint);
      AmbariImpl spy = Mockito.spy(provider);
      ApiManager apiManager = new FakeApiManager(makeClientBuilder());
      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      ApiRequest request = new ApiRequest();
      ApiRequestInfo requestInfo = new ApiRequestInfo();
      request.setApiRequestInfo(requestInfo);
      try {
         spy.doSoftwareOperation(blueprint.getName(), request, clusterReport, reportQueue);
      } catch (Exception e) {
         e.printStackTrace();
         Assert.assertTrue(e.getMessage().contains("Failed to execute request: "));
View Full Code Here

      Assert.assertTrue(!services.isEmpty());
   }

   @Test
   public void testStopAllServicesInCluster() throws Exception {
      ApiRequest apiRequest = apiManager.stopAllServicesInCluster(clusterName);
      Assert.assertNotNull(apiRequest);
   }
View Full Code Here

      Assert.assertNotNull(apiRequest);
   }

   @Test
   public void testStartAllServicesInCluster() throws Exception {
      ApiRequest apiRequest = apiManager.startAllServicesInCluster(clusterName);
      Assert.assertNotNull(apiRequest);
   }
View Full Code Here

      Assert.assertTrue(!serviceNames.isEmpty());
   }

   @Test
   public void testProvisionCluster() throws Exception {
      ApiRequest apiRequest = apiManager.provisionCluster(clusterName, apiClusterBlueprint);
      Assert.assertNotNull(apiRequest);
      Assert.assertEquals(apiRequest.getApiRequestInfo().getClusterName(), clusterName);
   }
View Full Code Here

      return apiHostList;
   }

   @Override
   public ApiRequest deleteHost(String clusterName, String fqdn) throws AmbariApiException {
      return new ApiRequest();
   }
View Full Code Here

      return true;
   }

   @Override
   public ApiRequest getRequestWithTasks(String clusterName, Long requestId) throws AmbariApiException {
      ApiRequest apiRequest = new ApiRequest();
      List<ApiTask> apiTasks = new ArrayList<>();
      ApiTask apiTask = new ApiTask();
      ApiTaskInfo taskInfo = new ApiTaskInfo();
      taskInfo.setStatus("FAILED");
      taskInfo.setHostName("host01");
      apiTask.setApiTaskInfo(taskInfo);
      apiTasks.add(apiTask);
      apiRequest.setApiTasks(apiTasks);
      ApiRequestInfo apiRequestInfo = new ApiRequestInfo();
      apiRequestInfo.setRequestStatus("FAILED");
      apiRequest.setApiRequestInfo(apiRequestInfo);
      return  apiRequest;
   }
View Full Code Here

         // For cluster resume/resize, the blueprint is already exist, we need to delete this cluster first.
         if (isProvisioned(clusterName) && isClusterProvisionedByBDE(clusterDef)) {
            try {
               if (hasHosts(clusterName)) {
                  ApiRequest apiRequestSummary = apiManager.stopAllServicesInCluster(clusterName);
                  doSoftwareOperation(clusterName, apiRequestSummary, clusterDef.getCurrentReport(), reportQueue);
               }
            } catch (Exception e) {
               logger.error("Failed to stop all services: ", e);
               throw SoftwareManagementPluginException.STOP_CLUSTER_EXCEPTION(e, Constants.AMBARI_PLUGIN_NAME, clusterName);
            }
            apiManager.deleteCluster(clusterName);
         }

         ApiRequest apiRequestSummary =
               apiManager.provisionCluster(clusterDef.getName(),
                     clusterDef.toApiClusterBlueprint());

         ClusterOperationPoller poller =
               new ClusterOperationPoller(apiManager, apiRequestSummary,
                     clusterName, clusterDef.getCurrentReport(), reportQueue,
                     ProgressSplit.PROVISION_SUCCESS.getProgress());
         poller.waitForComplete();

         boolean success = false;
         ApiRequest apiRequest =
               apiManager.getRequest(clusterName, apiRequestSummary
                     .getApiRequestInfo().getRequestId());
         ClusterRequestStatus clusterRequestStatus =
               ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                     .getRequestStatus());
         if (!clusterRequestStatus.isFailedState()) {
            success = true;
         }
         if (!success) {
View Full Code Here

   }

   private void stopAllComponents(AmClusterDef clusterDef,
         List<String> existingHosts, ClusterReportQueue reports)
               throws Exception {
      ApiRequest apiRequestSummary =
            apiManager.stopAllComponentsInHosts(clusterDef.getName(),
                  existingHosts);
      if (apiRequestSummary == null || apiRequestSummary.getApiRequestInfo() == null) {
         logger.debug("No components need to be stopped.");
         return;
      }

      ClusterOperationPoller poller =
            new ClusterOperationPoller(apiManager, apiRequestSummary,
                  clusterDef.getName(), clusterDef.getCurrentReport(), reports,
                  ProgressSplit.PROVISION_SUCCESS.getProgress());
      poller.waitForComplete();

      boolean success = false;
      ApiRequest apiRequest =
            apiManager.getRequest(clusterDef.getName(), apiRequestSummary
                  .getApiRequestInfo().getRequestId());
      ClusterRequestStatus clusterRequestStatus =
            ClusterRequestStatus.valueOf(apiRequest.getApiRequestInfo()
                  .getRequestStatus());
      if (!clusterRequestStatus.isFailedState()) {
         success = true;
      }
      if (!success) {
View Full Code Here

TOP

Related Classes of com.vmware.bdd.plugin.ambari.api.model.cluster.ApiRequest

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.