Package com.vmware.bdd.software.mgmt.plugin.intf

Examples of com.vmware.bdd.software.mgmt.plugin.intf.SoftwareManagerFactory


   @Test
   public void testGetSoftwareManager() {
      Mockit.setUpMock(MockAmbariManagerClientbuilder.class);
      Mockit.setUpMock(MockApiManager.class);
      apiRootResource = Mockito.mock(ApiRootResource.class);
      SoftwareManagerFactory softwareManagerFactory = new AmbariFactory();
      AmbariImpl softwareManager = (AmbariImpl) softwareManagerFactory.getSoftwareManager(
                  "http://127.0.0.1:8080", "admin", "admin".toCharArray(), "RSA_CERT");
      Assert.assertEquals(Constants.AMBARI_PLUGIN_NAME, softwareManager.getName());
   }
View Full Code Here


         //should be internal exception, lixl
//         throw SoftwareManagerCollectorException.CLASS_NOT_DEFINED(appManagerAdd.getType());
      }
      logger.info("Factory class name is " + factoryClassName);

      SoftwareManagerFactory softwareManagerFactory = null;
      try {
         Class<? extends SoftwareManagerFactory> clazz = ReflectionUtils.getClass(factoryClassName, SoftwareManagerFactory.class);
         logger.info("Factory class loaded.");
         softwareManagerFactory = ReflectionUtils.newInstance(clazz);
      } catch (Exception e) {
         String errMsg = String.format(Messages.getString("SW_MGR_COLLECTOR.CANNT_INSTANTIATE_APP_MGR_FACTORY"), factoryClassName);
         logger.error(errMsg, e);
         throw new SWMgrCollectorInternalException(e, errMsg);
//         throw SoftwareManagerCollectorException.CAN_NOT_INSTANTIATE(e, factoryClassName);
      }

      logger.info("Start to invoke application manager factory to create application manager.");
      SoftwareManager softwareManager = null;

      try {
         softwareManager =
               softwareManagerFactory.getSoftwareManager(appManagerAdd.getUrl(), appManagerAdd
                     .getUsername(), appManagerAdd.getPassword().toCharArray(),
                     getPrivateKey());
      } catch (Exception ex) {
         //TODO the handling is not clear: was it a connection failure (external), or some instantiating error (internal). lixl
         logger.error("Create application manager failed: " + ex.getMessage(), ex);
View Full Code Here

      apiHostList = Mockito.mock(ApiHostList.class);
      Mockito.when(apiHostList.getHosts()).thenReturn(list);
      Mockito.when(hostsResourceV2.readHosts(DataView.SUMMARY)).thenReturn(apiHostList);
      Mockito.when(rootResourceV6.getHostsResource()).thenReturn(hostsResourceV2);
      Mockito.when(apiRootResource.getRootV6()).thenReturn(rootResourceV6);
      SoftwareManagerFactory softwareManagerFactory = new ClouderaManagerFactory();
      ClouderaManagerImpl softwareManager =
            (ClouderaManagerImpl) softwareManagerFactory.getSoftwareManager(
                  "http://127.0.0.1:7180", "admin", "admin".toCharArray(),
                  "RSA_CERT");
      System.out.println(softwareManager.getCmServerHostId());
      assertEquals(softwareManager.getCmServerHostId(), "host1");
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.software.mgmt.plugin.intf.SoftwareManagerFactory

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.