diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/FGCPProviderMetadata.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/FGCPProviderMetadata.java index 5a1025ec6a..3b0241e33f 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/FGCPProviderMetadata.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/FGCPProviderMetadata.java @@ -25,8 +25,7 @@ import java.util.Properties; import org.jclouds.providers.internal.BaseProviderMetadata; /** - * Base implementation of {@link org.jclouds.providers.ProviderMetadata} for - * FGCP. + * Base implementation of {@link org.jclouds.providers.ProviderMetadata} for FGCP. * * @author Dies Koper */ @@ -46,10 +45,7 @@ public class FGCPProviderMetadata extends BaseProviderMetadata { public static Properties defaultProperties() { Properties properties = new Properties(); - - properties.setProperty(TEMPLATE, - "osFamily=CENTOS,osVersionMatches=6.2,os64Bit=true"); - + properties.setProperty(TEMPLATE, "osFamily=CENTOS,osVersionMatches=6.2,os64Bit=true"); return properties; } } diff --git a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToImage.java b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToImage.java index 8ea67fe8ba..ca6c063a99 100644 --- a/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToImage.java +++ b/labs/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/compute/functions/DiskImageToImage.java @@ -30,10 +30,8 @@ import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.domain.OsFamily; import org.jclouds.domain.LoginCredentials; import org.jclouds.fujitsu.fgcp.domain.DiskImage; -import org.jclouds.location.suppliers.all.RegionToProviderOrJustProvider; import com.google.common.base.Function; -import com.google.common.collect.Iterables; /** * Created by IntelliJ IDEA. @@ -44,15 +42,10 @@ import com.google.common.collect.Iterables; public class DiskImageToImage implements Function { private final DiskImageToOperatingSystem diskImageToOperatingSystem; - private final RegionToProviderOrJustProvider regionSupplier; @Inject - public DiskImageToImage( - DiskImageToOperatingSystem diskImageToOperatingSystem, - RegionToProviderOrJustProvider locationSupplier) { - this.diskImageToOperatingSystem = checkNotNull( - diskImageToOperatingSystem, "diskImageToOperatingSystem"); - this.regionSupplier = checkNotNull(locationSupplier, "locationProvider"); + public DiskImageToImage(DiskImageToOperatingSystem diskImageToOperatingSystem) { + this.diskImageToOperatingSystem = checkNotNull(diskImageToOperatingSystem, "diskImageToOperatingSystem"); } @Override @@ -64,17 +57,12 @@ public class DiskImageToImage implements Function { builder.ids(from.getId()); builder.name(from.getName()); builder.description(from.getDescription()); - builder.location(Iterables.getOnlyElement(regionSupplier.get())); // in fgcp, if the image is listed it is available builder.status(Status.AVAILABLE); - OperatingSystem os = diskImageToOperatingSystem.apply(from); builder.operatingSystem(os); - String user = os.getFamily() == OsFamily.WINDOWS ? "Administrator" - : "root"; - builder.defaultCredentials(LoginCredentials.builder().identity(user) - .noPassword().build()); - + String user = os.getFamily() == OsFamily.WINDOWS ? "Administrator" : "root"; + builder.defaultCredentials(LoginCredentials.builder().identity(user).noPassword().build()); return builder.build(); } } diff --git a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseTemplateBuilderLiveTest.java b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseTemplateBuilderLiveTest.java index dd8f664c2d..d3f7987641 100644 --- a/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseTemplateBuilderLiveTest.java +++ b/labs/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseTemplateBuilderLiveTest.java @@ -15,8 +15,7 @@ import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest; import com.google.common.base.Predicate; import com.google.common.base.Predicates; -public abstract class FGCPBaseTemplateBuilderLiveTest extends - BaseTemplateBuilderLiveTest { +public abstract class FGCPBaseTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { @Override protected Properties setupProperties() { @@ -27,16 +26,12 @@ public abstract class FGCPBaseTemplateBuilderLiveTest extends String[] parts = proxy.split("http://|:|@"); - overrides.setProperty(Constants.PROPERTY_PROXY_HOST, - parts[parts.length - 2]); - overrides.setProperty(Constants.PROPERTY_PROXY_PORT, - parts[parts.length - 1]); + overrides.setProperty(Constants.PROPERTY_PROXY_HOST, parts[parts.length - 2]); + overrides.setProperty(Constants.PROPERTY_PROXY_PORT, parts[parts.length - 1]); if (parts.length >= 4) { - overrides.setProperty(Constants.PROPERTY_PROXY_USER, - parts[parts.length - 4]); - overrides.setProperty(Constants.PROPERTY_PROXY_PASSWORD, - parts[parts.length - 3]); + overrides.setProperty(Constants.PROPERTY_PROXY_USER, parts[parts.length - 4]); + overrides.setProperty(Constants.PROPERTY_PROXY_PASSWORD, parts[parts.length - 3]); } } @@ -55,11 +50,11 @@ public abstract class FGCPBaseTemplateBuilderLiveTest extends public boolean apply(OsFamilyVersion64Bit input) { switch (input.family) { case CENTOS: - return input.version.matches("5.[46]") + return ("".equals(input.version) && input.is64Bit) || (input.version.matches("5.[46]") && input.is64Bit) || input.version.equals("6.[2]"); case WINDOWS: - return (input.version.equals("2008 R2 SE") || input.version - .equals("2008 R2 EE")) && input.is64Bit; + return ("".equals(input.version) && input.is64Bit) + || (input.version.equals("2008 R2 SE") || input.version.equals("2008 R2 EE")) && input.is64Bit; default: return false; } @@ -69,15 +64,11 @@ public abstract class FGCPBaseTemplateBuilderLiveTest extends } public void testDefaultTemplateBuilder() throws IOException { - Template defaultTemplate = view.getComputeService().templateBuilder() - .build(); - assert defaultTemplate.getImage().getOperatingSystem().getVersion() - .matches("6.2") : defaultTemplate.getImage() + Template defaultTemplate = view.getComputeService().templateBuilder().build(); + assert defaultTemplate.getImage().getOperatingSystem().getVersion().matches("6.2") : defaultTemplate.getImage() .getOperatingSystem().getVersion(); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), - true); - assertEquals(defaultTemplate.getImage().getOperatingSystem() - .getFamily(), OsFamily.CENTOS); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); }