JCLOUDS-517: New ElasticHosts images and regions

Added the new ElasticHosts regions.

Updated the ElasticStack api to get the list of standard
drives using an API call. All providers except ServerLove
support the new API call, so the old logic in the ElasticStack
api has been moved to that provider. The rest of providers will now
extract all the OperatingSystem information by parsing the name of the
StandardDrive.

A unit test has been added to the ElasticStack api with all the images
that were hardcoded, to make sure all names are still parsed as expected
and all information in the existing providers is kept.

Modified the default template for all ElasticHosts providers to
match newer Ubuntu images and updated the Template*Live tests
accordingly.

Also refactored the WellKnownImage map to a supplier to lazy load it
when needed and avoid unexpected errors when building the Guice injector
if there are authentication errors or similar.
This commit is contained in:
Ignasi Barrera 2014-03-25 15:00:07 +01:00
parent da8517f295
commit a7e342422c
83 changed files with 3327 additions and 722 deletions

View File

@ -78,6 +78,18 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>mockwebserver</artifactId>
<scope>test</scope>
<exclusions>
<!-- Already provided by jclouds-sshj -->
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<profiles>
<profile>

View File

@ -38,10 +38,12 @@ import org.jclouds.elasticstack.domain.DriveInfo;
import org.jclouds.elasticstack.domain.ImageConversionType;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.functions.KeyValuesDelimitedByBlankLinesToDriveInfo;
import org.jclouds.elasticstack.functions.KeyValuesDelimitedByBlankLinesToServerInfo;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSet;
import org.jclouds.elasticstack.functions.ReturnPayload;
import org.jclouds.elasticstack.functions.SplitNewlines;
import org.jclouds.http.filters.BasicAuthentication;
@ -201,6 +203,26 @@ public interface ElasticStackApi extends Closeable {
@Path("/drives/info")
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToDriveInfoSet.class)
Set<DriveInfo> listDriveInfo();
/**
* Lists standard drive UUIDs in your account
*
* @return or empty set if no standard drives are found
*/
@GET
@Path("/drives/list/standard")
@ResponseParser(SplitNewlines.class)
Set<String> listStandardDrives();
/**
* Gets information about all standard drives
*
* @return or empty set if no standard drives are found
*/
@GET
@Path("/drives/info/standard")
@ResponseParser(ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSet.class)
Set<StandardDrive> listStandardDriveInfo();
/**
* @param uuid

View File

@ -62,7 +62,6 @@ public class ElasticStackApiMetadata extends BaseHttpApiMetadata<ElasticStackApi
public static class Builder extends BaseHttpApiMetadata.Builder<ElasticStackApi, Builder> {
@SuppressWarnings("deprecation")
protected Builder() {
id("elasticstack")
.name("ElasticStack API")

View File

@ -32,6 +32,7 @@ import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.Constants;
import org.jclouds.collect.Memoized;
import org.jclouds.compute.ComputeServiceAdapter;
import org.jclouds.compute.domain.Hardware;
import org.jclouds.compute.domain.HardwareBuilder;
@ -57,6 +58,7 @@ import org.jclouds.logging.Logger;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Supplier;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.FluentIterable;
@ -70,7 +72,7 @@ import com.google.common.util.concurrent.UncheckedExecutionException;
/**
* defines the connection between the {@link org.jclouds.elasticstack.ElasticStackApi} implementation
* and the jclouds {@link ComputeService}
* and the jclouds {@link org.jclouds.compute.ComputeService}
*
*/
@Singleton
@ -78,7 +80,7 @@ public class ElasticStackComputeServiceAdapter implements
ComputeServiceAdapter<ServerInfo, Hardware, DriveInfo, Location> {
private final ElasticStackApi client;
private final Predicate<DriveInfo> driveNotClaimed;
private final Map<String, WellKnownImage> preinstalledImages;
private final Supplier<Map<String, WellKnownImage>> preinstalledImages;
private final LoadingCache<String, DriveInfo> cache;
private final String defaultVncPassword;
private final ListeningExecutorService userExecutor;
@ -89,7 +91,7 @@ public class ElasticStackComputeServiceAdapter implements
@Inject
public ElasticStackComputeServiceAdapter(ElasticStackApi client, Predicate<DriveInfo> driveNotClaimed,
Map<String, WellKnownImage> preinstalledImages, LoadingCache<String, DriveInfo> cache,
@Memoized Supplier<Map<String, WellKnownImage>> preinstalledImages, LoadingCache<String, DriveInfo> cache,
@Named(ElasticStackConstants.PROPERTY_VNC_PASSWORD) String defaultVncPassword,
@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor) {
this.client = checkNotNull(client, "client");
@ -108,16 +110,22 @@ public class ElasticStackComputeServiceAdapter implements
logger.debug(">> creating boot drive bytes(%d)", bootSize);
DriveInfo drive = client
.createDrive(new Drive.Builder().name(template.getImage().getId()).size(bootSize).build());
logger.debug("<< drive(%s)", drive.getUuid());
logger.debug("<< drive (%s)", drive);
boolean success = driveNotClaimed.apply(drive);
if (!success) {
client.destroyDrive(drive.getUuid());
throw new IllegalStateException(String.format("could not create drive %s in time!", drive));
}
logger.debug(">> imaging boot drive source(%s)", template.getImage().getId());
client.imageDrive(template.getImage().getId(), drive.getUuid(), ImageConversionType.GUNZIP);
boolean success = driveNotClaimed.apply(drive);
logger.debug("<< imaged (%s)", success);
if (!success) {
boolean ready = driveNotClaimed.apply(drive);
if (!ready) {
client.destroyDrive(drive.getUuid());
throw new IllegalStateException("could not image drive in time!");
throw new IllegalStateException(String.format("could not image drive %s in time!", drive));
}
logger.debug("<< imaged (%s)", drive);
template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, tag);
@ -126,6 +134,7 @@ public class ElasticStackComputeServiceAdapter implements
.tags(template.getOptions().getTags()).userMetadata(template.getOptions().getUserMetadata()).build();
ServerInfo from = client.createServer(toCreate);
client.startServer(from.getUuid());
from = client.getServerInfo(from.getUuid());
return new NodeAndInitialCredentials<ServerInfo>(from, from.getUuid(), LoginCredentials.builder()
@ -164,7 +173,7 @@ public class ElasticStackComputeServiceAdapter implements
*/
@Override
public Iterable<DriveInfo> listImages() {
return FluentIterable.from(transformParallel(preinstalledImages.keySet(),
return FluentIterable.from(transformParallel(preinstalledImages.get().keySet(),
new Function<String, ListenableFuture<? extends DriveInfo>>() {
@Override
@ -187,7 +196,6 @@ public class ElasticStackComputeServiceAdapter implements
}, userExecutor, null, logger, "drives")).filter(notNull());
}
@SuppressWarnings("unchecked")
@Override
public Iterable<ServerInfo> listNodes() {
return (Iterable<ServerInfo>) client.listServerInfo();

View File

@ -16,16 +16,22 @@
*/
package org.jclouds.elasticstack.compute.config;
import static com.google.common.base.Suppliers.memoizeWithExpiration;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import static org.jclouds.util.Predicates2.retry;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.collect.Memoized;
import org.jclouds.compute.ComputeServiceAdapter;
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
import org.jclouds.compute.domain.Hardware;
@ -39,21 +45,24 @@ import org.jclouds.elasticstack.compute.ElasticStackComputeServiceAdapter;
import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata;
import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata.DeviceToVolume;
import org.jclouds.elasticstack.compute.functions.ServerInfoToNodeMetadata.GetImageIdFromServer;
import org.jclouds.elasticstack.compute.functions.StandardDriveToWellKnownImage;
import org.jclouds.elasticstack.compute.functions.WellKnownImageToImage;
import org.jclouds.elasticstack.domain.Device;
import org.jclouds.elasticstack.domain.DriveInfo;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.domain.WellKnownImage;
import org.jclouds.elasticstack.predicates.DriveClaimed;
import org.jclouds.elasticstack.suppliers.WellKnownImageSupplier;
import org.jclouds.functions.IdentityFunction;
import org.jclouds.json.Json;
import org.jclouds.location.Provider;
import org.jclouds.util.Strings2;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Supplier;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@ -66,7 +75,7 @@ import com.google.inject.TypeLiteral;
* @author Adrian Cole
*/
public class ElasticStackComputeServiceContextModule extends
ComputeServiceAdapterContextModule<ServerInfo, Hardware, DriveInfo, Location> {
ComputeServiceAdapterContextModule<ServerInfo, Hardware, DriveInfo, Location> {
@SuppressWarnings("unchecked")
@Override
@ -88,8 +97,12 @@ public class ElasticStackComputeServiceContextModule extends
}).to(GetImageIdFromServer.class);
bind(new TypeLiteral<Function<DriveInfo, Image>>() {
}).to(WellKnownImageToImage.class);
bind(new TypeLiteral<Function<StandardDrive, WellKnownImage>>() {
}).to(StandardDriveToWellKnownImage.class);
bind(new TypeLiteral<Supplier<List<WellKnownImage>>>() {
}).to(WellKnownImageSupplier.class);
}
@Provides
@Singleton
protected LoadingCache<String, DriveInfo> cache(GetDrive getDrive) {
@ -113,18 +126,33 @@ public class ElasticStackComputeServiceContextModule extends
@Singleton
@Provides
protected Map<String, WellKnownImage> provideImages(Json json, @Provider String providerName) throws IOException {
List<WellKnownImage> wellKnowns = json.fromJson(Strings2.toStringAndClose(getClass().getResourceAsStream(
"/" + providerName + "/preinstalled_images.json")), new TypeLiteral<List<WellKnownImage>>() {
}.getType());
return Maps.uniqueIndex(wellKnowns, new Function<WellKnownImage, String>() {
@Memoized
protected Supplier<Map<String, WellKnownImage>> provideImages(@Named(PROPERTY_SESSION_INTERVAL) long seconds,
@Memoized final Supplier<List<WellKnownImage>> wellKnownImageSupplier) throws IOException {
// The image map won't change. Memoize it during the session.
// This map can't be created directly as a singleton, as Guice needs it to construct the ElasticStackComputeServiceAdapter
// and a misconfiguration such as invalid credentials, etc would cause the Guice injection to fail
return memoizeWithExpiration(new Supplier<Map<String, WellKnownImage>>() {
@Override
public String apply(WellKnownImage input) {
return input.getUuid();
public Map<String, WellKnownImage> get() {
return Maps.uniqueIndex(wellKnownImageSupplier.get(), new Function<WellKnownImage, String>() {
@Override
public String apply(WellKnownImage input) {
return input.getUuid();
}
});
}
});
}, seconds, TimeUnit.SECONDS);
}
@Singleton
@Provides
@Memoized
protected Supplier<List<WellKnownImage>> provideWellKnownImageSupplier(AtomicReference<AuthorizationException> authException,
@Named(PROPERTY_SESSION_INTERVAL) long seconds, WellKnownImageSupplier uncached)
throws IOException {
return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, uncached, seconds,
TimeUnit.SECONDS);
}
@Provides

View File

@ -0,0 +1,131 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.compute.functions;
import static com.google.common.collect.Iterables.tryFind;
import static java.util.Arrays.asList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import javax.inject.Named;
import javax.inject.Singleton;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.domain.WellKnownImage;
import org.jclouds.logging.Logger;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
/**
* Transforms a standard drive into an image that can be used to create nodes.
*
* @author Ignasi Barrera
*/
@Singleton
public class StandardDriveToWellKnownImage implements Function<StandardDrive, WellKnownImage> {
/*
* Expression to finds the version in a text string in a Unix OS:
* CentOS 6 => 6
* CentOS Linux 6.5 =>
* Debian Linux 7.4 (Wheezy) => 7.4
* Ubuntu Linux 12.04.1 LTS (Precise Pangolin) => 12.04.1
*/
private static final Pattern UNIX_VERSION_PATTERN = Pattern.compile("[^\\d]*(\\d+(?:\\.\\d+)*).*");
/*
* Expression to finds the version in a text string in a Windows OS:
* Windows Server 2012 => 2012
* Windows Standard 2008 R2 => 2008 R2
* Windows Standard 2008 R2 + SQL => 2008 R2 + SQL
*/
private static final Pattern WINDOWS_VERSION_PATTERN = Pattern.compile("[^\\d]*(\\d+.*)");
@Resource
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
protected Logger logger = Logger.NULL;
@Override
public WellKnownImage apply(StandardDrive input) {
WellKnownImage.Builder builder = WellKnownImage.builder();
builder.uuid(input.getUuid());
builder.size(toGb(input.getSize()));
builder.description(input.getName());
OsFamily family = extractOsFamily(input.getName());
String version = extractOsVersion(family, input.getName());
builder.osFamily(family);
builder.osVersion(version);
builder.is64bit(is64bit(input.getName()));
return builder.build();
}
private static boolean is64bit(String name) {
return !name.contains("32bit");
}
private OsFamily extractOsFamily(final String name) {
final String lowerCaseName = name.toLowerCase();
Optional<OsFamily> family = tryFind(asList(OsFamily.values()), new Predicate<OsFamily>() {
@Override
public boolean apply(OsFamily input) {
return lowerCaseName.startsWith(input.name().toLowerCase());
}
});
if (family.isPresent()) {
logger.warn("could not find the operating system family for image: %s", name);
}
return family.or(OsFamily.UNRECOGNIZED);
}
private String extractOsVersion(OsFamily family, String name) {
String version = null;
if (family == OsFamily.WINDOWS) {
// TODO: Find a way to restrict better the windows version
Matcher matcher = WINDOWS_VERSION_PATTERN.matcher(name);
if (matcher.matches()) {
version = matcher.group(1);
}
} else {
Matcher matcher = UNIX_VERSION_PATTERN.matcher(name);
if (matcher.matches()) {
version = matcher.group(1);
}
}
if (version == null) {
logger.warn("could not find the operating system version for image: %s", name);
}
return version;
}
private static int toGb(long sizeInBytes) {
return (int) (sizeInBytes / (1024 * 1024 * 1024));
}
}

View File

@ -16,15 +16,18 @@
*/
package org.jclouds.elasticstack.compute.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.collect.Memoized;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.Image.Status;
import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.compute.domain.Image.Status;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location;
import org.jclouds.domain.LoginCredentials;
@ -41,19 +44,20 @@ import com.google.common.collect.ImmutableMap;
@Singleton
public class WellKnownImageToImage implements Function<DriveInfo, Image> {
private final Supplier<Location> locationSupplier;
private final Map<String, WellKnownImage> preinstalledImages;
private final Supplier<Map<String, WellKnownImage>> preinstalledImages;
private final Map<String, Credentials> credentialStore;
@Inject
public WellKnownImageToImage(Supplier<Location> locationSupplier, Map<String, WellKnownImage> preinstalledImages, Map<String, Credentials> credentialStore) {
this.locationSupplier = locationSupplier;
this.preinstalledImages = preinstalledImages;
this.credentialStore = credentialStore;
public WellKnownImageToImage(Supplier<Location> locationSupplier,
@Memoized Supplier<Map<String, WellKnownImage>> preinstalledImages, Map<String, Credentials> credentialStore) {
this.locationSupplier = checkNotNull(locationSupplier, "locationSupplier cannot be null");
this.preinstalledImages = checkNotNull(preinstalledImages, "preinstalledImages cannot be null");
this.credentialStore = checkNotNull(credentialStore, "credentialStore cannot be null");
}
@Override
public Image apply(DriveInfo drive) {
WellKnownImage input = preinstalledImages.get(drive.getUuid());
WellKnownImage input = preinstalledImages.get().get(drive.getUuid());
// set credentials in the store here, as opposed to directly modifying the image. we need to
// set credentials on the image outside of this function so that they can be for example
// overridden by properties

View File

@ -0,0 +1,185 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.domain;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import org.jclouds.javax.annotation.Nullable;
/**
* @author Ignasi Barrera
*/
public class StandardDrive extends Drive {
public static class Builder extends Drive.Builder {
protected ImageConversionType format;
protected MediaType media;
protected long rawSize;
public Builder format(ImageConversionType format) {
this.format = format;
return this;
}
public Builder media(MediaType media) {
this.media = media;
return this;
}
public Builder rawSize(long rawSize) {
this.rawSize = rawSize;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public Builder claimType(ClaimType claimType) {
return Builder.class.cast(super.claimType(claimType));
}
/**
* {@inheritDoc}
*/
@Override
public Builder readers(Iterable<String> readers) {
return Builder.class.cast(super.readers(readers));
}
/**
* {@inheritDoc}
*/
@Override
public Builder size(long size) {
return Builder.class.cast(super.size(size));
}
/**
* {@inheritDoc}
*/
@Override
public Builder uuid(String uuid) {
return Builder.class.cast(super.uuid(uuid));
}
/**
* {@inheritDoc}
*/
@Override
public Builder name(String name) {
return Builder.class.cast(super.name(name));
}
/**
* {@inheritDoc}
*/
@Override
public Builder tags(Iterable<String> tags) {
return Builder.class.cast(super.tags(tags));
}
/**
* {@inheritDoc}
*/
@Override
public Builder userMetadata(Map<String, String> userMetadata) {
return Builder.class.cast(super.userMetadata(userMetadata));
}
public static Builder fromDriveInfo(StandardDrive driveInfo) {
return new Builder().uuid(driveInfo.getUuid()).name(driveInfo.getName()).size(driveInfo.getSize())
.claimType(driveInfo.getClaimType()).readers(driveInfo.getReaders()).tags(driveInfo.getTags())
.userMetadata(driveInfo.getUserMetadata()).media(driveInfo.getMedia());
}
/**
* {@inheritDoc}
*/
@Override
public StandardDrive build() {
return new StandardDrive(uuid, name, size, claimType, readers, tags, userMetadata, format, media, rawSize);
}
}
protected final ImageConversionType format;
protected final MediaType media;
protected final long rawSize;
public StandardDrive(String uuid, String name, long size, ClaimType claimType, Iterable<String> readers,
Iterable<String> tags, Map<String, String> userMetadata, @Nullable ImageConversionType format,
MediaType media, long rawSize) {
super(uuid, name, size, claimType, readers, tags, userMetadata);
this.format = format;
this.media = checkNotNull(media, "media");
this.rawSize = rawSize;
}
public MediaType getMedia() {
return media;
}
public ImageConversionType getFormat() {
return format;
}
public long getRawSize() {
return rawSize;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((format == null) ? 0 : format.hashCode());
result = prime * result + ((media == null) ? 0 : media.hashCode());
result = prime * result + (int) (rawSize ^ (rawSize >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
StandardDrive other = (StandardDrive) obj;
if (format != other.format)
return false;
if (media == null) {
if (other.media != null)
return false;
} else if (!media.equals(other.media))
return false;
if (rawSize != other.rawSize)
return false;
return true;
}
@Override
public String toString() {
return "StandardDrive [format=" + format + ", media=" + media + ", rawSize=" + rawSize + ", size=" + size
+ ", claimType=" + claimType + ", readers=" + readers + ", uuid=" + uuid + ", name=" + name + ", tags="
+ tags + ", userMetadata=" + userMetadata + "]";
}
}

View File

@ -16,7 +16,11 @@
*/
package org.jclouds.elasticstack.domain;
import static com.google.common.base.Objects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects;
@ -25,20 +29,80 @@ import com.google.common.base.Objects;
* @author Adrian Cole
*/
public class WellKnownImage {
private String loginUser = "toor";
private String uuid;
private String description;
private OsFamily osFamily;
private String osVersion;
private int size;
private boolean is64bit = true;
// intended only for serialization
WellKnownImage() {
public static Builder builder() {
return new Builder();
}
// performance isn't a concern on a infrequent object like this, so using shortcuts;
public static class Builder {
private String loginUser;
private String uuid;
private String description;
private OsFamily osFamily;
private String osVersion;
private int size;
private boolean is64bit;
public Builder loginUser(String loginUser) {
this.loginUser = loginUser;
return this;
}
public Builder uuid(String uuid) {
this.uuid = uuid;
return this;
}
public Builder description(String description) {
this.description = description;
return this;
}
public Builder osFamily(OsFamily osFamily) {
this.osFamily = osFamily;
return this;
}
public Builder osVersion(String osVersion) {
this.osVersion = osVersion;
return this;
}
public Builder size(int size) {
this.size = size;
return this;
}
public Builder is64bit(boolean is64bit) {
this.is64bit = is64bit;
return this;
}
public WellKnownImage build() {
return new WellKnownImage(loginUser, uuid, description, osFamily, osVersion, size, is64bit);
}
}
public static final String DEFAULT_USER = "toor";
private final String loginUser;
private final String uuid;
private final String description;
private final OsFamily osFamily;
private final String osVersion;
private final int size;
private final boolean is64bit;
public WellKnownImage(@Nullable String loginUser, String uuid, String description, OsFamily osFamily,
@Nullable String osVersion, int size, @Nullable Boolean is64bit) {
this.loginUser = firstNonNull(loginUser, DEFAULT_USER);
this.uuid = checkNotNull(uuid, "uuid cannot be null");
this.description = checkNotNull(description, "description cannot be null");
this.osFamily = checkNotNull(osFamily, "osFamily cannot be null");
this.osVersion = osVersion;
this.size = size;
this.is64bit = firstNonNull(is64bit, Boolean.TRUE);
}
public String getUuid() {
return uuid;
@ -82,9 +146,9 @@ public class WellKnownImage {
@Override
public String toString() {
return Objects.toStringHelper(this).add("uuid", uuid).add("description", description).add("osFamily", osFamily)
.add("osVersion", osVersion).add("size", size).add("is64bit", is64bit).add("loginUser", loginUser)
.toString();
return Objects.toStringHelper(this).omitNullValues().add("uuid", uuid).add("description", description)
.add("osFamily", osFamily).add("osVersion", osVersion).add("size", size).add("is64bit", is64bit)
.add("loginUser", loginUser).toString();
}
}

View File

@ -0,0 +1,60 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.functions;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.nullToEmpty;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.functions.ReturnStringIf2xx;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
/**
* @author Ignasi Barrera
*/
@Singleton
public class ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSet implements Function<HttpResponse, Set<StandardDrive>> {
private final ReturnStringIf2xx returnStringIf2xx;
private final ListOfKeyValuesDelimitedByBlankLinesToListOfMaps mapConverter;
private final MapToStandardDrive mapToStandardDrive;
@Inject
ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSet(ReturnStringIf2xx returnStringIf2xx,
ListOfKeyValuesDelimitedByBlankLinesToListOfMaps mapConverter, MapToStandardDrive mapToStandardDrive) {
this.returnStringIf2xx = checkNotNull(returnStringIf2xx, "returnStringIf2xx");
this.mapConverter = checkNotNull(mapConverter, "mapConverter");
this.mapToStandardDrive = checkNotNull(mapToStandardDrive, "mapToStandardDrive");
}
@Override
public Set<StandardDrive> apply(HttpResponse response) {
String text = nullToEmpty(returnStringIf2xx.apply(response));
if (text.trim().equals("")) {
return ImmutableSet.<StandardDrive> of();
}
return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToStandardDrive));
}
}

View File

@ -73,7 +73,7 @@ public class MapToDriveInfo implements Function<Map<String, String>, DriveInfo>
try {
return builder.build();
} catch (NullPointerException e) {
logger.trace("entry missing data: %s; %s", e.getMessage(), from);
logger.warn("entry missing data: %s; %s", e.getMessage(), from);
return null;
}
}

View File

@ -0,0 +1,78 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.functions;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Resource;
import javax.inject.Singleton;
import org.jclouds.elasticstack.domain.ClaimType;
import org.jclouds.elasticstack.domain.ImageConversionType;
import org.jclouds.elasticstack.domain.MediaType;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.logging.Logger;
import com.google.common.base.Function;
import com.google.common.base.Splitter;
import com.google.common.collect.Maps;
/**
* @author Ignasi Barrera
*/
@Singleton
public class MapToStandardDrive implements Function<Map<String, String>, StandardDrive> {
@Resource
protected Logger logger = Logger.NULL;
@Override
public StandardDrive apply(Map<String, String> from) {
if (from.isEmpty())
return null;
StandardDrive.Builder builder = new StandardDrive.Builder();
builder.name(from.get("name"));
builder.media(MediaType.fromValue(from.get("media")));
if (from.containsKey("tags"))
builder.tags(Splitter.on(' ').split(from.get("tags")));
builder.uuid(from.get("drive"));
if (from.containsKey("claim:type"))
builder.claimType(ClaimType.fromValue(from.get("claim:type")));
if (from.containsKey("readers"))
builder.readers(Splitter.on(' ').split(from.get("readers")));
if (from.containsKey("size"))
builder.size(Long.valueOf(from.get("size")));
if (from.containsKey("rawsize"))
builder.rawSize(Long.valueOf(from.get("rawsize")));
if (from.containsKey("format"))
builder.format(ImageConversionType.fromValue(from.get("format")));
Map<String, String> metadata = Maps.newLinkedHashMap();
for (Entry<String, String> entry : from.entrySet()) {
String key = entry.getKey();
if (key.startsWith("user:"))
metadata.put(key.substring(key.indexOf(':') + 1), entry.getValue());
}
builder.userMetadata(metadata);
try {
return builder.build();
} catch (NullPointerException e) {
logger.warn("entry missing data: %s; %s", e.getMessage(), from);
return null;
}
}
}

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.elasticstack.functions;
import static com.google.common.collect.Sets.newTreeSet;
import java.util.Set;
import javax.inject.Inject;
@ -28,6 +26,7 @@ import org.jclouds.http.functions.ReturnStringIf2xx;
import com.google.common.base.Function;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
/**
*
@ -44,6 +43,8 @@ public class SplitNewlines implements Function<HttpResponse, Set<String>> {
@Override
public Set<String> apply(HttpResponse response) {
return newTreeSet(Splitter.on('\n').omitEmptyStrings().split(returnStringIf200.apply(response)));
String payload = returnStringIf200.apply(response);
return payload == null ? ImmutableSet.<String> of() : ImmutableSet.copyOf(Splitter.on('\n').omitEmptyStrings()
.split(payload));
}
}

View File

@ -16,6 +16,8 @@
*/
package org.jclouds.elasticstack.handlers;
import static org.jclouds.http.HttpUtils.releasePayload;
import java.io.IOException;
import javax.annotation.Resource;
@ -28,10 +30,9 @@ import org.jclouds.http.HttpResponseException;
import org.jclouds.logging.Logger;
import org.jclouds.rest.AuthorizationException;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.util.Closeables2;
import org.jclouds.util.Strings2;
import com.google.common.base.Throwables;
import com.google.common.io.Closeables;
/**
* This will parse and set an appropriate exception on the command object.
@ -80,7 +81,11 @@ public class ElasticStackErrorHandler implements HttpErrorHandler {
break;
}
} finally {
Closeables2.closeQuietly(response.getPayload());
try {
Closeables.close(response.getPayload(), true);
} catch (IOException e) {
// Unreachable code
}
command.setException(exception);
}
}
@ -93,11 +98,7 @@ public class ElasticStackErrorHandler implements HttpErrorHandler {
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
try {
response.getPayload().getInput().close();
} catch (IOException e) {
Throwables.propagate(e);
}
releasePayload(response);
}
}
}

View File

@ -0,0 +1,64 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.suppliers;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.elasticstack.ElasticStackApi;
import org.jclouds.elasticstack.domain.MediaType;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.domain.WellKnownImage;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
/**
* Supplies the pre-installed images.
*
* @author Ignasi Barrera
*
*/
@Singleton
public class StandardDiskImageSupplier implements WellKnownImageSupplier {
private final ElasticStackApi api;
private final Function<StandardDrive, WellKnownImage> standardDriveToWellKnownImage;
@Inject
StandardDiskImageSupplier(ElasticStackApi api, Function<StandardDrive, WellKnownImage> standardDriveToWellKnownImage) {
this.api = checkNotNull(api, "api");
this.standardDriveToWellKnownImage = checkNotNull(standardDriveToWellKnownImage, "standardDriveToWellKnownImage");
}
@Override
public List<WellKnownImage> get() {
ImmutableList.Builder<WellKnownImage> images = ImmutableList.builder();
for (StandardDrive drive : api.listStandardDriveInfo()) {
if (drive.getMedia() == MediaType.DISK) {
images.add(standardDriveToWellKnownImage.apply(drive));
}
}
return images.build();
}
}

View File

@ -0,0 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.suppliers;
import java.util.List;
import org.jclouds.elasticstack.domain.WellKnownImage;
import com.google.common.base.Supplier;
import com.google.inject.ImplementedBy;
/**
* Supplies the well known images
*
* @author Ignasi Barrera
*
*/
@ImplementedBy(StandardDiskImageSupplier.class)
public interface WellKnownImageSupplier extends Supplier<List<WellKnownImage>> {
}

View File

@ -1,72 +0,0 @@
[
{
"uuid": "38df0986-4d85-4b76-b502-3878ffc80161",
"description": "CentOS Linux 5.5",
"osFamily": "CENTOS",
"osVersion": "5.5",
"size": "3"
},
{
"uuid": "980cf63c-f21e-4382-997b-6541d5809629",
"description": "Debian Linux 5.0",
"osFamily": "DEBIAN",
"osVersion": "5.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "bf1d943e-2a55-46bb-a8c7-6099e44a3dde",
"description": "Ubuntu Linux 8.10: Base system with X",
"osFamily": "UBUNTU",
"osVersion": "8.10",
"size": "3"
},
{
"uuid": "757586d5-f1e9-4d9c-b215-5a391c9a24bf",
"description": "Ubuntu Linux 9.04: Base system with X",
"osFamily": "UBUNTU",
"osVersion": "9.04",
"size": "3"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "10a88d1c-6575-46e3-8d2c-7744065ea530",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -1,7 +0,0 @@
the images collection listed in the computeservice api is populated from preinstalled_images.json in a resource path corresponding to the provider name. There's no way to list standard images via api in cloudstack installs. This is the process:
1. log into the portal
2. View Source
3. look for the image you want ex 'Debian Linux 6.0.1'
4. find the UUID, which will look like: 6aa953cc-3395-4e8d-938e-65c74fd20334
Other details can be found by contacting the provider and asking them

View File

@ -18,6 +18,7 @@ package org.jclouds.elasticstack;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.jclouds.util.Predicates2.retry;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull;
import java.io.IOException;
@ -38,6 +39,7 @@ import org.jclouds.elasticstack.domain.Model;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.elasticstack.domain.ServerStatus;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.predicates.DriveClaimed;
import org.jclouds.elasticstack.util.Servers;
import org.jclouds.io.Payloads;
@ -114,12 +116,26 @@ public class ElasticStackApiLiveTest extends BaseComputeServiceContextLiveTest {
Set<String> drives = client.listDrives();
assertNotNull(drives);
}
@Test
public void testListStandardDrives() throws Exception {
Set<String> drives = client.listStandardDrives();
assertNotNull(drives);
assertFalse(drives.isEmpty(), "standard drive list should not be empty");
}
@Test
public void testListDriveInfo() throws Exception {
Set<? extends DriveInfo> drives = client.listDriveInfo();
assertNotNull(drives);
}
@Test
public void testListStandardDriveInfo() throws Exception {
Set<? extends StandardDrive> drives = client.listStandardDriveInfo();
assertNotNull(drives);
assertFalse(drives.isEmpty(), "standard drive list should not be empty");
}
@Test
public void testGetDrive() throws Exception {

View File

@ -38,6 +38,8 @@ import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesTo
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToServerInfoSet;
import org.jclouds.elasticstack.functions.ReturnPayload;
import org.jclouds.elasticstack.functions.SplitNewlines;
import org.jclouds.elasticstack.suppliers.MockStandardDiskImageSupplier;
import org.jclouds.elasticstack.suppliers.WellKnownImageSupplier;
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.filters.BasicAuthentication;
@ -51,6 +53,9 @@ import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.reflect.Invokable;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Scopes;
/**
* Tests behavior of {@code ElasticStackApi}
*
@ -448,4 +453,14 @@ public class ElasticStackApiTest extends BaseAsyncClientTest<ElasticStackApi> {
return new ElasticStackApiMetadata();
}
@Override
protected Module createModule() {
return new AbstractModule() {
@Override
protected void configure() {
bind(WellKnownImageSupplier.class).to(MockStandardDiskImageSupplier.class).in(Scopes.SINGLETON);
}
};
}
}

View File

@ -0,0 +1,110 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack;
import static org.jclouds.Constants.PROPERTY_CREDENTIAL;
import static org.jclouds.Constants.PROPERTY_IDENTITY;
import static org.jclouds.util.Strings2.toStringAndClose;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;
import javax.ws.rs.core.HttpHeaders;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.http.BaseMockWebServerTest;
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
import org.testng.annotations.Test;
import com.google.common.base.Charsets;
import com.google.common.base.Throwables;
import com.google.inject.Module;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;
/**
* Mock tests for the {@link ElasticStackApi} class.
*
* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "ElasticStackMockTest")
public class ElasticStackMockTest extends BaseMockWebServerTest {
public void testListStandardDrives() throws IOException, InterruptedException {
MockWebServer server = mockWebServer(new MockResponse()
.setBody(payloadFromResource("/standard_drives_uuids.txt")));
ElasticStackApi api = api(ElasticStackApi.class, server.getUrl("/").toString());
try {
Set<String> standardDrives = api.listStandardDrives();
assertEquals(standardDrives.size(), 36);
RecordedRequest request = server.takeRequest();
assertAuthentication(request);
assertEquals(request.getRequestLine(),
String.format("GET /drives/list/standard HTTP/1.1", server.getUrl("/").toString()));
} finally {
api.close();
server.shutdown();
}
}
public void testListStandardDriveInfo() throws IOException, InterruptedException {
MockWebServer server = mockWebServer(new MockResponse().setBody(payloadFromResource("/standard_drives.txt")));
ElasticStackApi api = api(ElasticStackApi.class, server.getUrl("/").toString());
try {
Set<StandardDrive> standardDrives = api.listStandardDriveInfo();
assertEquals(standardDrives.size(), 36);
RecordedRequest request = server.takeRequest();
assertAuthentication(request);
assertEquals(request.getRequestLine(),
String.format("GET /drives/info/standard HTTP/1.1", server.getUrl("/").toString()));
} finally {
api.close();
server.shutdown();
}
}
private static void assertAuthentication(final RecordedRequest request) throws InterruptedException {
assertEquals(request.getHeader(HttpHeaders.AUTHORIZATION), "Basic dXVpZDphcGlrZXk=");
}
private byte[] payloadFromResource(String resource) {
try {
return toStringAndClose(getClass().getResourceAsStream(resource)).getBytes(Charsets.UTF_8);
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
@Override
protected void addOverrideProperties(Properties props) {
props.setProperty(PROPERTY_IDENTITY, "uuid");
props.setProperty(PROPERTY_CREDENTIAL, "apikey");
}
@Override
protected Module createConnectionModule() {
return new JavaUrlHttpCommandExecutorServiceModule();
}
}

View File

@ -0,0 +1,121 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.compute.functions;
import static org.testng.Assert.assertEquals;
import java.util.UUID;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.elasticstack.domain.MediaType;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.domain.WellKnownImage;
import org.testng.annotations.Test;
/**
* Unit tests for the {@link StandardDriveToWellKnownImage} class.
*
* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "StandardDriveToWellKnownImageTest")
public class StandardDriveToWellKnownImageTest {
private StandardDriveToWellKnownImage function = new StandardDriveToWellKnownImage();
public void testUnknownOperatingSystemParsing() {
assertOS("Foo Linux 6.5", OsFamily.UNRECOGNIZED, "6.5", true);
}
public void testOperatingSystemWithoutVersionParsing() {
assertOS("Ubuntu Linux", OsFamily.UBUNTU, null, true);
}
public void testKnownOperatingSystemParsing() {
// Elastichosts
assertOS("centOS Linux 6.5", OsFamily.CENTOS, "6.5", true);
assertOS("Debian Linux 7.4 (Wheezy)", OsFamily.DEBIAN, "7.4", true);
assertOS("Ubuntu Linux 12.04.1 LTS (Precise Pangolin)", OsFamily.UBUNTU, "12.04.1", true);
assertOS("Ubuntu Linux 13.10 (Saucy Salamander)", OsFamily.UBUNTU, "13.10", true);
assertOS("Ubuntu 14.04 LTS (Trusty Tahr)", OsFamily.UBUNTU, "14.04", true);
assertOS("Windows Server 2012", OsFamily.WINDOWS, "2012", true);
assertOS("Windows Server 2012 + SQL", OsFamily.WINDOWS, "2012 + SQL", true);
assertOS("Windows Server 2012 R2", OsFamily.WINDOWS, "2012 R2", true);
assertOS("Windows Standard 2008 R2", OsFamily.WINDOWS, "2008 R2", true);
assertOS("Windows Standard 2008 R2 + SQL", OsFamily.WINDOWS, "2008 R2 + SQL", true);
assertOS("Windows Web Server 2008 R2", OsFamily.WINDOWS, "2008 R2", true);
assertOS("Windows Web Server 2008 R2 + SQL", OsFamily.WINDOWS, "2008 R2 + SQL", true);
// Go2Cloud
assertOS("Ubuntu 10.10", OsFamily.UBUNTU, "10.10", true);
assertOS("Debian 6.0.2.1", OsFamily.DEBIAN, "6.0.2.1", true);
assertOS("Windows 2008 R2 (x64) with SP1", OsFamily.WINDOWS, "2008 R2 (x64) with SP1", true);
assertOS("Windows 8 Developer Preview (x64)", OsFamily.WINDOWS, "8 Developer Preview (x64)", true);
// OpenHosting
assertOS("CentOS Linux 5.5 64", OsFamily.CENTOS, "5.5", true);
assertOS("CentOS Linux 5.6 64", OsFamily.CENTOS, "5.6", true);
assertOS("CentOS Linux 5.7 64", OsFamily.CENTOS, "5.7", true);
assertOS("Debian Linux 5.0", OsFamily.DEBIAN, "5.0", true);
assertOS("Debian Linux 6 (Squeeze) 64", OsFamily.DEBIAN, "6", true);
assertOS("Ubuntu 10.04.3 LTS (lucid) Server 64", OsFamily.UBUNTU, "10.04.3", true);
assertOS("Windows 2008 R2 Standard Edition", OsFamily.WINDOWS, "2008 R2 Standard Edition", true);
// Skalicloud
assertOS("CentOS 5.5 -32bit", OsFamily.CENTOS, "5.5", false);
assertOS("CentOS 5.5 -64bit", OsFamily.CENTOS, "5.5", true);
assertOS("CentOS 5.6 -32bit", OsFamily.CENTOS, "5.6", false);
assertOS("CentOS 5.6 -64bit", OsFamily.CENTOS, "5.6", true);
assertOS("Debian 5 -32bit", OsFamily.DEBIAN, "5", false);
assertOS("Debian 5 -64bit", OsFamily.DEBIAN, "5", true);
assertOS("Debian 6 -64bit -Experimental", OsFamily.DEBIAN, "6", true);
assertOS("Ubuntu Server 10.04 -32bit", OsFamily.UBUNTU, "10.04", false);
assertOS("Ubuntu Server 10.04 -64bit", OsFamily.UBUNTU, "10.04", true);
assertOS("Ubuntu Server 10.10 -32bit", OsFamily.UBUNTU, "10.10", false);
assertOS("Ubuntu Server 10.10 -64bit", OsFamily.UBUNTU, "10.10", true);
assertOS("Windows 2008R2 Web Edition", OsFamily.WINDOWS, "2008R2 Web Edition", true);
assertOS("Windows Server 2008R2 Standard", OsFamily.WINDOWS, "2008R2 Standard", true);
// ServerLove
assertOS("CentOS Linux 5.7", OsFamily.CENTOS, "5.7", true);
assertOS("CentOS Linux 6.2", OsFamily.CENTOS, "6.2", true);
assertOS("Debian Linux 6.0", OsFamily.DEBIAN, "6.0", true);
assertOS("Ubuntu 10.04 LTS", OsFamily.UBUNTU, "10.04", true);
assertOS("Ubuntu 12.04 LTS", OsFamily.UBUNTU, "12.04", true);
assertOS("Windows Server 2008 R2 Standard", OsFamily.WINDOWS, "2008 R2 Standard", true);
assertOS("Windows Server 2008 R2 Standard SP1 with SQL Server 2008 R2 Web Edition", OsFamily.WINDOWS,
"2008 R2 Standard SP1 with SQL Server 2008 R2 Web Edition", true);
assertOS("Windows Server 2012 Standard", OsFamily.WINDOWS, "2012 Standard", true);
assertOS("Windows Web Server 2008 R2", OsFamily.WINDOWS, "2008 R2", true);
assertOS("Windows Web Server 2008 R2 SP1 with SQL Server 2008 R2 Web Edition", OsFamily.WINDOWS,
"2008 R2 SP1 with SQL Server 2008 R2 Web Edition", true);
}
private void assertOS(String name, OsFamily expectedFamily, String expectedVersion, boolean expectedIs64bit) {
StandardDrive drive = standardDrive(name);
WellKnownImage image = function.apply(drive);
assertEquals(image.getOsFamily(), expectedFamily, String.format("Parsing family for [%s]:", name));
assertEquals(image.getOsVersion(), expectedVersion, String.format("Parsing version for [%s]:", name));
assertEquals(image.is64bit(), expectedIs64bit, String.format("Parsing arch for [%s]:", name));
}
private static StandardDrive standardDrive(String name) {
return new StandardDrive.Builder().uuid(UUID.randomUUID().toString()).size(1).name(name).media(MediaType.DISK)
.build();
}
}

View File

@ -0,0 +1,47 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.functions;
import static org.testng.Assert.assertEquals;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.http.HttpResponse;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Guice;
/**
* @author Ignasi Barrera
*/
@Test(groups = { "unit" })
public class ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSetTest {
private static final ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSet FN = Guice.createInjector().getInstance(
ListOfKeyValuesDelimitedByBlankLinesToStandardDriveSet.class);
public void testNone() {
assertEquals(FN.apply(HttpResponse.builder().statusCode(200).message("").payload("").build()), ImmutableSet.<StandardDrive> of());
assertEquals(FN.apply(HttpResponse.builder().statusCode(200).message("").payload("\n\n").build()), ImmutableSet.<StandardDrive> of());
assertEquals(FN.apply(HttpResponse.builder().statusCode(200).message("").build()), ImmutableSet.<StandardDrive> of());
}
public void testOne() {
assertEquals(FN.apply(HttpResponse.builder().statusCode(200).message("").payload(MapToStandardDriveTest.class
.getResourceAsStream("/standard_drive.txt")).build()), ImmutableSet.<StandardDrive> of(MapToStandardDriveTest.ONE));
}
}

View File

@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.functions;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import java.util.Map;
import org.jclouds.elasticstack.domain.ClaimType;
import org.jclouds.elasticstack.domain.ImageConversionType;
import org.jclouds.elasticstack.domain.MediaType;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.util.Strings2;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
/**
* @author Ignasi Barrera
*/
@Test(groups = { "unit" })
public class MapToStandardDriveTest {
public static StandardDrive ONE = new StandardDrive.Builder()
.name("Windows Web Server 2008 R2")
.uuid("11b84345-7169-4279-8038-18d6ba1a7712")//
.claimType(ClaimType.SHARED)
.readers(ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff"))//
.size(4743757824L)//
.rawSize(11811160064L)//
.format(ImageConversionType.GZIP)//
.media(MediaType.DISK)//
.build();
private static final MapToStandardDrive MAP_TO_STANDARD_DRIVE = new MapToStandardDrive();
public void testEmptyMapReturnsNull() {
assertEquals(MAP_TO_STANDARD_DRIVE.apply(ImmutableMap.<String, String> of()), null);
}
public void testBasics() {
StandardDrive expects = new StandardDrive.Builder().name("foo").size(100l).media(MediaType.DISK)
.format(ImageConversionType.GZIP).rawSize(5l).build();
assertEquals(MAP_TO_STANDARD_DRIVE.apply(ImmutableMap.of("name", "foo", "size", "100", "format", "gzip", "media",
"disk", "rawsize", "5")), expects);
}
public void testComplete() throws IOException {
Map<String, String> input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply(
Strings2.toStringAndClose(MapToStandardDriveTest.class.getResourceAsStream("/standard_drive.txt"))).get(0);
assertEquals(MAP_TO_STANDARD_DRIVE.apply(input), ONE);
}
}

View File

@ -0,0 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elasticstack.suppliers;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Iterables.transform;
import static org.jclouds.util.Strings2.toStringAndClose;
import java.io.IOException;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.elasticstack.domain.StandardDrive;
import org.jclouds.elasticstack.domain.WellKnownImage;
import org.jclouds.elasticstack.functions.ListOfKeyValuesDelimitedByBlankLinesToListOfMaps;
import org.jclouds.elasticstack.functions.MapToStandardDrive;
import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
/**
* Mock {@link WellKnownImageSupplier} to be used in tests.
*
* @author Ignasi Barrera
*/
@Singleton
public class MockStandardDiskImageSupplier implements WellKnownImageSupplier {
private final Function<StandardDrive, WellKnownImage> standardDriveToWellKnownImage;
private final ListOfKeyValuesDelimitedByBlankLinesToListOfMaps mapConverter;
private final MapToStandardDrive mapToStandardDrive;
@Inject
public MockStandardDiskImageSupplier(Function<StandardDrive, WellKnownImage> standardDriveToWellKnownImage,
ListOfKeyValuesDelimitedByBlankLinesToListOfMaps mapConverter, MapToStandardDrive mapToStandardDrive) {
this.standardDriveToWellKnownImage = checkNotNull(standardDriveToWellKnownImage, "standardDriveToWellKnownImage cannot be null");
this.mapConverter = checkNotNull(mapConverter, "mapConverter cannot be null");
this.mapToStandardDrive = checkNotNull(mapToStandardDrive, "mapToStandardDrive cannot be null");
}
@Override
public List<WellKnownImage> get() {
try {
String mockDrives = toStringAndClose(getClass().getResourceAsStream("/standard_drives.txt"));
Iterable<StandardDrive> parsedDrives = transform(mapConverter.apply(mockDrives), mapToStandardDrive);
return ImmutableList.copyOf(transform(parsedDrives, standardDriveToWellKnownImage));
} catch (IOException ex) {
throw Throwables.propagate(ex);
}
}
}

View File

@ -0,0 +1,8 @@
claim:type shared
drive 11b84345-7169-4279-8038-18d6ba1a7712
format gzip
media disk
name Windows Web Server 2008 R2
rawsize 11811160064
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4743757824

View File

@ -0,0 +1,275 @@
claim:type shared
drive ce85ef47-9794-4ed7-a8bd-af902ec0eddc
format gzip
media disk
name Debian Linux 7.4 (Wheezy)
rawsize 1073741824
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 184549376
claim:type shared
drive 82890da7-a036-4427-ac24-caea6c644a2f
format gzip
media disk
name Ubuntu 14.04 LTS (Trusty Tahr)
rawsize 1073741824
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 264241152
claim:type shared
drive 62f512cd-82c7-498e-88d8-a09ac2ef20e7
format gzip
media disk
name Ubuntu Linux 12.04.1 LTS (Precise Pangolin)
rawsize 1073741824
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 201326592
claim:type shared
drive 4f31382b-5098-4610-8993-bbebb844febd
format gzip
media disk
name Ubuntu Linux 13.10 (Saucy Salamander)
rawsize 1073741824
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 230686720
claim:type shared
drive cdea53be-2511-4c91-9779-f6421f623a49
format gzip
media disk
name Windows Server 2012
rawsize 15032385536
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 7671382016
claim:type shared
drive 7b9807cc-3c92-425f-878c-1d45927f3f9c
format gzip
media disk
name Windows Server 2012 + SQL
rawsize 32212254720
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 17192452096
claim:type shared
drive 61ef248d-6616-4378-9702-9101870741d2
format gzip
media disk
name Windows Server 2012 R2
rawsize 10737418240
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 5368709120
claim:type shared
drive 6c0c3072-f55f-4dd2-9308-951dacf41ce3
format gzip
media disk
name Windows Standard 2008 R2
rawsize 9663676416
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4345298944
claim:type shared
drive 63677762-4423-464f-92fd-5c43d449a716
format gzip
media disk
name Windows Standard 2008 R2 + SQL
rawsize 20401094656
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 14050918400
claim:type shared
drive 11b84345-7169-4279-8038-18d6ba1a7712
format gzip
media disk
name Windows Web Server 2008 R2
rawsize 11811160064
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4743757824
claim:type shared
drive b23e81b9-103e-4f9d-8ce5-b57bb529007c
format gzip
media disk
name Windows Web Server 2008 R2 + SQL
rawsize 20401094656
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 14357102592
claim:type shared
drive 8d5c93b8-e4e4-4943-b41e-873576b7fcd1
format gzip
media disk
name centOS Linux 6.5
rawsize 1073741824
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 218103808
claim:type shared
drive 65cb106c-3dff-4f27-9607-f25bbe0a3fc6
media cdrom
name Debian 7.4 DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 3955228672
claim:type shared
drive 8eeaa0d5-9696-4fb2-b34e-ccca28f54138
media cdrom
name Fedora 19 Install DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4445962240
claim:type shared
drive 4d0971b5-9780-4b42-a0a0-ea06a0669b8b
media cdrom
name Fedora 20 Install DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4605345792
claim:type shared
drive 07a08d47-1f24-4c99-a080-ea6b38502c66
media cdrom
name FreeBSD 10.0 DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 2487222272
claim:type shared
drive 321eaeb7-a5a5-4ffd-9a62-db1d0ffd133f
media cdrom
name FreeBSD 9.2 DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 2554331136
claim:type shared
drive cf0dfc73-2ab2-4317-a515-698ed4097c90
media cdrom
name Knoppix 7.2 DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4114612224
claim:type shared
drive 696a3dee-c29d-4bd2-afb9-06e995702b65
media cdrom
name Linux Mint 16 (Petra) DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 1329594368
claim:type shared
drive 3f9ddec5-0f9e-4879-85fb-e412abe0cb37
media cdrom
name Microsoft SQL Express 2012
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 5507121152
claim:type shared
drive e58ad21f-c53f-47a1-95bd-c6d614a59d2d
media cdrom
name System Rescue CD 4.0.1
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 473956352
claim:type shared
drive 7fed7f41-7af7-42d9-bbf6-d96427757bc4
media cdrom
name Ubuntu 12.04.4 Desktop DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 771751936
claim:type shared
drive 50f8aa7a-090e-413a-8be9-e0ef498b7012
media cdrom
name Ubuntu 12.04.4 Server DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 713031680
claim:type shared
drive a8e87123-1d88-4bd4-ba60-3a42248f7bc0
media cdrom
name Ubuntu 13.10 Desktop DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 926941184
claim:type shared
drive 00798d0a-1081-4590-8b6c-af1f927e209c
media cdrom
name Ubuntu 13.10 Server DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 704643072
claim:type shared
drive 92f4a7e9-daa2-45f1-967c-cf460cf5bca1
media cdrom
name Ubuntu 14.04 LTS Desktop Live CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 1010827264
claim:type shared
drive 9dfbbe29-5352-415a-9f7c-70ec7409b684
media cdrom
name Ubuntu 14.04 LTS Server Install CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 591396864
claim:type shared
drive 5a4419f8-6c39-490c-87e9-21e33a1c8add
media cdrom
name Virtio Drivers 1.74
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 62914560
claim:type shared
drive 554f5ed7-811a-400d-9f96-3f829a2bc145
media cdrom
name Windows 2012 R2 Evaluation CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 5368709120
claim:type shared
drive 6cf6b5e4-f54f-4525-876b-d07123791880
media cdrom
name Windows Server 2008 R2 Trial Install CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 3170893824
claim:type shared
drive f89af28e-ff00-4fc9-a7ed-22e7fa5a88db
media cdrom
name Windows Server 2008 Trial Install CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 2663383040
claim:type shared
drive 0cc82095-a967-4e93-af04-9e265fbb4251
media cdrom
name Windows Server 2012 Install CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 3695181824
claim:type shared
drive dde6f196-a4bd-4ca7-b631-4d84d69b9490
media cdrom
name Windows Server 2012 R2 Install CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 4479516672
claim:type shared
drive 7aead6d3-c3e6-4940-85c7-f5ee61f6ef2b
media cdrom
name Windows Web Server 2008 Trial Install CD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 2248146944
claim:type shared
drive 312ccda0-c3b2-4cac-911b-68b82a498075
media cdrom
name arch Linux 2014-03-01
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 553648128
claim:type shared
drive f42919f6-f535-44cd-bc9f-6bb6e44d05d8
media cdrom
name centOS 6.5 Live DVD
readers ffffffff-ffff-ffff-ffff-ffffffffffff
size 1874853888

View File

@ -0,0 +1,36 @@
ce85ef47-9794-4ed7-a8bd-af902ec0eddc
82890da7-a036-4427-ac24-caea6c644a2f
62f512cd-82c7-498e-88d8-a09ac2ef20e7
4f31382b-5098-4610-8993-bbebb844febd
cdea53be-2511-4c91-9779-f6421f623a49
7b9807cc-3c92-425f-878c-1d45927f3f9c
61ef248d-6616-4378-9702-9101870741d2
6c0c3072-f55f-4dd2-9308-951dacf41ce3
63677762-4423-464f-92fd-5c43d449a716
11b84345-7169-4279-8038-18d6ba1a7712
b23e81b9-103e-4f9d-8ce5-b57bb529007c
8d5c93b8-e4e4-4943-b41e-873576b7fcd1
65cb106c-3dff-4f27-9607-f25bbe0a3fc6
8eeaa0d5-9696-4fb2-b34e-ccca28f54138
4d0971b5-9780-4b42-a0a0-ea06a0669b8b
07a08d47-1f24-4c99-a080-ea6b38502c66
321eaeb7-a5a5-4ffd-9a62-db1d0ffd133f
cf0dfc73-2ab2-4317-a515-698ed4097c90
696a3dee-c29d-4bd2-afb9-06e995702b65
3f9ddec5-0f9e-4879-85fb-e412abe0cb37
e58ad21f-c53f-47a1-95bd-c6d614a59d2d
7fed7f41-7af7-42d9-bbf6-d96427757bc4
50f8aa7a-090e-413a-8be9-e0ef498b7012
a8e87123-1d88-4bd4-ba60-3a42248f7bc0
00798d0a-1081-4590-8b6c-af1f927e209c
92f4a7e9-daa2-45f1-967c-cf460cf5bca1
9dfbbe29-5352-415a-9f7c-70ec7409b684
5a4419f8-6c39-490c-87e9-21e33a1c8add
554f5ed7-811a-400d-9f96-3f829a2bc145
6cf6b5e4-f54f-4525-876b-d07123791880
f89af28e-ff00-4fc9-a7ed-22e7fa5a88db
0cc82095-a967-4e93-af04-9e265fbb4251
dde6f196-a4bd-4ca7-b631-4d84d69b9490
7aead6d3-c3e6-4940-85c7-f5ee61f6ef2b
312ccda0-c3b2-4cac-911b-68b82a498075
f42919f6-f535-44cd-bc9f-6bb6e44d05d8

View File

@ -0,0 +1,6 @@
#
# The jclouds provider for ElasticHosts' Amsterdam ElasticStack (http://www.elastichosts.com/).
#
# Expects the jclouds elasticstack API to be present on your application's classpath.
#

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.8.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>elastichosts-ams-e</artifactId>
<name>jclouds ElasticHosts Amsterdam provider</name>
<description>ElasticHosts implementation targeted to Amsterdam</description>
<packaging>bundle</packaging>
<properties>
<test.elastichosts-ams-e.endpoint>https://api-ams-e.elastichosts.com</test.elastichosts-ams-e.endpoint>
<test.elastichosts-ams-e.api-version>2.0</test.elastichosts-ams-e.api-version>
<test.elastichosts-ams-e.build-version />
<test.elastichosts-ams-e.identity>FIXME_IDENTITY</test.elastichosts-ams-e.identity>
<test.elastichosts-ams-e.credential>FIXME_CREDENTIAL</test.elastichosts-ams-e.credential>
<test.elastichosts-ams-e.template />
<jclouds.osgi.export>org.jclouds.elastichosts*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
org.jclouds.rest.internal;version="${project.version}",
org.jclouds*;version="${project.version}",
*
</jclouds.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.elastichosts-ams-e.endpoint>${test.elastichosts-ams-e.endpoint}</test.elastichosts-ams-e.endpoint>
<test.elastichosts-ams-e.api-version>${test.elastichosts-ams-e.api-version}</test.elastichosts-ams-e.api-version>
<test.elastichosts-ams-e.build-version>${test.elastichosts-ams-e.build-version}</test.elastichosts-ams-e.build-version>
<test.elastichosts-ams-e.identity>${test.elastichosts-ams-e.identity}</test.elastichosts-ams-e.identity>
<test.elastichosts-ams-e.credential>${test.elastichosts-ams-e.credential}</test.elastichosts-ams-e.credential>
<test.elastichosts-ams-e.template>${test.elastichosts-ams-e.template}</test.elastichosts-ams-e.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,86 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for ElasticHosts Amsterdam.
*
* @author Ignasi Barrera
*/
public class ElasticHostsAmsterdamMetadata extends BaseProviderMetadata {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}
public ElasticHostsAmsterdamMetadata() {
super(builder());
}
public ElasticHostsAmsterdamMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}
public static class Builder
extends
BaseProviderMetadata.Builder {
protected Builder() {
id("elastichosts-ams-e")
.name("ElasticHosts Amsterdam")
.apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
.homepage(URI.create("https://ams-e.elastichosts.com"))
.console(URI.create("https://ams-e.elastichosts.com/accounts"))
.iso3166Codes("NL-NH")
.endpoint("https://api-ams-e.elastichosts.com")
.defaultProperties(ElasticHostsAmsterdamMetadata.defaultProperties());
}
@Override
public ElasticHostsAmsterdamMetadata build() {
return new ElasticHostsAmsterdamMetadata(this);
}
@Override
public Builder fromProviderMetadata(
ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}

View File

@ -0,0 +1 @@
org.jclouds.elastichosts.ElasticHostsAmsterdamMetadata

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsAmsterdamApiLiveTest")
public class ElasticHostsAmsterdamApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsAmsterdamApiLiveTest() {
provider = "elastichosts-ams-e";
}
}

View File

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadataTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "ElasticHostsAmsterdamProviderTest")
public class ElasticHostsAmsterdamProviderTest extends BaseProviderMetadataTest {
public ElasticHostsAmsterdamProviderTest() {
super(new ElasticHostsAmsterdamMetadata(), new ElasticStackApiMetadata());
}
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsAmsterdamComputeServiceLiveTest")
public class ElasticHostsAmsterdamComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
public ElasticHostsAmsterdamComputeServiceLiveTest() {
provider = "elastichosts-ams-e";
group = "elastichosts";
}
}

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsAmsterdamTemplateBuilderLiveTest")
public class ElasticHostsAmsterdamTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public ElasticHostsAmsterdamTemplateBuilderLiveTest() {
provider = "elastichosts-ams-e";
}
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
}
});
}
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("NL-NH");
}
}

View File

@ -0,0 +1,5 @@
#
# The jclouds provider for ElasticHosts' Hong Kong ElasticStack (http://www.elastichosts.com/).
#
# Expects the jclouds elasticstack API to be present on your application's classpath.
#

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.8.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>elastichosts-hkg-e</artifactId>
<name>jclouds ElasticHosts Hong Kong provider</name>
<description>ElasticHosts implementation targeted to Hong Kong</description>
<packaging>bundle</packaging>
<properties>
<test.elastichosts-hkg-e.endpoint>https://api-hkg-e.elastichosts.com</test.elastichosts-hkg-e.endpoint>
<test.elastichosts-hkg-e.api-version>2.0</test.elastichosts-hkg-e.api-version>
<test.elastichosts-hkg-e.build-version />
<test.elastichosts-hkg-e.identity>FIXME_IDENTITY</test.elastichosts-hkg-e.identity>
<test.elastichosts-hkg-e.credential>FIXME_CREDENTIAL</test.elastichosts-hkg-e.credential>
<test.elastichosts-hkg-e.template />
<jclouds.osgi.export>org.jclouds.elastichosts*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
org.jclouds.rest.internal;version="${project.version}",
org.jclouds*;version="${project.version}",
*
</jclouds.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.elastichosts-hkg-e.endpoint>${test.elastichosts-hkg-e.endpoint}</test.elastichosts-hkg-e.endpoint>
<test.elastichosts-hkg-e.api-version>${test.elastichosts-hkg-e.api-version}</test.elastichosts-hkg-e.api-version>
<test.elastichosts-hkg-e.build-version>${test.elastichosts-hkg-e.build-version}</test.elastichosts-hkg-e.build-version>
<test.elastichosts-hkg-e.identity>${test.elastichosts-hkg-e.identity}</test.elastichosts-hkg-e.identity>
<test.elastichosts-hkg-e.credential>${test.elastichosts-hkg-e.credential}</test.elastichosts-hkg-e.credential>
<test.elastichosts-hkg-e.template>${test.elastichosts-hkg-e.template}</test.elastichosts-hkg-e.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,86 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for ElasticHosts Hong Kong.
*
* @author Ignasi Barrera
*/
public class ElasticHostsHongKongProviderMetadata extends BaseProviderMetadata {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}
public ElasticHostsHongKongProviderMetadata() {
super(builder());
}
public ElasticHostsHongKongProviderMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}
public static class Builder
extends
BaseProviderMetadata.Builder {
protected Builder() {
id("elastichosts-hkg-e")
.name("ElasticHosts Hong Kong")
.apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
.homepage(URI.create("https://hkg-e.elastichosts.com"))
.console(URI.create("https://hkg-e.elastichosts.com/accounts"))
.iso3166Codes("HK")
.endpoint("https://api-hkg-e.elastichosts.com")
.defaultProperties(ElasticHostsHongKongProviderMetadata.defaultProperties());
}
@Override
public ElasticHostsHongKongProviderMetadata build() {
return new ElasticHostsHongKongProviderMetadata(this);
}
@Override
public Builder fromProviderMetadata(
ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}

View File

@ -0,0 +1 @@
org.jclouds.elastichosts.ElasticHostsHongKongProviderMetadata

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsHongKongApiLiveTest")
public class ElasticHostsHongKongApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsHongKongApiLiveTest() {
provider = "elastichosts-hkg-e";
}
}

View File

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadataTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "ElasticHostsHongKongProviderTest")
public class ElasticHostsHongKongProviderTest extends BaseProviderMetadataTest {
public ElasticHostsHongKongProviderTest() {
super(new ElasticHostsHongKongProviderMetadata(), new ElasticStackApiMetadata());
}
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsHongKongComputeServiceLiveTest")
public class ElasticHostsHongKongComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
public ElasticHostsHongKongComputeServiceLiveTest() {
provider = "elastichosts-hkg-e";
group = "elastichosts";
}
}

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsHongKongTemplateBuilderLiveTest")
public class ElasticHostsHongKongTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public ElasticHostsHongKongTemplateBuilderLiveTest() {
provider = "elastichosts-hkg-e";
}
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
}
});
}
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("HK");
}
}

View File

@ -16,6 +16,8 @@
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
@ -50,6 +52,7 @@ public class ElasticHostsPeer1LosAngelesProviderMetadata extends BaseProviderMet
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}

