コード例 #1
0
 @Override
 public void init() {
   testClassName = StratosAppServiceTest.class.getName();
   TenantDetails tenantDetails =
       TenantListCsvReader.getTenantDetails(TenantListCsvReader.getTenantId("4"));
   APPSERVER_STRATOS_URL =
       "http://"
           + FrameworkSettings.APP_SERVER_HOST_NAME
           + "/t/"
           + tenantDetails.getTenantDomain();
   HTTP_APPSERVER_STRATOSLIVE_URL =
       "http://"
           + FrameworkSettings.APP_SERVER_HOST_NAME
           + "/services/t/"
           + tenantDetails.getTenantDomain();
 }
コード例 #2
0
  public void productArtifactDeployment() {

    for (int i = 1; i <= productMap.size(); i++) {

      if (productMap.get(i).contains(ProductConstant.APP_SERVER_NAME)) {

        // get app server artifact location
        String artifactLocation =
            ProductConstant.getResourceLocations(ProductConstant.APP_SERVER_NAME);

        if (!carArtifactMap.getKey().contains(ProductConstant.APP_SERVER_NAME)) {
          for (Object carArtifactKey : carArtifactMap.getKey()) {
            String key = carArtifactKey.toString();
            if (key.contains(ProductConstant.APP_SERVER_NAME)) {
              String backendUrl = FrameworkSettings.APP_BACKEND_URL;
              for (Object carArtifactkey : carArtifactMap.getValues(key)) {
                String artifactName = getArtifactNameString(carArtifactkey.toString());
                int tenantId = getTenantId(key);
                TenantDetails tenantDetails = getTenantDetails(tenantId);
                try {
                  URL url =
                      new URL(
                          "file:///"
                              + artifactLocation
                              + File.separator
                              + "car"
                              + File.separator
                              + artifactName);
                  String sessionCookie =
                      login(
                          tenantDetails.getTenantName(),
                          tenantDetails.getTenantPassword(),
                          backendUrl);
                  carFileUploder(sessionCookie, backendUrl, url, artifactName);
                  log.info("car file: " + artifactName + " deployed successfully ");
                } catch (MalformedURLException e) {
                  log.error(
                      "MalformedURL exception thrown while initializing car artifact url"
                          + e.getMessage());
                  Assert.fail(
                      "MalformedURL exception thrown while initializing car artifact url"
                          + e.getMessage());
                }
              }
            }
          }
        }

        if (!warArtifactMap.getKey().contains(ProductConstant.APP_SERVER_NAME)) {
          for (Object warArtifactKey : warArtifactMap.getKey()) {
            String key = warArtifactKey.toString();
            if (key.contains(ProductConstant.APP_SERVER_NAME)) {
              String backendUrl = FrameworkSettings.APP_BACKEND_URL;
              for (Object warArtifactName : warArtifactMap.getValues(key)) {
                String artifactName = getArtifactNameString(warArtifactName.toString());
                String filePath =
                    artifactLocation + File.separator + "war" + File.separator + artifactName;
                int tenantId = getTenantId(key);
                TenantDetails tenantDetails = getTenantDetails(tenantId);
                String sessionCookie =
                    login(
                        tenantDetails.getTenantName(),
                        tenantDetails.getTenantPassword(),
                        backendUrl);
                warFileUploder(sessionCookie, backendUrl, filePath);
              }
            }
          }
        }

        if (!aarArtifactMap.getKey().contains(ProductConstant.APP_SERVER_NAME)) {
          for (Object aarArtifactKey : aarArtifactMap.getKey()) {
            String key = aarArtifactKey.toString();
            if (key.contains(ProductConstant.APP_SERVER_NAME)) {
              String backendUrl = FrameworkSettings.APP_BACKEND_URL;
              for (Object aarArtifactName : aarArtifactMap.getValues(key)) {
                String artifactName = getArtifactNameString(aarArtifactName.toString());
                String filePath =
                    artifactLocation + File.separator + "aar" + File.separator + artifactName;
                int tenantId = getTenantId(key);
                TenantDetails tenantDetails = getTenantDetails(tenantId);
                String sessionCookie =
                    login(
                        tenantDetails.getTenantName(),
                        tenantDetails.getTenantPassword(),
                        backendUrl);
                aarFileUploder(sessionCookie, backendUrl, artifactName, filePath);
              }
            }
          }
        }
      }

      if (productMap.get(i).contains(ProductConstant.ESB_SERVER_NAME)) {
        String artifactLocationESB =
            ProductConstant.getResourceLocations(ProductConstant.ESB_SERVER_NAME);
        if (!carArtifactMap.getKey().contains(ProductConstant.ESB_SERVER_NAME)) {
          for (Object carArtifactKeys : carArtifactMap.getKey()) {
            String key = carArtifactKeys.toString();
            if (key.contains(ProductConstant.ESB_SERVER_NAME)) {
              String backendUrl = FrameworkSettings.ESB_BACKEND_URL;
              for (Object carArtifactName : carArtifactMap.getValues(key)) {
                String artifactName = getArtifactNameString(carArtifactName.toString());
                int tenantId = getTenantId(key);
                TenantDetails tenantDetails = getTenantDetails(tenantId);
                try {
                  URL url =
                      new URL(
                          "file:///"
                              + artifactLocationESB
                              + File.separator
                              + "car"
                              + File.separator
                              + artifactName);
                  String sessionCookie =
                      login(
                          tenantDetails.getTenantName(),
                          tenantDetails.getTenantPassword(),
                          backendUrl);
                  carFileUploder(sessionCookie, backendUrl, url, artifactName);
                } catch (MalformedURLException e) {
                  log.error(
                      "MalformedURL exception thrown while initializing car artifact url"
                          + e.getMessage());
                  Assert.fail(
                      "MalformedURL exception thrown while initializing car artifact url"
                          + e.getMessage());
                }
              }
            }
          }
        }
      }
    }
  }