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

Examples of com.vmware.bdd.plugin.ambari.api.AmbariManagerClientbuilder


   @BeforeMethod
   public void setUp() throws Exception {
      ApiRootResource apiRootResource = Mockito.mock(ApiRootResource.class);
      RootResourceV1 rootResourceV1 = new FakeRootResourceV1();
      Mockito.when(apiRootResource.getRootV1()).thenReturn(rootResourceV1);
      AmbariManagerClientbuilder clientbuilder = Mockito.mock(AmbariManagerClientbuilder.class);
      Mockito.when(clientbuilder.build()).thenReturn(apiRootResource);
      apiManager = new ApiManager(clientbuilder);
   }
View Full Code Here


   public void setup() throws IOException {
      ApiRootResource apiRootResource = Mockito.mock(ApiRootResource.class);
      RootResourceV1 rootResourceV1 = new FakeRootResourceV1();
      Mockito.when(apiRootResource.getRootV1()).thenReturn(rootResourceV1);

      AmbariManagerClientbuilder clientbuilder = Mockito.mock(AmbariManagerClientbuilder.class);
      Mockito.when(clientbuilder.build()).thenReturn(apiRootResource);

      AmClusterValidator validator = Mockito.mock(AmClusterValidator.class);
      Mockito.when(validator.validateBlueprint(blueprint)).thenReturn(true);

      //Mock static utility using Mockit.
View Full Code Here

   private AmbariManagerClientbuilder makeClientBuilder() {
      ApiRootResource apiRootResource = Mockito.mock(ApiRootResource.class);
      RootResourceV1 rootResourceV1 = new FakeRootResourceV1();
      Mockito.when(apiRootResource.getRootV1()).thenReturn(rootResourceV1);

      AmbariManagerClientbuilder clientbuilder = Mockito.mock(AmbariManagerClientbuilder.class);
      Mockito.when(clientbuilder.build()).thenReturn(apiRootResource);
      return clientbuilder;
   }
View Full Code Here

   @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());
View Full Code Here

   }

   @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());
View Full Code Here

   @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());
View Full Code Here

   @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");
         }
View Full Code Here

   @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());
View Full Code Here

      ApiRootResource apiRootResource = Mockito.mock(ApiRootResource.class);
      RootResourceV1 rootResourceV1 = new FakeRootResourceV1();
      Mockito.when(apiRootResource.getRootV1()).thenReturn(rootResourceV1);

      AmbariManagerClientbuilder clientbuilder = Mockito.mock(AmbariManagerClientbuilder.class);
      Mockito.when(clientbuilder.build()).thenReturn(apiRootResource);

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

      blueprint = SerialUtils.getObjectByJsonString(ClusterBlueprint.class, content);
View Full Code Here

   private static final Logger logger = Logger.getLogger(ApiManager.class);

   private RootResourceV1 apiResourceRootV1;

   public ApiManager(String amServerHost, int port, String user, String password) {
      this(new AmbariManagerClientbuilder().withHost(amServerHost)
            .withPort(port).withUsernamePassword(user, password));
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.plugin.ambari.api.AmbariManagerClientbuilder

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.