View File

@ -1,65 +0,0 @@
[
{
"uuid": "73f7cc6a-1c48-418a-80de-886b28a56a4d",
"description": "CentOS Linux 6.0",
"osFamily": "CENTOS",
"osVersion": "6.0",
"size": "3"
},
{
"uuid": "9405cddf-8d01-472c-b7e3-e8c062dcde51",
"description": "Debian Linux 6.0",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "8d8aee18-8744-452c-94b2-69a2a34b8460",
"description": "Ubuntu Linux 11.10",
"osFamily": "UBUNTU",
"osVersion": "11.10",
"size": "1"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "b17ebce6-61b4-4dcc-9654-41c9fc847e01",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -18,7 +18,9 @@ package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
@ -47,17 +49,19 @@ public class ElasticHostsPeer1LosAngelesTemplateBuilderLiveTest extends BaseTemp
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || ImmutableSet.of("11.10", "10.04").contains(input.version)) && input.is64Bit;
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& input.is64Bit;
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
@ -66,13 +70,12 @@ public class ElasticHostsPeer1LosAngelesTemplateBuilderLiveTest extends BaseTemp
});
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "elastichosts-lax-p");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}

View File

@ -16,6 +16,8 @@
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
@ -49,6 +51,7 @@ public class ElasticHostsBlueSquareLondonProviderMetadata extends BaseProviderMe
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}

