Пример #1
0
  @Test
  public void testCloudWithOverridesFile()
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException,
          DSLException {

    Cloud cloud = ServiceReader.readCloudFromDirectory(EC2_CLOUD_WITH_FILE_PATH);
    // overriden props
    Assert.assertEquals("OverridesTestUser", cloud.getUser().getUser());
    Assert.assertEquals("OverridesTestApiKey", cloud.getUser().getApiKey());
    Assert.assertEquals(
        "OverridesTestKeyPair",
        (String)
            cloud.getCloudCompute().getTemplates().get("SMALL_LINUX").getOptions().get("keyPair"));
    Assert.assertEquals(
        "OverridesTestImageId",
        cloud.getCloudCompute().getTemplates().get("SMALL_LINUX").getImageId());

    // not overrides, taken from .properties file
    Assert.assertEquals(
        "TestKeyFile.pem", cloud.getCloudCompute().getTemplates().get("SMALL_LINUX").getKeyFile());
  }
Пример #2
0
  @Test
  public void testCloudWithOverridesScript() throws DSLException, IOException {

    Cloud cloud =
        ServiceReader.readCloudFromDirectory(
            EC2_CLOUD_WITH_SCRIPT_PATH,
            FileUtils.readFileToString(new File(EC2_CLOUD_WITH_FILE_OVERRIDES_PATH)));
    // overriden props
    Assert.assertEquals("OverridesTestUser", cloud.getUser().getUser());
    Assert.assertEquals("OverridesTestApiKey", cloud.getUser().getApiKey());
    Assert.assertEquals(
        "OverridesTestKeyPair",
        (String)
            cloud.getCloudCompute().getTemplates().get("SMALL_LINUX").getOptions().get("keyPair"));
    Assert.assertEquals(
        "OverridesTestImageId",
        cloud.getCloudCompute().getTemplates().get("SMALL_LINUX").getImageId());

    // not overrides, taken from .properties file
    Assert.assertEquals(
        "TestKeyFile.pem", cloud.getCloudCompute().getTemplates().get("SMALL_LINUX").getKeyFile());
  }
  private MachineDetails[] startManagememntProcesses(
      final MachineDetails[] machines,
      final String securityProfile,
      final String keystorePassword,
      final long endTime)
      throws InterruptedException, TimeoutException, InstallerException, IOException {

    final AgentlessInstaller installer = new AgentlessInstaller();
    installer.addListener(new CliAgentlessInstallerListener(this.verbose));

    // Update the logging level of jsch used by the AgentlessInstaller
    Logger.getLogger(AgentlessInstaller.SSH_LOGGER_NAME)
        .setLevel(Level.parse(cloud.getProvider().getSshLoggingLevel()));

    final ComputeTemplate template =
        cloud
            .getCloudCompute()
            .getTemplates()
            .get(cloud.getConfiguration().getManagementMachineTemplate());

    // fixConfigRelativePaths(cloud, template);

    final int numOfManagementMachines = machines.length;

    final InstallationDetails[] installations =
        createInstallationDetails(
            numOfManagementMachines, machines, template, securityProfile, keystorePassword);
    // only one machine should try and deploy the WebUI and Rest Admin unless
    // noWebServices is true
    int i = isNoWebServices() ? 0 : 1;
    for (; i < installations.length; i++) {
      installations[i].setNoWebServices(true);
    }

    final String lookup = createLocatorsString(installations);
    for (final InstallationDetails detail : installations) {
      detail.setLocator(lookup);
    }

    // executes the agentless installer on all of the machines,
    // asynchronously
    installOnMachines(endTime, installer, numOfManagementMachines, installations);

    return machines;
  }