Package com.vmware.bdd.apitypes

Examples of com.vmware.bdd.apitypes.AppManagerRead


   /**
    * @param entity
    * @return
    */
   private AppManagerRead toAppManagerRead(AppManagerEntity entity) {
      AppManagerRead read = new AppManagerRead();
      read.setName(entity.getName());
      read.setDescription(entity.getDescription());
      read.setType(entity.getType());
      read.setUrl(entity.getUrl());
      read.setUsername(entity.getUsername());
      /*read.setPassword(entity.getPassword());*/
      //the AppManagerRead will be returned to the CLIENT side.
      //mask the value to avoid leakage.
      read.setPassword("*****");
      read.setSslCertificate(entity.getSslCertificate());
      return read;
   }
View Full Code Here


      appManagerName = CommonUtil.decode(appManagerName);
      if (CommonUtil.isBlank(appManagerName)
            || !CommonUtil.validateResourceName(appManagerName)) {
         throw BddException.INVALID_PARAMETER("appmanager name", appManagerName);
      }
      AppManagerRead read = softwareManagerCollector.getAppManagerRead(appManagerName);
      return read;
   }
View Full Code Here

      logger.debug("got all app managers");
      return appManagerReads;
   }

   public AppManagerRead getAppManagerRead(String appManagerName) {
      AppManagerRead appManagerRead =
            appManagerService.getAppManagerRead(appManagerName);
      if (appManagerRead == null) {
         logger.error("Cannot find app manager " + appManagerName);
         throw SoftwareManagerCollectorException.APPMANAGER_NOT_FOUND(appManagerName);
      } else {
View Full Code Here

               prettyOutputAppManagerInfo(appmanagers);
            }
         } else {
            if (distros) {
               // appmanager list --name <name> --distros
               AppManagerRead appmanager = restClient.get(name);
               prettyOutputAppManagerDistros(appmanager);
            } else if (CommandsUtils.isBlank(distro)) {
               // appmanager list --name <name>
               AppManagerRead appmanager = restClient.get(name);
               prettyOutputAppManagerInfo(appmanager);
            } else {
               if (roles) {
                  // appmanager list --name <name> --distro <distro> --roles
                  String[] distroRoles = restClient.getRoles(name, distro);
View Full Code Here

               "Cannot modify default application manager.");
         return;
      }

      try {
         AppManagerRead appManagerRead = restClient.get(name);
         // Display a warning if there is any cluster using this appmanager
         List<String> clusters = appManagerRead.getManagedClusters();
         if (clusters != null && clusters.size() > 0) {
            List<String> warningMsgList = new ArrayList<String>(1);
            warningMsgList.add("Application manager " + name
                  + " is used by clusters " + clusters + ".");
            if (!CommandsUtils.showWarningMsg(name,
                  Constants.OUTPUT_OBJECT_APPMANAGER,
                  Constants.OUTPUT_OP_MODIFY, warningMsgList, false)) {
               return;
            }
         }

         AppManagerAdd appManagerAdd = new AppManagerAdd();
         appManagerAdd.setName(name);
         //appManagerAdd.setDescription(description);
         appManagerAdd.setDescription(appManagerRead.getDescription());
         //appManagerAdd.setType(type);
         appManagerAdd.setType(appManagerRead.getType());
         if (url == null) {
            appManagerAdd.setUrl(appManagerRead.getUrl());
         } else {
            //validate url in appManagerAdd
            List<String> errorMsgs = new ArrayList<String>();
            if (!CommonUtil.validateUrl(url, errorMsgs)) {
               CommandsUtils.printCmdFailure(
                     Constants.OUTPUT_OBJECT_APPMANAGER,
                     name,
                     Constants.OUTPUT_OP_ADD,
                     Constants.OUTPUT_OP_RESULT_FAIL,
                     "Invalid URL: " + CommonUtil.mergeErrorMsgList(errorMsgs) + ".");
               return;
            }
            appManagerAdd.setUrl(url);
         }

         if (changeAccount) {
            Map<String, String> loginInfo = getAccount();
            if (null == loginInfo) {
               return;
            }
            appManagerAdd.setUsername(loginInfo.get(Constants.LOGIN_USERNAME));
            appManagerAdd.setPassword(loginInfo.get(Constants.LOGIN_PASSWORD));
         } else {
            appManagerAdd.setUsername(appManagerRead.getUsername());
            appManagerAdd.setPassword(appManagerRead.getPassword());
         }

         if ((url != null && url.toLowerCase().startsWith("https"))
               || (url == null && changeCertificate && appManagerAdd
                     .getUrl().toLowerCase().startsWith("https"))) {
            // new URL starts with https or
            // changeCertificate for old URL starts with https (no new URL)
            String sslCertificate = getSslCertificate();
            if (null == sslCertificate) {
               CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_APPMANAGER,
                     name, Constants.OUTPUT_OP_MODIFY, Constants.OUTPUT_OP_RESULT_FAIL,
                     "Fail to get ssl certificate.");
               return;
            }
            appManagerAdd.setSslCertificate(sslCertificate);
         } else if (url == null && changeCertificate
               && !appManagerAdd.getUrl().toLowerCase().startsWith("https")) {
            // changeCertificate for old URL does not start with https (no new URL)
            CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_APPMANAGER,
                  name, Constants.OUTPUT_OP_MODIFY, Constants.OUTPUT_OP_RESULT_FAIL,
                  "Cannot set ssl certificate for http service.");
            return;
         } else if (url != null && !url.toLowerCase().startsWith("https")) {
            // new url does not start with https
            appManagerAdd.setSslCertificate(null);
         } else {
            // no new url or changeCertificate
            appManagerAdd.setSslCertificate(appManagerRead.getSslCertificate());
         }

         restClient.modify(appManagerAdd);
         CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_APPMANAGER,
               name, Constants.OUTPUT_OP_RESULT_MODIFY);