View File

@ -1,65 +0,0 @@
[
{
"uuid": "e994eedf-ce5c-4efd-9d0d-a16f690004f7",
"description": "CentOS Linux 6.0",
"osFamily": "CENTOS",
"osVersion": "6.0",
"size": "3"
},
{
"uuid": "e97e0a2a-08d7-4624-b796-708f2adfc6b0",
"description": "Debian Linux 6.0",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04 LTS",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "13f9f85d-ed1c-4fb0-aa26-3e84da826faf",
"description": "Ubuntu Linux 11.10",
"osFamily": "UBUNTU",
"osVersion": "11.10",
"size": "1"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "30824e97-05a4-410c-946e-2ba5a92b07cb",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9ecf810e-6ad1-40ef-b360-d606f0444671",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "10a88d1c-6575-46e3-8d2c-7744065ea530",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "2567f25c-8fb8-45c7-95fc-bfe3c3d84c47",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -18,7 +18,9 @@ package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
@ -32,7 +34,6 @@ import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live")
@ -47,18 +48,19 @@ public class ElasticHostsBlueSquareLondonTemplateBuilderLiveTest extends BaseTem
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("10.04") || input.version.equals("11.10"))
&& input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("6.0")) && input.is64Bit;
case UBUNTU:
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& input.is64Bit;
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
@ -67,13 +69,12 @@ public class ElasticHostsBlueSquareLondonTemplateBuilderLiveTest extends BaseTem
});
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "elastichosts-lon-b");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}

