Exemple #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());
  }
Exemple #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());
  }