View Full Code Here

      ClusterCreate clusterCreate = new ClusterCreate();
      clusterCreate.setName(name);

      if (!CommandsUtils.isBlank(appManager)
            && !Constants.IRONFAN.equalsIgnoreCase(appManager)) {
         AppManagerRead appManagerRead = appManagerRestClient.get(appManager);
         if (appManagerRead == null) {
            CommandsUtils
                  .printCmdFailure(
                        Constants.OUTPUT_OBJECT_CLUSTER,
                        name,
View Full Code Here

   private AppManagerRead cmAmr;
   private AppManagerRead amAmr;

   @BeforeClass
   public void setUp() throws Exception {
      defaultAmr = new AppManagerRead();
      defaultAmr.setName(Constants.IRONFAN);
      cmAmr = new AppManagerRead();
      cmAmr.setName("cm");
      amAmr = new AppManagerRead();
      amAmr.setName("am");
   }
View Full Code Here

      softwareManagerCollector.loadSoftwareManagers();

      Mockito.when(appManagerService.getAppManagerRead(Matchers.anyString())).thenReturn(defaultAppManagerRead);

      AppManagerRead appManagerRead = softwareManagerCollector.getAppManagerRead(defaultAppManagerAdd.getName());

      Assert.assertEquals(defaultAppManagerRead.getName(), appManagerRead.getName());
      Assert.assertEquals(defaultAppManagerRead.getType(), appManagerRead.getType());
   }
View Full Code Here

   @Test(expectedExceptions = SoftwareManagerCollectorException.class,
   expectedExceptionsMessageRegExp = "Cannot find app manager Default.")
   public void testGetAppMgrRead_NotFound() {
      Mockito.when(appManagerService.getAppManagerRead(Matchers.anyString())).thenReturn(null);

      AppManagerRead appManagerRead = softwareManagerCollector.getAppManagerRead(defaultAppManagerAdd.getName());
   }
View Full Code Here

            result = appMgrEntity;
         }
      };

      appMgrSvc.setAppManagerDAO(appManagerDAO);
      AppManagerRead appMgrRead = appMgrSvc.getAppManagerRead("testAppMgr");

      Assert.notNull(appMgrRead);
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.apitypes.AppManagerRead

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.