View File

@ -16,6 +16,8 @@
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
@ -49,6 +51,7 @@ public class ElasticHostsPeer1LondonProviderMetadata extends BaseProviderMetadat
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}

View File

@ -1,65 +0,0 @@
[
{
"uuid": "6acfe7ea-1bb0-466e-992d-3830966e9da8",
"description": "CentOS Linux 6.0",
"osFamily": "CENTOS",
"osVersion": "6.0",
"size": "3"
},
{
"uuid": "ff7c5f7b-1cc8-42e5-afe1-ca00c5faaaa6",
"description": "Debian Linux 6.0",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04 LTS",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "24ea9dad-f014-4836-bcb0-f03184c74e7a",
"description": "Ubuntu Linux 11.10",
"osFamily": "UBUNTU",
"osVersion": "11.10",
"size": "1"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "b17ebce6-61b4-4dcc-9654-41c9fc847e01",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -18,7 +18,9 @@ package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
@ -47,18 +49,19 @@ public class ElasticHostsPeer1LondonTemplateBuilderLiveTest extends BaseTemplate
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("10.04") || input.version.equals("11.10"))
&& input.is64Bit;
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& input.is64Bit;
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
@ -67,13 +70,12 @@ public class ElasticHostsPeer1LondonTemplateBuilderLiveTest extends BaseTemplate
});
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "elastichosts-lon-p");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}

