Examples of ApiManager


Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

   @Test(groups = { "TestAmbariImpl" })
   public void testStartClusterFailed() {
      AmbariImpl spy = Mockito.spy(provider);

      AmbariManagerClientbuilder clientbuilder = makeClientBuilder();
      ApiManager apiManager = new FakeApiManager(clientbuilder) {
         @Override
         public ApiRequest startAllServicesInCluster(String clusterName) throws AmbariApiException {
            throw AmbariApiException.RESPONSE_EXCEPTION(400, "Faked exception");
         }
      };

      Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
      Mockito.doReturn(1).when(spy).getRequestMaxRetryTimes();
      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      try {
         spy.startCluster(blueprint, reportQueue);
      } catch (SoftwareManagementPluginException e) {
         Assert.assertEquals(e.getCause().getMessage(), "Ambari server error: Faked exception.");
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

   @Test(groups = { "TestAmbariImpl" })
   public void testStartStoppedCluster() {
      AmbariImpl spy = Mockito.spy(provider);

      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(),
               Mockito.<ClusterReport>any(), Mockito.<ClusterReportQueue>any())).thenReturn(true);
      } catch (Exception e) {
      }
      Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
      Mockito.doReturn(1).when(spy).getRequestMaxRetryTimes();
      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      Assert.assertTrue(spy.startCluster(blueprint, reportQueue));
      spy.setApiManager(backup);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

   @Test(groups = { "TestAmbariImpl" })
   public void testDoSoftwareOperation() {
      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 {
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

      String content = CommonUtil.readJsonFile("simple_blueprint.json");

      blueprint = SerialUtils.getObjectByJsonString(ClusterBlueprint.class, content);

      validator = new AmClusterValidator();
      validator.setApiManager(new ApiManager(clientbuilder));
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

   @Test(groups = { "TestAmbariImpl" })
   public void testStopAlreadyStoppedCluster() {
      AmbariImpl spy = Mockito.spy(provider);

      AmbariManagerClientbuilder clientbuilder = makeClientBuilder();
      ApiManager apiManager = new FakeApiManager(clientbuilder);

      Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());

      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      Assert.assertTrue(spy.onStopCluster(blueprint, reportQueue));
      spy.setApiManager(backup);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

   @Test(groups = { "TestAmbariImpl" })
   public void testStopStartedCluster() {
      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);
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
      try {
         Mockito.when(spy.doSoftwareOperation(Mockito.anyString(), Mockito.<ApiRequest>any(),
               Mockito.<ClusterReport>any(), Mockito.<ClusterReportQueue>any())).thenReturn(true);
      } catch (Exception e) {
      }
      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      Assert.assertTrue(spy.onStopCluster(blueprint, reportQueue));
      spy.setApiManager(backup);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

      AmbariImpl spy = Mockito.spy(provider);
      Mockito.when(spy.echo()).thenReturn(true);
      Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
      Mockito.doReturn(false).when(spy).onStopCluster(Mockito.<ClusterBlueprint>any(), Mockito.<ClusterReportQueue>any());
      ApiManager apiManager = new FakeApiManager(makeClientBuilder());
      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      Assert.assertTrue(spy.onDeleteCluster(blueprint, reportQueue));
      spy.setApiManager(backup);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

      AmbariImpl spy = Mockito.spy(provider);
      Mockito.when(spy.echo()).thenReturn(true);
      Mockito.when(spy.isProvisioned(Mockito.anyString())).thenReturn(true);
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());
      Mockito.doReturn(true).when(spy).onStopCluster(Mockito.<ClusterBlueprint>any(), Mockito.<ClusterReportQueue>any());
      ApiManager apiManager = new FakeApiManager(makeClientBuilder());
      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      Assert.assertTrue(spy.onDeleteCluster(blueprint, reportQueue));
      spy.setApiManager(backup);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

   @Test(groups = { "TestAmbariImpl" })
   public void testStartAlreadyStartedCluster() {
      AmbariImpl spy = Mockito.spy(provider);

      AmbariManagerClientbuilder clientbuilder = makeClientBuilder();
      ApiManager apiManager = new FakeApiManager(clientbuilder);

      Mockito.when(spy.isProvisioned(blueprint.getName())).thenReturn(true);
      provider.isProvisioned(blueprint.getName());
      Mockito.doReturn(true).when(spy).isClusterProvisionedByBDE(Mockito.<AmClusterDef>any());

      ApiManager backup = spy.getApiManager();
      spy.setApiManager(apiManager);
      Assert.assertTrue(spy.startCluster(blueprint, reportQueue));
      spy.setApiManager(backup);
   }
View Full Code Here

Examples of com.vmware.bdd.plugin.ambari.api.manager.ApiManager

      }
   }

   public AmbariImpl(String amServerHost, int port, String username,
         String password, String privateKey) {
      this.apiManager = new ApiManager(amServerHost, port, username, password);
      this.privateKey = privateKey;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.