mirror of https://github.com/apache/jclouds.git
Issue 286: tweaks to the ecloud api
This commit is contained in:
parent
5413e12fcc
commit
bb98d3127f
|
@ -114,7 +114,6 @@ public class TerremarkVCloudComputeServiceContextModule extends VCloudComputeSer
|
|||
bind(PopulateDefaultLoginCredentialsForImageStrategy.class).to(
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials.class);
|
||||
bind(SecureRandom.class).toInstance(new SecureRandom());
|
||||
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
@ -39,7 +39,7 @@ public class ParseVAppTemplateDescriptionToGetDefaultLoginCredentials implements
|
|||
PopulateDefaultLoginCredentialsForImageStrategy {
|
||||
|
||||
public static final Pattern USER_PASSWORD_PATTERN = Pattern
|
||||
.compile(".*[Uu]sername: ([a-z]+) ?.*\n[Pp]assword: ([^ ]+) ?\n.*");
|
||||
.compile(".*[Uu]sername: ([a-z]+) ?.*\n[Pp]assword: ([^ \n\r]+) ?\r?\n.*");
|
||||
|
||||
@Override
|
||||
public Credentials execute(Object resourceToAuthenticate) {
|
||||
|
|
|
@ -46,6 +46,7 @@ public class TerremarkECloudComputeServiceLiveTest extends VCloudComputeServiceL
|
|||
@Override
|
||||
public void setServiceDefaults() {
|
||||
provider = "trmk-ecloud";
|
||||
tag = "trmke";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,9 +58,9 @@ public class TerremarkECloudComputeServiceLiveTest extends VCloudComputeServiceL
|
|||
@Test
|
||||
public void testTemplateBuilder() {
|
||||
Template defaultTemplate = client.templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(defaultTemplate.getLocation().getDescription(), "Miami Environment 1");
|
||||
assert defaultTemplate.getLocation().getDescription() != null;// different per org
|
||||
assertEquals(defaultTemplate.getSize().getCores(), 1.0d);
|
||||
}
|
||||
|
||||
|
@ -73,8 +74,8 @@ public class TerremarkECloudComputeServiceLiveTest extends VCloudComputeServiceL
|
|||
protected Template buildTemplate(TemplateBuilder templateBuilder) {
|
||||
Template template = super.buildTemplate(templateBuilder);
|
||||
Image image = template.getImage();
|
||||
assert image.getDefaultCredentials().identity != null : image;
|
||||
assert image.getDefaultCredentials().credential != null : image;
|
||||
assert image.getDefaultCredentials() != null && image.getDefaultCredentials().identity != null : image;
|
||||
assert image.getDefaultCredentials() != null && image.getDefaultCredentials().credential != null : image;
|
||||
return template;
|
||||
}
|
||||
|
||||
|
@ -91,9 +92,10 @@ public class TerremarkECloudComputeServiceLiveTest extends VCloudComputeServiceL
|
|||
assert image.getProviderId() != null : image;
|
||||
// image.getLocationId() can be null, if it is a location-free image
|
||||
assertEquals(image.getType(), ComputeType.IMAGE);
|
||||
assert image.getDefaultCredentials().identity != null : image;
|
||||
if (image.getOperatingSystem().getFamily() != OsFamily.WINDOWS)
|
||||
if (image.getOperatingSystem().getFamily() != OsFamily.WINDOWS) {
|
||||
assert image.getDefaultCredentials() != null && image.getDefaultCredentials().identity != null : image;
|
||||
assert image.getDefaultCredentials().credential != null : image;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,20 @@ public class PopulateDefaultLoginCredentialsForVAppTemplateTest {
|
|||
verify(template);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLamp() throws IOException {
|
||||
InputStream is = getClass().getResourceAsStream("/terremark/lamp_description.txt");
|
||||
String description = new String(ByteStreams.toByteArray(is));
|
||||
VAppTemplate template = createMock(VAppTemplate.class);
|
||||
expect(template.getDescription()).andReturn(description).atLeastOnce();
|
||||
replay(template);
|
||||
ParseVAppTemplateDescriptionToGetDefaultLoginCredentials converter = new ParseVAppTemplateDescriptionToGetDefaultLoginCredentials();
|
||||
Credentials creds = converter.execute(template);
|
||||
assertEquals(creds.identity, "ecloud");
|
||||
assertEquals(creds.credential, "$Ep455l0ud!2");
|
||||
verify(template);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFt() throws IOException {
|
||||
InputStream is = getClass().getResourceAsStream("/terremark/ft_description.txt");
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
NOTE: This template does not support automated OS configuration.
|
||||
|
||||
Username: ecloud
|
||||
Password: $Ep455l0ud!2
|
||||
|
||||
mySQL root password is the same as ecloud.
|
||||
|
||||
This template contains a base install of Ubuntu Server 8.04 + LAMP.
|
Loading…
Reference in New Issue