View File

@ -16,6 +16,8 @@
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
@ -49,6 +51,7 @@ public class ElasticHostsPeer1SanAntonioProviderMetadata extends BaseProviderMet
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}

View File

@ -1,72 +0,0 @@
[
{
"uuid": "73f7cc6a-1c48-418a-80de-886b28a56a4d",
"description": "CentOS Linux 6.0",
"osFamily": "CENTOS",
"osVersion": "6.0",
"size": "3"
},
{
"uuid": "9405cddf-8d01-472c-b7e3-e8c062dcde51",
"description": "Debian Linux 6.0",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "6aa953cc-3395-4e8d-938e-65c74fd20334",
"description": "Debian Linux 6.0.1",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "8d8aee18-8744-452c-94b2-69a2a34b8460",
"description": "Ubuntu Linux 11.10",
"osFamily": "UBUNTU",
"osVersion": "11.10",
"size": "1"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "b17ebce6-61b4-4dcc-9654-41c9fc847e01",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -18,7 +18,9 @@ package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
@ -47,17 +49,19 @@ public class ElasticHostsPeer1SanAntonioTemplateBuilderLiveTest extends BaseTemp
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || ImmutableSet.of("11.10", "10.04").contains(input.version)) && input.is64Bit;
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& input.is64Bit;
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
@ -66,13 +70,12 @@ public class ElasticHostsPeer1SanAntonioTemplateBuilderLiveTest extends BaseTemp
});
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "elastichosts-sat-p");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}

