Issue 610: adjusted vcloud code to match greenhouse settings

This commit is contained in:
Adrian Cole 2011-07-01 16:22:38 -07:00
parent 75b336b83f
commit 6394370ddf
4 changed files with 14 additions and 26 deletions

View File

@ -36,7 +36,7 @@ public class GreenHouseDataElementVCloudPropertiesBuilder extends VCloudProperti
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ISO3166_CODES, "US-WY");
properties.setProperty(PROPERTY_ENDPOINT, "https://mycloud.greenhousedata.com/api");
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "orgNet-.*-Internal-Routed");
properties.setProperty(PROPERTY_VCLOUD_DEFAULT_NETWORK, "orgNet-.*-External");
return properties;
}

View File

@ -18,9 +18,10 @@
*/
package org.jclouds.greenhousedata.element.vcloud.config;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.vcloud.compute.config.VCloudComputeServiceContextModule;
import org.jclouds.vcloud.compute.options.VCloudTemplateOptions;
import org.jclouds.vcloud.domain.network.IpAddressAllocationMode;
import com.google.inject.Injector;
@ -31,9 +32,8 @@ import com.google.inject.Injector;
*/
public class GreenHouseDataElementVCloudComputeServiceContextModule extends VCloudComputeServiceContextModule {
//CentOS template matches Linux incorrectly
@Override
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
return template.osFamily(OsFamily.LINUX);
protected TemplateOptions provideTemplateOptions(Injector injector, TemplateOptions options) {
return options.as(VCloudTemplateOptions.class).ipAddressAllocationMode(IpAddressAllocationMode.POOL);
}
}

View File

@ -18,14 +18,9 @@
*/
package org.jclouds.greenhousedata.element.vcloud.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.predicates.OperatingSystemPredicates;
import org.jclouds.vcloud.compute.VCloudComputeServiceLiveTest;
import org.testng.annotations.Test;
@ -47,18 +42,6 @@ public class GreenHouseDataElementVCloudComputeServiceLiveTest extends VCloudCom
group = "director";
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assert OperatingSystemPredicates.supportsApt().apply(defaultTemplate.getImage().getOperatingSystem());
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (64-bit)");
assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation();
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
System.out.println(defaultTemplate.getHardware());
}
@Override
protected Template buildTemplate(TemplateBuilder templateBuilder) {
Template template = super.buildTemplate(templateBuilder);

View File

@ -50,7 +50,12 @@ public class GreenHouseDataElementVCloudTemplateBuilderLiveTest extends BaseTemp
@Override
public boolean apply(OsFamilyVersion64Bit input) {
return true;
switch (input.family) {
case UBUNTU:
return !input.version.equals("") || !input.is64Bit;
default:
return true;
}
}
};
@ -61,8 +66,8 @@ public class GreenHouseDataElementVCloudTemplateBuilderLiveTest extends BaseTemp
Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "");
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.LINUX);
assertEquals(getCores(defaultTemplate.getHardware()), 2.0d);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override