View File

@ -0,0 +1,5 @@
#
# The jclouds provider for ElasticHosts' San Jose ElasticStack (http://www.elastichosts.com/).
#
# Expects the jclouds elasticstack API to be present on your application's classpath.
#

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.8.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>elastichosts-sjc-c</artifactId>
<name>jclouds ElasticHosts San Jose provider</name>
<description>ElasticHosts implementation targeted to San Jose</description>
<packaging>bundle</packaging>
<properties>
<test.elastichosts-sjc-c.endpoint>https://api-sjc-c.elastichosts.com</test.elastichosts-sjc-c.endpoint>
<test.elastichosts-sjc-c.api-version>2.0</test.elastichosts-sjc-c.api-version>
<test.elastichosts-sjc-c.build-version />
<test.elastichosts-sjc-c.identity>FIXME_IDENTITY</test.elastichosts-sjc-c.identity>
<test.elastichosts-sjc-c.credential>FIXME_CREDENTIAL</test.elastichosts-sjc-c.credential>
<test.elastichosts-sjc-c.template />
<jclouds.osgi.export>org.jclouds.elastichosts*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
org.jclouds.rest.internal;version="${project.version}",
org.jclouds*;version="${project.version}",
*
</jclouds.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.elastichosts-sjc-c.endpoint>${test.elastichosts-sjc-c.endpoint}</test.elastichosts-sjc-c.endpoint>
<test.elastichosts-sjc-c.api-version>${test.elastichosts-sjc-c.api-version}</test.elastichosts-sjc-c.api-version>
<test.elastichosts-sjc-c.build-version>${test.elastichosts-sjc-c.build-version}</test.elastichosts-sjc-c.build-version>
<test.elastichosts-sjc-c.identity>${test.elastichosts-sjc-c.identity}</test.elastichosts-sjc-c.identity>
<test.elastichosts-sjc-c.credential>${test.elastichosts-sjc-c.credential}</test.elastichosts-sjc-c.credential>
<test.elastichosts-sjc-c.template>${test.elastichosts-sjc-c.template}</test.elastichosts-sjc-c.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for ElasticHosts San Jose.
*
* @author Ignasi Barrera
*/
public class ElasticHostsSanJoseProviderMetadata extends BaseProviderMetadata {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}
public ElasticHostsSanJoseProviderMetadata() {
super(builder());
}
public ElasticHostsSanJoseProviderMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}
public static class Builder extends BaseProviderMetadata.Builder {
protected Builder() {
id("elastichosts-sjc-c")
.name("ElasticHosts San Jose")
.apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
.homepage(URI.create("https://sjc-c.elastichosts.com"))
.console(URI.create("https://sjc-c.elastichosts.com/accounts"))
.iso3166Codes("US-CA")
.endpoint("https://api-sjc-c.elastichosts.com")
.defaultProperties(ElasticHostsSanJoseProviderMetadata.defaultProperties());
}
@Override
public ElasticHostsSanJoseProviderMetadata build() {
return new ElasticHostsSanJoseProviderMetadata(this);
}
@Override
public Builder fromProviderMetadata(ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}

View File

@ -0,0 +1 @@
org.jclouds.elastichosts.ElasticHostsSanJoseProviderMetadata

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsSanJoseApiLiveTest")
public class ElasticHostsSanJoseApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsSanJoseApiLiveTest() {
provider = "elastichosts-sjc-c";
}
}

View File

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadataTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "ElasticHostsSanJoseProviderTest")
public class ElasticHostsSanJoseProviderTest extends BaseProviderMetadataTest {
public ElasticHostsSanJoseProviderTest() {
super(new ElasticHostsSanJoseProviderMetadata(), new ElasticStackApiMetadata());
}
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsSanJoseComputeServiceLiveTest")
public class ElasticHostsSanJoseComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
public ElasticHostsSanJoseComputeServiceLiveTest() {
provider = "elastichosts-sjc-c";
group = "elastichosts";
}
}

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsSanJoseTemplateBuilderLiveTest")
public class ElasticHostsSanJoseTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public ElasticHostsSanJoseTemplateBuilderLiveTest() {
provider = "elastichosts-sjc-c";
}
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
}
});
}
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("US-CA");
}
}

View File

@ -0,0 +1,5 @@
#
# The jclouds provider for ElasticHosts' Sydney ElasticStack (http://www.elastichosts.com/).
#
# Expects the jclouds elasticstack API to be present on your application's classpath.
#

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.8.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>elastichosts-syd-v</artifactId>
<name>jclouds ElasticHosts Sydney provider</name>
<description>ElasticHosts implementation targeted to Sydney</description>
<packaging>bundle</packaging>
<properties>
<test.elastichosts-syd-v.endpoint>https://api-syd-v.elastichosts.com</test.elastichosts-syd-v.endpoint>
<test.elastichosts-syd-v.api-version>2.0</test.elastichosts-syd-v.api-version>
<test.elastichosts-syd-v.build-version />
<test.elastichosts-syd-v.identity>FIXME_IDENTITY</test.elastichosts-syd-v.identity>
<test.elastichosts-syd-v.credential>FIXME_CREDENTIAL</test.elastichosts-syd-v.credential>
<test.elastichosts-syd-v.template />
<jclouds.osgi.export>org.jclouds.elastichosts*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",
org.jclouds.rest.internal;version="${project.version}",
org.jclouds*;version="${project.version}",
*
</jclouds.osgi.import>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.elastichosts-syd-v.endpoint>${test.elastichosts-syd-v.endpoint}</test.elastichosts-syd-v.endpoint>
<test.elastichosts-syd-v.api-version>${test.elastichosts-syd-v.api-version}</test.elastichosts-syd-v.api-version>
<test.elastichosts-syd-v.build-version>${test.elastichosts-syd-v.build-version}</test.elastichosts-syd-v.build-version>
<test.elastichosts-syd-v.identity>${test.elastichosts-syd-v.identity}</test.elastichosts-syd-v.identity>
<test.elastichosts-syd-v.credential>${test.elastichosts-syd-v.credential}</test.elastichosts-syd-v.credential>
<test.elastichosts-syd-v.template>${test.elastichosts-syd-v.template}</test.elastichosts-syd-v.template>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for ElasticHosts Sydney.
*
* @author Ignasi Barrera
*/
public class ElasticHostsSydneyProviderMetadata extends BaseProviderMetadata {
public static Builder builder() {
return new Builder();
}
@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}
public ElasticHostsSydneyProviderMetadata() {
super(builder());
}
public ElasticHostsSydneyProviderMetadata(Builder builder) {
super(builder);
}
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}
public static class Builder extends BaseProviderMetadata.Builder {
protected Builder() {
id("elastichosts-syd-v")
.name("ElasticHosts Sydney")
.apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
.homepage(URI.create("https://syd-v.elastichosts.com"))
.console(URI.create("https://syd-v.elastichosts.com/accounts"))
.iso3166Codes("AU-NSW")
.endpoint("https://api-syd-v.elastichosts.com")
.defaultProperties(ElasticHostsSydneyProviderMetadata.defaultProperties());
}
@Override
public ElasticHostsSydneyProviderMetadata build() {
return new ElasticHostsSydneyProviderMetadata(this);
}
@Override
public Builder fromProviderMetadata(ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}

View File

@ -0,0 +1 @@
org.jclouds.elastichosts.ElasticHostsSydneyProviderMetadata

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsSydneyApiLiveTest")
public class ElasticHostsSydneyApiLiveTest extends ElasticStackApiLiveTest {
public ElasticHostsSydneyApiLiveTest() {
provider = "elastichosts-syd-v";
}
}

View File

@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.internal.BaseProviderMetadataTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "ElasticHostsSydneyProviderTest")
public class ElasticHostsSydneyProviderTest extends BaseProviderMetadataTest {
public ElasticHostsSydneyProviderTest() {
super(new ElasticHostsSydneyProviderMetadata(), new ElasticStackApiMetadata());
}
}

View File

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsSydneyComputeServiceLiveTest")
public class ElasticHostsSydneyComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
public ElasticHostsSydneyComputeServiceLiveTest() {
provider = "elastichosts-syd-v";
group = "elastichosts";
}
}

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.OsFamilyVersion64Bit;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
import org.testng.annotations.Test;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
/**
* @author Ignasi Barrera
*/
@Test(groups = "live", testName = "ElasticHostsSydneyTemplateBuilderLiveTest")
public class ElasticHostsSydneyTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public ElasticHostsSydneyTemplateBuilderLiveTest() {
provider = "elastichosts-syd-v";
}
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
}
});
}
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("AU-NSW");
}
}

View File

@ -16,6 +16,8 @@
*/
package org.jclouds.elastichosts;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import java.net.URI;
import java.util.Properties;
@ -49,6 +51,7 @@ public class ElasticHostsPeer1TorontoProviderMetadata extends BaseProviderMetada
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04].[0-9]*,os64Bit=true");
return properties;
}

View File

@ -1,65 +0,0 @@
[
{
"uuid": "73f7cc6a-1c48-418a-80de-886b28a56a4d",
"description": "CentOS Linux 6.0",
"osFamily": "CENTOS",
"osVersion": "6.0",
"size": "3"
},
{
"uuid": "9405cddf-8d01-472c-b7e3-e8c062dcde51",
"description": "Debian Linux 6.0",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "8d8aee18-8744-452c-94b2-69a2a34b8460",
"description": "Ubuntu Linux 11.10",
"osFamily": "UBUNTU",
"osVersion": "11.10",
"size": "1"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "b17ebce6-61b4-4dcc-9654-41c9fc847e01",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -18,7 +18,9 @@ package org.jclouds.elastichosts.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
import java.util.Set;
import org.jclouds.compute.domain.OsFamily;
@ -47,17 +49,19 @@ public class ElasticHostsPeer1TorontoTemplateBuilderLiveTest extends BaseTemplat
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
public boolean apply(final OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || ImmutableSet.of("11.10", "10.04").contains(input.version)) && input.is64Bit;
return (input.version.equals("") || input.version.equals("12.04.1") || input.version.equals("13.10") || input.version
.equals("14.04")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.matches("7.4")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
return (input.version.equals("") || input.version.equals("6.5")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& input.is64Bit;
return (input.version.equals("") || input.version.equals("2008 R2")
|| input.version.equals("2008 R2 + SQL") || input.version.equals("2012") || input.version
.equals("2012 R2 + SQL")) && input.is64Bit;
default:
return false;
}
@ -66,13 +70,12 @@ public class ElasticHostsPeer1TorontoTemplateBuilderLiveTest extends BaseTemplat
});
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
@Override
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = view.getComputeService().templateBuilder().build();
assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04].[0-9]*"));
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "elastichosts-tor-p");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}

View File

@ -1,30 +0,0 @@
[
{
"uuid": "14c88d27-1f5e-4ad5-9f3a-28e5d2282f61",
"description": "Ubuntu 10.10",
"osFamily": "UBUNTU",
"osVersion": "10.10",
"size": "1"
},
{
"uuid": "cc54132d-4912-4106-a91a-7a27e6866c8b",
"description": "Debian 6.0.2.1",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "77ad0ffe-9537-4c64-a8e3-10db185261c0",
"description": "Windows 2008 R2 (x64) with SP1",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "d971ddfb-7a69-48f7-8d14-a76ef61b01d8",
"description": "Windows 8 Developer Preview (x64)",
"osFamily": "WINDOWS",
"osVersion": "8",
"size": "13"
}
]

View File

@ -1,51 +0,0 @@
[
{
"uuid": "1fc52c4b-f08d-4f9f-8821-7fdd073a32d6",
"description": "CentOS Linux 5.5 64",
"osFamily": "CENTOS",
"osVersion": "5.5",
"size": "3"
},
{
"uuid": "4d67096a-c2b5-4be7-9716-d4b2f9e2d4b5",
"description": "CentOS Linux 5.6 64",
"osFamily": "CENTOS",
"osVersion": "5.6",
"size": "3"
},
{
"uuid": "61e04f61-a39e-494f-bcf6-b17d3eba0df7",
"description": "CentOS Linux 5.7 64",
"osFamily": "CENTOS",
"osVersion": "5.7",
"size": "3"
},
{
"uuid": "9c1a506a-5d2b-496b-9ebc-26cfeae76f42",
"description": "Debian Linux 5.0",
"osFamily": "DEBIAN",
"osVersion": "5.0",
"size": "1"
},
{
"uuid": "13658a54-4086-47a4-89cb-ae21da7afb0c",
"description": "Debian Linux 6 (Squeeze) 64",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "8023b089-7b0e-4fcb-8016-01e82f2a9716",
"description": "Ubuntu 10.04.3 LTS (lucid) Server 64",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "d7826937-a160-4f70-ab5a-7ee9d78f7404",
"description": "Windows 2008 R2 Standard Edition",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "10"
}
]

View File

@ -46,6 +46,10 @@
<module>elastichosts-lon-b</module>
<module>elastichosts-tor-p</module>
<module>elastichosts-lax-p</module>
<module>elastichosts-ams-e</module>
<module>elastichosts-sjc-c</module>
<module>elastichosts-hkg-e</module>
<module>elastichosts-syd-v</module>
<module>openhosting-east1</module>
<module>serverlove-z1-man</module>
<module>skalicloud-sdg-my</module>

View File

@ -22,6 +22,10 @@ import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackApiMetadata;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;
import org.jclouds.serverlove.config.ServerloveImagesModule;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Serverlove Manchester.
@ -52,19 +56,22 @@ public class ServerloveManchesterProviderMetadata extends BaseProviderMetadata {
return properties;
}
public static class Builder
extends
BaseProviderMetadata.Builder {
public static class Builder extends BaseProviderMetadata.Builder {
protected Builder() {
id("serverlove-z1-man")
.name("Serverlove Manchester")
.apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
.homepage(URI.create("http://www.serverlove.com"))
.console(URI.create("http://www.serverlove.com/accounts"))
.iso3166Codes("GB-MAN")
.endpoint("https://api.z1-man.serverlove.com")
.defaultProperties(ServerloveManchesterProviderMetadata.defaultProperties());
ElasticStackApiMetadata apiMedatada = new ElasticStackApiMetadata();
ImmutableSet.Builder<Class<? extends Module>> modules = ImmutableSet.builder();
modules.addAll(apiMedatada.getDefaultModules());
modules.add(ServerloveImagesModule.class); // Custom image supplier binding
id("serverlove-z1-man").name("Serverlove Manchester")
.apiMetadata(apiMedatada.toBuilder().version("2.0").defaultModules(modules.build()).build())
.homepage(URI.create("http://www.serverlove.com"))
.console(URI.create("http://www.serverlove.com/accounts"))
.iso3166Codes("GB-MAN")
.endpoint("https://api.z1-man.serverlove.com")
.defaultProperties(ServerloveManchesterProviderMetadata.defaultProperties());
}
@Override
@ -73,8 +80,7 @@ public class ServerloveManchesterProviderMetadata extends BaseProviderMetadata {
}
@Override
public Builder fromProviderMetadata(
ProviderMetadata in) {
public Builder fromProviderMetadata(ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}

View File

@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.serverlove.config;
import static com.google.inject.Scopes.SINGLETON;
import org.jclouds.elasticstack.suppliers.WellKnownImageSupplier;
import org.jclouds.serverlove.suppliers.FixedWellKnownImageSupplier;
import com.google.inject.AbstractModule;
/**
* Custom configuration for the Serverlove provider.
*
* @author Ignasi Barrera
*/
public class ServerloveImagesModule extends AbstractModule {
@Override
protected void configure() {
bind(WellKnownImageSupplier.class).to(FixedWellKnownImageSupplier.class).in(SINGLETON);
}
}

View File

@ -0,0 +1,67 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.serverlove.suppliers;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.IOException;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.elasticstack.domain.WellKnownImage;
import org.jclouds.elasticstack.suppliers.WellKnownImageSupplier;
import org.jclouds.json.Json;
import org.jclouds.location.Provider;
import org.jclouds.util.Strings2;
import com.google.common.base.Throwables;
import com.google.inject.TypeLiteral;
/**
* Supplies the pre-installed images.
*
* @author Ignasi Barrera
*
*/
@Singleton
public class FixedWellKnownImageSupplier implements WellKnownImageSupplier {
private final Json json;
private final String providerName;
@Inject
FixedWellKnownImageSupplier(Json json, @Provider String providerName) {
this.json = checkNotNull(json, "json");
this.providerName = checkNotNull(providerName, "providerName");
}
@Override
public List<WellKnownImage> get() {
try {
return json.fromJson(
Strings2.toStringAndClose(getClass().getResourceAsStream(
"/" + providerName + "/preinstalled_images.json")), new TypeLiteral<List<WellKnownImage>>() {
}.getType());
} catch (IOException ex) {
throw Throwables.propagate(ex);
}
}
}

View File

@ -35,4 +35,17 @@ public class ServerloveManchesterApiLiveTest extends ElasticStackApiLiveTest {
protected LoginCredentials getSshCredentials(Server server) {
return LoginCredentials.builder().user("root").password(server.getVnc().getPassword()).build();
}
@Override
@Test(enabled = false, description = "Standard drive API still not supported")
public void testListStandardDrives() throws Exception {
}
@Override
@Test(enabled = false, description = "Standard drive API still not supported")
public void testListStandardDriveInfo() throws Exception {
}
}

View File

@ -1,98 +0,0 @@
[
{
"uuid": "1cf47918-4280-4bbc-8f5f-7c7b2a0c3b3a",
"description": "CentOS 5.5 -32bit",
"osFamily": "CENTOS",
"osVersion": "5.5",
"is64bit": false,
"size": "1"
},
{
"uuid": "90aa51f2-15c0-4cff-81ee-e93aa20b9468",
"description": "CentOS 5.5 -64bit",
"osFamily": "CENTOS",
"osVersion": "5.5",
"size": "1"
},
{
"uuid": "0a4ef5e8-83d2-4b61-8fbe-0ff0232265f5",
"description": "CentOS 5.6 -32bit",
"osFamily": "CENTOS",
"osVersion": "5.6",
"is64bit": false,
"size": "1"
},
{
"uuid": "66bc99a9-dfd4-4624-948a-57784e2cc411",
"description": "CentOS 5.6 -64bit",
"osFamily": "CENTOS",
"osVersion": "5.6",
"size": "1"
},
{
"uuid": "c144d7a7-e24b-48ab-954b-6b6ec514ed6f",
"description": "Debian 5 -64bit",
"osFamily": "DEBIAN",
"osVersion": "5.0",
"size": "1"
},
{
"uuid": "0178c66a-fc5b-43c6-bec5-3315fef924d2",
"description": "Debian 5 -32bit",
"osFamily": "DEBIAN",
"osVersion": "5.0",
"is64bit": false,
"size": "1"
},
{
"uuid": "88cd1475-b6a0-4121-b9c2-97ddd652b410",
"description": "Debian 6 -64bit -Experimental",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "53e4b089-d35d-4aca-a95e-ff72774d3750",
"description": "Ubuntu Server 10.04 -64bit",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "877ea99b-7d42-4be7-9cf6-88b8daad9a8c",
"description": "Ubuntu Server 10.04 -32bit",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"is64bit": false,
"size": "1"
},
{
"uuid": "3051699a-a536-4220-aeb5-67f2ec101a09",
"description": "Ubuntu Server 10.10 -64bit",
"osFamily": "UBUNTU",
"osVersion": "10.10",
"size": "1"
},
{
"uuid": "4d5656b5-74d3-4aa0-9308-6b7377552204",
"description": "Ubuntu Server 10.10 -32bit",
"osFamily": "UBUNTU",
"osVersion": "10.10",
"is64bit": false,
"size": "1"
},
{
"uuid": "11c4c922-5ff8-4094-b06c-eb8ffaec1ea9",
"description": "Windows 2008R2 Web Edition",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "93bf390e-4f46-4252-a8bc-9d6d80e3f955",
"description": "Windows Server 2008R2 Standard",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]