From 1a51fbc8aded6f5891e450d1606c5e631667170c Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 4 Apr 2011 00:50:49 -0700 Subject: [PATCH 1/5] deltacloud now operates on rackspace --- .../ec2/predicates/InstanceStateStopped.java | 1 - .../deltacloud/domain/TransitionOnAction.java | 2 +- .../predicates/InstanceFinished.java | 48 ++++++++++++ .../predicates/InstanceRunning.java | 48 ++++++++++++ .../deltacloud/predicates/InstanceState.java | 68 +++++++++++++++++ .../deltacloud/DeltacloudClientLiveTest.java | 75 ++++++++++--------- .../ReadOnlyDeltacloudClientLiveTest.java | 11 +++ 7 files changed, 217 insertions(+), 36 deletions(-) create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java index 7137518946..5e873e7a32 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/predicates/InstanceStateStopped.java @@ -52,7 +52,6 @@ public class InstanceStateStopped implements Predicate { public boolean apply(RunningInstance instance) { logger.trace("looking for state on instance %s", instance); - instance = refresh(instance); logger.trace("%s: looking for instance state %s: currently: %s", instance.getId(), InstanceState.STOPPED, instance.getInstanceState()); diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java index 42b230961e..475f59ae6d 100644 --- a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java @@ -44,7 +44,7 @@ public class TransitionOnAction implements Transition { @Override public String toString() { - return "TransitionOnAction [action=" + action + ", to=" + to + "]"; + return "[action=" + action + ", to=" + to + "]"; } @Override diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java new file mode 100644 index 0000000000..35f81d7bb8 --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java @@ -0,0 +1,48 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.predicates; + +import javax.inject.Singleton; + +import org.jclouds.deltacloud.DeltacloudClient; +import org.jclouds.deltacloud.domain.Instance; + +import com.google.inject.Inject; + +/** + * + * Tests to see if a instance is terminated + * + * @author Adrian Cole + */ +@Singleton +public class InstanceFinished extends InstanceState { + + @Inject + public InstanceFinished(DeltacloudClient client) { + super(client); + } + + @Override + protected Instance.State getState() { + return Instance.State.FINISH; + } + +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java new file mode 100644 index 0000000000..75df4e20eb --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java @@ -0,0 +1,48 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.predicates; + +import javax.inject.Singleton; + +import org.jclouds.deltacloud.DeltacloudClient; +import org.jclouds.deltacloud.domain.Instance; + +import com.google.inject.Inject; + +/** + * + * Tests to see if a instance is running + * + * @author Adrian Cole + */ +@Singleton +public class InstanceRunning extends InstanceState { + + @Inject + public InstanceRunning(DeltacloudClient client) { + super(client); + } + + @Override + protected Instance.State getState() { + return Instance.State.RUNNING; + } + +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java new file mode 100644 index 0000000000..0dfe3b17be --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java @@ -0,0 +1,68 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.predicates; + +import static com.google.common.base.Preconditions.checkNotNull; + +import javax.annotation.Resource; +import javax.inject.Singleton; + +import org.jclouds.deltacloud.DeltacloudClient; +import org.jclouds.deltacloud.domain.Instance; +import org.jclouds.logging.Logger; + +import com.google.common.base.Predicate; +import com.google.inject.Inject; + +/** + * + * Tests to see if a instance is at a specific state + * + * @author Adrian Cole + */ +@Singleton +public abstract class InstanceState implements Predicate { + + private final DeltacloudClient client; + + @Resource + protected Logger logger = Logger.NULL; + + @Inject + public InstanceState(DeltacloudClient client) { + this.client = client; + } + + public boolean apply(Instance instance) { + logger.trace("looking for state on instance %s", checkNotNull(instance, "instance")); + instance = refresh(instance); + if (instance == null || instance.getState() == Instance.State.FINISH) + return false; + logger.trace("%s: looking for instance state %s: currently: %s", instance.getId(), getState(), instance + .getState()); + return instance.getState() == getState(); + } + + protected abstract Instance.State getState(); + + private Instance refresh(Instance instance) { + return client.getInstance(instance.getHref()); + } +} diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java index b8707df98b..508867b742 100644 --- a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java +++ b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java @@ -27,13 +27,15 @@ import java.util.logging.Logger; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.deltacloud.domain.Image; import org.jclouds.deltacloud.domain.Instance; +import org.jclouds.deltacloud.domain.PasswordAuthentication; +import org.jclouds.deltacloud.domain.Transition; +import org.jclouds.deltacloud.domain.TransitionOnAction; import org.jclouds.deltacloud.options.CreateInstanceOptions; import org.jclouds.domain.Credentials; import org.jclouds.http.HttpRequest; import org.jclouds.net.IPSocket; import org.jclouds.ssh.SshClient; import org.jclouds.ssh.jsch.config.JschSshClientModule; -import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; import com.google.common.base.Predicate; @@ -51,6 +53,7 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest { protected String prefix = System.getProperty("user.name") + ".test"; protected Instance instance; + protected Credentials creds; public void testCreateInstance() throws Exception { Logger.getAnonymousLogger().info("starting instance"); @@ -62,12 +65,13 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest { } }).getId(), CreateInstanceOptions.Builder.named(prefix)); - instance = client.getInstance(instance.getHref()); + if (instance.getAuthentication() != null && instance.getAuthentication() instanceof PasswordAuthentication) + creds = PasswordAuthentication.class.cast(instance.getAuthentication()).getLoginCredentials(); + refreshInstance(); checkStartedInstance(); Instance newInfo = client.getInstance(instance.getHref()); checkInstanceMatchesGet(newInfo); - } protected void checkInstanceMatchesGet(Instance newInfo) { @@ -77,49 +81,57 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest { protected void checkStartedInstance() { System.out.println(new Gson().toJson(instance)); assertEquals(instance.getName(), prefix); + assert stateChanges.get(Instance.State.RUNNING).apply(instance) : instance; + refreshInstance(); assertEquals(instance.getState(), Instance.State.RUNNING); } + private Instance refreshInstance() { + if (instance != null) + return instance = client.getInstance(instance.getHref()); + return null; + } + @Test(dependsOnMethods = "testCreateInstance") public void testConnectivity() throws Exception { Logger.getAnonymousLogger().info("awaiting ssh"); - // TODO - // assert socketTester.apply(new IPSocket(Iterables.get(instance.getPublicAddresses(), 0), - // 22)) : instance; - // doConnectViaSsh(instance, getSshCredentials(instance)); + assert socketTester.apply(new IPSocket(Iterables.get(instance.getPublicAddresses(), 0), 22)) : instance; + if (creds != null) { + Logger.getAnonymousLogger().info("will connect ssh"); + doConnectViaSsh(instance, creds); + } } - private Credentials getSshCredentials(Instance instance2) { - // TODO - return null; - } - - public HttpRequest refreshInstanceAndGetAction(Instance.Action action) { - return client.getInstance(instance.getHref()).getActions().get(action); + public HttpRequest getAction(Instance.Action action) { + return instance.getActions().get(action); } @Test(dependsOnMethods = "testConnectivity") public void testLifeCycle() { - client.performAction(refreshInstanceAndGetAction(Instance.Action.STOP)); - assertEquals(client.getInstance(instance.getHref()).getState(), Instance.State.STOPPED); - - client.performAction(refreshInstanceAndGetAction(Instance.Action.START)); - assertEquals(client.getInstance(instance.getHref()).getState(), Instance.State.RUNNING); - - client.performAction(refreshInstanceAndGetAction(Instance.Action.REBOOT)); - assertEquals(client.getInstance(instance.getHref()).getState(), Instance.State.RUNNING); + HttpRequest rebootUri = getAction(Instance.Action.REBOOT); + if (rebootUri != null) { + client.performAction(rebootUri); + assert stateChanges.get(Instance.State.RUNNING).apply(instance) : instance; + } } @Test(dependsOnMethods = "testLifeCycle") public void testDestroyInstance() { - try { - client.performAction(refreshInstanceAndGetAction(Instance.Action.STOP)); - assertEquals(client.getInstance(instance.getHref()).getState(), Instance.State.STOPPED); - } catch (IllegalArgumentException e) { + for (Transition transition : findChainTo(Instance.State.FINISH, refreshInstance().getState(), client + .getInstanceStates())) { + if (refreshInstance() == null) + break; + if (transition instanceof TransitionOnAction) { + client.performAction(getAction(TransitionOnAction.class.cast(transition).getAction())); + } + Predicate stateTester = stateChanges.get(transition.getTo()); + if (stateTester != null) + assert stateTester.apply(instance) : transition + " : " + instance; + else + Logger.getAnonymousLogger().warning(String.format("no state tester for: %s", transition)); } - client.performAction(refreshInstanceAndGetAction(Instance.Action.DESTROY)); - assertEquals(client.getInstance(instance.getHref()), null); + assert refreshInstance() == null; } protected void doConnectViaSsh(Instance instance, Credentials creds) throws IOException { @@ -138,14 +150,9 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest { } } - @AfterGroups(groups = "live") @Override protected void tearDown() { - try { - testDestroyInstance(); - } catch (NullPointerException e) { - // no need to check null or anything as we swallow all - } + testDestroyInstance(); super.tearDown(); } diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java index 5e5bb16a66..ac85bd2c50 100644 --- a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java +++ b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java @@ -34,6 +34,9 @@ import org.jclouds.deltacloud.domain.Image; import org.jclouds.deltacloud.domain.Instance; import org.jclouds.deltacloud.domain.Realm; import org.jclouds.deltacloud.domain.Transition; +import org.jclouds.deltacloud.domain.Instance.State; +import org.jclouds.deltacloud.predicates.InstanceFinished; +import org.jclouds.deltacloud.predicates.InstanceRunning; import org.jclouds.logging.log4j.config.Log4JLoggingModule; import org.jclouds.net.IPSocket; import org.jclouds.predicates.InetSocketAddressConnect; @@ -46,6 +49,7 @@ import org.testng.annotations.Test; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; @@ -68,6 +72,7 @@ public class ReadOnlyDeltacloudClientLiveTest { protected String endpoint; protected String apiversion; protected Predicate socketTester; + protected ImmutableMap> stateChanges; protected void setupCredentials() { identity = System.getProperty("test." + provider + ".identity", "mockuser"); @@ -99,6 +104,12 @@ public class ReadOnlyDeltacloudClientLiveTest { client = context.getApi(); socketTester = new RetryablePredicate(new InetSocketAddressConnect(), 180, 1, TimeUnit.SECONDS); + stateChanges = ImmutableMap.> of(// + Instance.State.RUNNING, new RetryablePredicate(new InstanceRunning(client), 600, 1, + TimeUnit.SECONDS),// + Instance.State.FINISH, new RetryablePredicate(new InstanceFinished(client), 30, 1, + TimeUnit.SECONDS)// + ); } @Test From fa3c226a868463acd1299ed0a03b3d23dfd5a5a6 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 4 Apr 2011 02:24:46 -0700 Subject: [PATCH 2/5] added computeservice to delta --- ...CloudServersUSTemplateBuilderLiveTest.java | 19 -- sandbox-apis/deltacloud/pom.xml | 9 +- .../deltacloud/DeltacloudAsyncClient.java | 12 +- .../jclouds/deltacloud/DeltacloudClient.java | 12 +- .../deltacloud/DeltacloudContextBuilder.java | 11 +- .../DeltacloudPropertiesBuilder.java | 2 + ...DeltacloudComputeServiceContextModule.java | 71 +++++++ .../functions/DeltacloudImageToImage.java | 52 ++++++ .../DeltacloudImageToOperatingSystem.java | 90 +++++++++ .../functions/HardwareProfileToHardware.java | 61 ++++++ .../functions/InstanceToNodeMetadata.java | 166 +++++++++++++++++ .../compute/functions/RealmToLocation.java | 62 +++++++ .../DeltacloudComputeServiceAdapter.java | 175 ++++++++++++++++++ .../options/CreateInstanceOptions.java | 33 ++++ .../deltacloud/DeltacloudClientLiveTest.java | 2 +- .../ReadOnlyDeltacloudClientLiveTest.java | 6 +- .../DeltacloudComputeServiceLiveTest.java | 88 +++++++++ .../DeltacloudTemplateBuilderLiveTest.java | 83 +++++++++ 18 files changed, 915 insertions(+), 39 deletions(-) create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java create mode 100644 sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java create mode 100644 sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java create mode 100644 sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java diff --git a/providers/cloudservers-us/src/test/java/org/jclouds/rackspace/cloudservers/compute/CloudServersUSTemplateBuilderLiveTest.java b/providers/cloudservers-us/src/test/java/org/jclouds/rackspace/cloudservers/compute/CloudServersUSTemplateBuilderLiveTest.java index 79662b2f66..337dd15933 100644 --- a/providers/cloudservers-us/src/test/java/org/jclouds/rackspace/cloudservers/compute/CloudServersUSTemplateBuilderLiveTest.java +++ b/providers/cloudservers-us/src/test/java/org/jclouds/rackspace/cloudservers/compute/CloudServersUSTemplateBuilderLiveTest.java @@ -1,22 +1,3 @@ -/** - * - * Copyright (C) 2010 Cloud Conscious, LLC. - * - * ==================================================================== - * Licensed 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.rackspace.cloudservers.compute; import static org.jclouds.compute.util.ComputeServiceUtils.getCores; diff --git a/sandbox-apis/deltacloud/pom.xml b/sandbox-apis/deltacloud/pom.xml index 11679ed9e6..033ad23fa0 100644 --- a/sandbox-apis/deltacloud/pom.xml +++ b/sandbox-apis/deltacloud/pom.xml @@ -58,7 +58,7 @@ org.jclouds - jclouds-core + jclouds-compute ${project.version} @@ -68,6 +68,13 @@ test-jar test + + org.jclouds + jclouds-compute + ${project.version} + test-jar + test + org.jclouds.driver jclouds-jsch diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java index 36f99ab9e4..83b2e197ca 100644 --- a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java @@ -84,7 +84,7 @@ public interface DeltacloudAsyncClient { @GET @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @XMLResponseParser(DeltacloudCollectionsHandler.class) - ListenableFuture> getCollections(); + ListenableFuture> getCollections(); /** * @see DeltacloudClient#getInstanceStates @@ -93,7 +93,7 @@ public interface DeltacloudAsyncClient { @Endpoint(InstanceStates.class) @ExceptionParser(ReturnEmptyMultimapOnNotFoundOr404.class) @XMLResponseParser(InstanceStatesHandler.class) - ListenableFuture> getInstanceStates(); + ListenableFuture> getInstanceStates(); /** * @see DeltacloudClient#listRealms @@ -102,7 +102,7 @@ public interface DeltacloudAsyncClient { @Endpoint(Realms.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @XMLResponseParser(RealmsHandler.class) - ListenableFuture> listRealms(); + ListenableFuture> listRealms(); /** * @see DeltacloudClient#getRealm @@ -119,7 +119,7 @@ public interface DeltacloudAsyncClient { @Endpoint(Images.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @XMLResponseParser(ImagesHandler.class) - ListenableFuture> listImages(); + ListenableFuture> listImages(); /** * @see DeltacloudClient#getImage @@ -136,7 +136,7 @@ public interface DeltacloudAsyncClient { @Endpoint(HardwareProfiles.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @XMLResponseParser(HardwareProfilesHandler.class) - ListenableFuture> listHardwareProfiles(); + ListenableFuture> listHardwareProfiles(); /** * @see DeltacloudClient#getHardwareProfile @@ -153,7 +153,7 @@ public interface DeltacloudAsyncClient { @Endpoint(Instances.class) @ExceptionParser(ReturnEmptySetOnNotFoundOr404.class) @XMLResponseParser(InstancesHandler.class) - ListenableFuture> listInstances(); + ListenableFuture> listInstances(); /** * @see DeltacloudClient#getInstance diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java index 0ad720ec60..57f68b6462 100644 --- a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java @@ -52,20 +52,20 @@ public interface DeltacloudClient { * * @return named links to available collections, or empty set, if no collections are found */ - Set getCollections(); + Set getCollections(); /** * * @return The possible states of an instance, and how to traverse between them */ - Multimap getInstanceStates(); + Multimap getInstanceStates(); /** * The realms collection will return a set of all realms available to the current user. * * @return realms viewable to the user or empty set */ - Set listRealms(); + Set listRealms(); /** * @@ -79,7 +79,7 @@ public interface DeltacloudClient { * * @return images viewable to the user or empty set */ - Set listImages(); + Set listImages(); /** * @@ -94,7 +94,7 @@ public interface DeltacloudClient { * * @return hardware profiles viewable to the user or empty set */ - Set listHardwareProfiles(); + Set listHardwareProfiles(); /** * @@ -108,7 +108,7 @@ public interface DeltacloudClient { * * @return instances viewable to the user or empty set */ - Set listInstances(); + Set listInstances(); /** * diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java index 7704c625e1..c21aed59b6 100644 --- a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java @@ -22,8 +22,9 @@ package org.jclouds.deltacloud; import java.util.List; import java.util.Properties; +import org.jclouds.compute.ComputeServiceContextBuilder; +import org.jclouds.deltacloud.compute.config.DeltacloudComputeServiceContextModule; import org.jclouds.deltacloud.config.DeltacloudRestClientModule; -import org.jclouds.rest.RestContextBuilder; import com.google.inject.Module; @@ -31,13 +32,17 @@ import com.google.inject.Module; * * @author Adrian Cole */ -public class DeltacloudContextBuilder extends - RestContextBuilder { +public class DeltacloudContextBuilder extends ComputeServiceContextBuilder { public DeltacloudContextBuilder(Properties props) { super(DeltacloudClient.class, DeltacloudAsyncClient.class, props); } + @Override + protected void addContextModule(List modules) { + modules.add(new DeltacloudComputeServiceContextModule()); + } + protected void addClientModule(List modules) { modules.add(new DeltacloudRestClientModule()); } diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java index 129c1cac12..0be8050eaf 100644 --- a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java @@ -20,6 +20,7 @@ package org.jclouds.deltacloud; import static org.jclouds.Constants.PROPERTY_API_VERSION; +import static org.jclouds.Constants.PROPERTY_ENDPOINT; import java.util.Properties; @@ -35,6 +36,7 @@ public class DeltacloudPropertiesBuilder extends PropertiesBuilder { protected Properties defaultProperties() { Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_API_VERSION, "0.3.0"); + properties.setProperty(PROPERTY_ENDPOINT, "http://localhost:3001/api"); return properties; } diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java new file mode 100644 index 0000000000..ca696e3f81 --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java @@ -0,0 +1,71 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.config; + +import org.jclouds.compute.ComputeServiceAdapter; +import org.jclouds.compute.config.ComputeServiceAdapterContextModule; +import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.deltacloud.DeltacloudAsyncClient; +import org.jclouds.deltacloud.DeltacloudClient; +import org.jclouds.deltacloud.compute.functions.DeltacloudImageToImage; +import org.jclouds.deltacloud.compute.functions.HardwareProfileToHardware; +import org.jclouds.deltacloud.compute.functions.InstanceToNodeMetadata; +import org.jclouds.deltacloud.compute.functions.RealmToLocation; +import org.jclouds.deltacloud.compute.strategy.DeltacloudComputeServiceAdapter; +import org.jclouds.deltacloud.domain.HardwareProfile; +import org.jclouds.deltacloud.domain.Instance; +import org.jclouds.deltacloud.domain.Realm; +import org.jclouds.domain.Location; +import org.jclouds.location.suppliers.OnlyLocationOrFirstZone; + +import com.google.common.base.Function; +import com.google.common.base.Supplier; +import com.google.inject.TypeLiteral; + +/** + * + * @author Adrian Cole + */ +public class DeltacloudComputeServiceContextModule + extends + ComputeServiceAdapterContextModule { + + public DeltacloudComputeServiceContextModule() { + super(DeltacloudClient.class, DeltacloudAsyncClient.class); + } + + @Override + protected void configure() { + super.configure(); + bind( + new TypeLiteral>() { + }).to(DeltacloudComputeServiceAdapter.class); + bind(new TypeLiteral>() { + }).to(InstanceToNodeMetadata.class); + bind(new TypeLiteral>() { + }).to(DeltacloudImageToImage.class); + bind(new TypeLiteral>() { + }).to(HardwareProfileToHardware.class); + bind(new TypeLiteral>() { + }).to(RealmToLocation.class); + bind(new TypeLiteral>() { + }).to(OnlyLocationOrFirstZone.class); + } +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java new file mode 100644 index 0000000000..edd28bcb1a --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java @@ -0,0 +1,52 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.functions; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.compute.domain.Image; +import org.jclouds.compute.domain.ImageBuilder; + +import com.google.common.base.Function; + +/** + * @author Adrian Cole + */ +@Singleton +public class DeltacloudImageToImage implements Function { + private final DeltacloudImageToOperatingSystem imageToOperatingSystem; + + @Inject + public DeltacloudImageToImage(DeltacloudImageToOperatingSystem imageToOperatingSystem) { + this.imageToOperatingSystem = imageToOperatingSystem; + } + + @Override + public Image apply(org.jclouds.deltacloud.domain.Image from) { + ImageBuilder builder = new ImageBuilder(); + builder.ids(from.getId()); + builder.uri(from.getHref()); + builder.name(from.getName()); + builder.description(from.getDescription()); + builder.operatingSystem(imageToOperatingSystem.apply(from)); + return builder.build(); + } +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java new file mode 100644 index 0000000000..4270a055db --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java @@ -0,0 +1,90 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.functions; + +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.annotation.Resource; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import org.jclouds.compute.domain.OperatingSystem; +import org.jclouds.compute.domain.OsFamily; +import org.jclouds.compute.reference.ComputeServiceConstants; +import org.jclouds.compute.util.ComputeServiceUtils; +import org.jclouds.logging.Logger; + +import com.google.common.base.Function; + +/** + * @author Adrian Cole + */ +@Singleton +public class DeltacloudImageToOperatingSystem implements Function { + public static final Pattern DEFAULT_PATTERN = Pattern.compile("(([^ ]*) ([0-9.]+) ?.*)"); + // Windows Server 2008 R2 x64 + public static final Pattern WINDOWS_PATTERN = Pattern.compile("Windows (.*) (x[86][64])"); + + @Resource + @Named(ComputeServiceConstants.COMPUTE_LOGGER) + protected Logger logger = Logger.NULL; + + private final Map> osVersionMap; + + @Inject + public DeltacloudImageToOperatingSystem(Map> osVersionMap) { + this.osVersionMap = osVersionMap; + } + + public OperatingSystem apply(org.jclouds.deltacloud.domain.Image from) { + OsFamily osFamily = null; + String osName = null; + String osArch = null; + String osVersion = null; + String osDescription = from.getName(); + boolean is64Bit = true; + if (from.getName().indexOf("Red Hat EL") != -1) { + osFamily = OsFamily.RHEL; + } else if (from.getName().indexOf("Oracle EL") != -1) { + osFamily = OsFamily.OEL; + } else if (from.getName().indexOf("Windows") != -1) { + osFamily = OsFamily.WINDOWS; + Matcher matcher = WINDOWS_PATTERN.matcher(from.getName()); + if (matcher.find()) { + osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(1), osVersionMap); + is64Bit = matcher.group(2).equals("x64"); + } + } else { + Matcher matcher = DEFAULT_PATTERN.matcher(from.getName()); + if (matcher.find()) { + try { + osFamily = OsFamily.fromValue(matcher.group(2).toLowerCase()); + } catch (IllegalArgumentException e) { + logger.debug("<< didn't match os(%s)", matcher.group(2)); + } + osVersion = ComputeServiceUtils.parseVersionOrReturnEmptyString(osFamily, matcher.group(3), osVersionMap); + } + } + return new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit); + } +} \ No newline at end of file diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java new file mode 100644 index 0000000000..992dbf5505 --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java @@ -0,0 +1,61 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.functions; + +import javax.inject.Singleton; + +import org.jclouds.compute.domain.Hardware; +import org.jclouds.compute.domain.HardwareBuilder; +import org.jclouds.compute.domain.Processor; +import org.jclouds.compute.domain.Volume; +import org.jclouds.compute.domain.VolumeBuilder; +import org.jclouds.deltacloud.domain.HardwareProfile; +import org.jclouds.deltacloud.domain.HardwareProperty; + +import com.google.common.base.Function; +import com.google.common.collect.ImmutableList; + +/** + * @author Adrian Cole + */ +@Singleton +public class HardwareProfileToHardware implements Function { + + @Override + public Hardware apply(HardwareProfile from) { + HardwareBuilder builder = new HardwareBuilder(); + builder.ids(from.getId()); + builder.name(from.getName()); + builder.uri(from.getHref()); + + for (HardwareProperty property : from.getProperties()) { + if (property.getName().equals("memory")) { + builder.ram(Integer.parseInt(property.getValue().toString())); + } else if (property.getName().equals("storage")) { + Float gigs = new Float(property.getValue().toString()); + builder.processors(ImmutableList.of(new Processor(gigs / 10.0, 1.0))); + builder.volume(new VolumeBuilder().type(Volume.Type.LOCAL).device("/").size(gigs).bootDevice(true).durable( + true).build()); + } + } + + return builder.build(); + } +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java new file mode 100644 index 0000000000..efa3e4c9fc --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java @@ -0,0 +1,166 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.functions; + +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.compute.util.ComputeServiceUtils.parseGroupFromName; + +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Set; + +import javax.annotation.Resource; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import org.jclouds.collect.Memoized; +import org.jclouds.compute.domain.Hardware; +import org.jclouds.compute.domain.Image; +import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.compute.domain.NodeMetadataBuilder; +import org.jclouds.compute.domain.NodeState; +import org.jclouds.compute.domain.OperatingSystem; +import org.jclouds.compute.reference.ComputeServiceConstants; +import org.jclouds.deltacloud.domain.Instance; +import org.jclouds.domain.Credentials; +import org.jclouds.domain.Location; +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.collect.ImmutableMap; +import com.google.common.collect.Iterables; + +/** + * @author Adrian Cole + */ +@Singleton +public class InstanceToNodeMetadata implements Function { + + public static final Map instanceToNodeState = ImmutableMap + . builder().put(Instance.State.STOPPED, NodeState.SUSPENDED).put( + Instance.State.RUNNING, NodeState.RUNNING).put(Instance.State.PENDING, NodeState.PENDING).put( + Instance.State.UNRECOGNIZED, NodeState.UNRECOGNIZED).put(Instance.State.SHUTTING_DOWN, + NodeState.PENDING).put(Instance.State.START, NodeState.PENDING).build(); + + @Resource + @Named(ComputeServiceConstants.COMPUTE_LOGGER) + protected Logger logger = Logger.NULL; + + protected final Map credentialStore; + protected final Supplier> locations; + protected final Supplier> images; + protected final Supplier> hardwares; + + private static class FindImageForInstance implements Predicate { + private final Instance instance; + + private FindImageForInstance(Instance instance) { + this.instance = instance; + } + + @Override + public boolean apply(Image input) { + return input.getUri().equals(instance.getImage()); + } + } + + private static class FindHardwareForInstance implements Predicate { + private final Instance instance; + + private FindHardwareForInstance(Instance instance) { + this.instance = instance; + } + + @Override + public boolean apply(Hardware input) { + return input.getUri().equals(instance.getHardwareProfile()); + } + } + + protected Hardware parseHardware(Instance from) { + try { + return Iterables.find(hardwares.get(), new FindHardwareForInstance(from)); + } catch (NoSuchElementException e) { + logger.warn("could not find a matching hardware for instance %s", from); + } + return null; + } + + protected OperatingSystem parseOperatingSystem(Instance from) { + try { + return Iterables.find(images.get(), new FindImageForInstance(from)).getOperatingSystem(); + } catch (NoSuchElementException e) { + logger.warn("could not find a matching image for instance %s", from); + } + return null; + } + + private static class FindLocationForInstance implements Predicate { + private final Instance instance; + + private FindLocationForInstance(Instance instance) { + this.instance = instance; + } + + @Override + public boolean apply(Location input) { + return input.getId().equals(instance.getRealm().toASCIIString()); + } + } + + protected Location parseLocation(Instance from) { + try { + return Iterables.find(locations.get(), new FindLocationForInstance(from)); + } catch (NoSuchElementException e) { + logger.warn("could not find a matching realm for instance %s", from); + } + return null; + } + + @Inject + InstanceToNodeMetadata(Map credentialStore, + @Memoized Supplier> locations, @Memoized Supplier> images, + @Memoized Supplier> hardwares) { + this.credentialStore = checkNotNull(credentialStore, "credentialStore"); + this.images = checkNotNull(images, "images"); + this.locations = checkNotNull(locations, "locations"); + this.hardwares = checkNotNull(hardwares, "hardwares"); + } + + @Override + public NodeMetadata apply(org.jclouds.deltacloud.domain.Instance from) { + NodeMetadataBuilder builder = new NodeMetadataBuilder(); + builder.ids(from.getHref().toASCIIString()); + builder.name(from.getName()); + builder.location(parseLocation(from)); + builder.group(parseGroupFromName(from.getName())); + builder.imageId(from.getImage().toASCIIString()); + builder.operatingSystem(parseOperatingSystem(from)); + builder.hardware(parseHardware(from)); + builder.state(instanceToNodeState.get(from.getState())); + builder.publicAddresses(from.getPublicAddresses()); + builder.privateAddresses(from.getPrivateAddresses()); + builder.credentials(credentialStore.get(from.getHref().toASCIIString())); + return builder.build(); + } +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java new file mode 100644 index 0000000000..55685fde2b --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java @@ -0,0 +1,62 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.functions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Set; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.deltacloud.domain.Realm; +import org.jclouds.domain.Location; +import org.jclouds.domain.LocationBuilder; +import org.jclouds.domain.LocationScope; +import org.jclouds.location.Iso3166; +import org.jclouds.location.Provider; + +import com.google.common.base.Function; + +/** + * @author Adrian Cole + */ +@Singleton +public class RealmToLocation implements Function { + + private final String providerName; + private final URI endpoint; + private final Set isoCodes; + + @Inject + public RealmToLocation(@Iso3166 Set isoCodes, @Provider String providerName, @Provider URI endpoint) { + this.providerName = checkNotNull(providerName, "providerName"); + this.endpoint = checkNotNull(endpoint, "endpoint"); + this.isoCodes = checkNotNull(isoCodes, "isoCodes"); + } + + @Override + public Location apply(Realm from) { + return new LocationBuilder().scope(LocationScope.ZONE).id(from.getHref().toASCIIString()).description(from.getName()).parent( + new LocationBuilder().scope(LocationScope.PROVIDER).iso3166Codes(isoCodes).id(providerName).description( + endpoint.toASCIIString()).parent(null).build()).build(); + } +} diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java new file mode 100644 index 0000000000..b03a7612b5 --- /dev/null +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java @@ -0,0 +1,175 @@ +/** + * + * Copyright (C) 2011 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute.strategy; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import javax.annotation.Resource; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +import org.jclouds.compute.ComputeService; +import org.jclouds.compute.ComputeServiceAdapter; +import org.jclouds.compute.domain.Template; +import org.jclouds.compute.reference.ComputeServiceConstants; +import org.jclouds.deltacloud.DeltacloudClient; +import org.jclouds.deltacloud.domain.HardwareProfile; +import org.jclouds.deltacloud.domain.Instance; +import org.jclouds.deltacloud.domain.PasswordAuthentication; +import org.jclouds.deltacloud.domain.Realm; +import org.jclouds.deltacloud.domain.Transition; +import org.jclouds.deltacloud.domain.TransitionOnAction; +import org.jclouds.deltacloud.domain.Instance.State; +import org.jclouds.deltacloud.options.CreateInstanceOptions; +import org.jclouds.deltacloud.predicates.InstanceFinished; +import org.jclouds.deltacloud.predicates.InstanceRunning; +import org.jclouds.domain.Credentials; +import org.jclouds.http.HttpRequest; +import org.jclouds.logging.Logger; +import org.jclouds.predicates.RetryablePredicate; + +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multimap; + +/** + * defines the connection between the {@link DeltacloudClient} implementation and the jclouds + * {@link ComputeService} + * + */ +@Singleton +public class DeltacloudComputeServiceAdapter implements + ComputeServiceAdapter { + @Resource + @Named(ComputeServiceConstants.COMPUTE_LOGGER) + protected Logger logger = Logger.NULL; + + private final org.jclouds.deltacloud.DeltacloudClient client; + private final ImmutableMap> stateChanges; + + @Inject + public DeltacloudComputeServiceAdapter(DeltacloudClient client) { + this.client = checkNotNull(client, "client"); + // TODO: parameterize + stateChanges = ImmutableMap.> of(// + Instance.State.RUNNING, new RetryablePredicate(new InstanceRunning(client), 600, 1, + TimeUnit.SECONDS),// + Instance.State.FINISH, new RetryablePredicate(new InstanceFinished(client), 30, 1, + TimeUnit.SECONDS)// + ); + } + + @Override + public Instance createNodeWithGroupEncodedIntoNameThenStoreCredentials(String tag, String name, Template template, + Map credentialStore) { + Instance instance = client.createInstance(template.getImage().getId(), CreateInstanceOptions.Builder.named(name) + .hardwareProfile(template.getHardware().getId()).realm(template.getLocation().getId())); + if (instance.getAuthentication() != null && instance.getAuthentication() instanceof PasswordAuthentication) { + Credentials creds = PasswordAuthentication.class.cast(instance.getAuthentication()).getLoginCredentials(); + // store the credentials so that later functions can use them + credentialStore.put(instance.getHref().toASCIIString(), creds); + } + return instance; + } + + @Override + public Iterable listHardwareProfiles() { + return client.listHardwareProfiles(); + } + + @Override + public Iterable listImages() { + return client.listImages(); + } + + @Override + public Iterable listNodes() { + return client.listInstances(); + } + + @Override + public Iterable listLocations() { + return client.listRealms(); + } + + @Override + public org.jclouds.deltacloud.domain.Instance getNode(String id) { + return client.getInstance(URI.create(checkNotNull(id, "id"))); + } + + @Override + public void destroyNode(String id) { + Instance instance = getNode(id); + for (Transition transition : findChainTo(Instance.State.FINISH, instance.getState(), client.getInstanceStates())) { + instance = getNode(id); + if (instance == null) + break; + if (transition instanceof TransitionOnAction) { + client.performAction(instance.getActions().get(TransitionOnAction.class.cast(transition).getAction())); + } + Predicate stateTester = stateChanges.get(transition.getTo()); + if (stateTester != null) + stateTester.apply(instance); + else + logger.debug(String.format("no state tester for: %s", transition)); + } + } + + Iterable findChainTo(Instance.State desired, Instance.State currentState, + Multimap states) { + for (Transition transition : states.get(currentState)) { + if (currentState.ordinal() >= transition.getTo().ordinal()) + continue; + if (transition.getTo() == desired) + return ImmutableSet. of(transition); + Iterable transitions = findChainTo(desired, transition.getTo(), states); + if (Iterables.size(transitions) > 0) + return Iterables.concat(ImmutableSet.of(transition), transitions); + } + return ImmutableSet. of(); + } + + @Override + public void rebootNode(String id) { + HttpRequest rebootUri = getNode(id).getActions().get(Instance.Action.REBOOT); + if (rebootUri != null) { + client.performAction(rebootUri); + } else { + throw new UnsupportedOperationException(); + } + } + + @Override + public void resumeNode(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public void suspendNode(String id) { + throw new UnsupportedOperationException(); + } +} \ No newline at end of file diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java index 25a1a92eb8..5b0f00f251 100644 --- a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java +++ b/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java @@ -32,6 +32,23 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions { return this; } + /** + * The realm in which to launch the instance + * + */ + public CreateInstanceOptions realm(String realmId) { + formParameters.put("realm_id", checkNotNull(realmId, "realmId")); + return this; + } + + /** + * The hardware profile upon which to launch the instance + */ + public CreateInstanceOptions hardwareProfile(String hwpName) { + formParameters.put("hwp_name", checkNotNull(hwpName, "hwpName")); + return this; + } + public String getName() { return this.getFirstFormOrNull("name"); } @@ -46,5 +63,21 @@ public class CreateInstanceOptions extends BaseHttpRequestOptions { return options.named(name); } + /** + * @see CreateInstanceOptions#realm + */ + public static CreateInstanceOptions realm(String realmId) { + CreateInstanceOptions options = new CreateInstanceOptions(); + return options.realm(realmId); + } + + /** + * @see CreateInstanceOptions#hardwareProfile + */ + public static CreateInstanceOptions hardwareProfile(String hwpName) { + CreateInstanceOptions options = new CreateInstanceOptions(); + return options.hardwareProfile(hwpName); + } + } } diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java index 508867b742..6e5a35ebfa 100644 --- a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java +++ b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java @@ -64,7 +64,7 @@ public class DeltacloudClientLiveTest extends ReadOnlyDeltacloudClientLiveTest { return input.getDescription().toLowerCase().indexOf("fedora") != -1; } - }).getId(), CreateInstanceOptions.Builder.named(prefix)); + }).getId(), CreateInstanceOptions.Builder.named(prefix).hardwareProfile("1").realm("us")); if (instance.getAuthentication() != null && instance.getAuthentication() instanceof PasswordAuthentication) creds = PasswordAuthentication.class.cast(instance.getAuthentication()).getLoginCredentials(); refreshInstance(); diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java index ac85bd2c50..02a8e3bb69 100644 --- a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java +++ b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java @@ -28,6 +28,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import org.jclouds.Constants; +import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.deltacloud.domain.DeltacloudCollection; import org.jclouds.deltacloud.domain.HardwareProfile; import org.jclouds.deltacloud.domain.Image; @@ -42,7 +43,6 @@ import org.jclouds.net.IPSocket; import org.jclouds.predicates.InetSocketAddressConnect; import org.jclouds.predicates.RetryablePredicate; import org.jclouds.rest.RestContext; -import org.jclouds.rest.RestContextFactory; import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -99,8 +99,8 @@ public class ReadOnlyDeltacloudClientLiveTest { public void setupClient() { setupCredentials(); Properties overrides = setupProperties(); - context = new RestContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule()), - overrides); + context = new ComputeServiceContextFactory().createContext(provider, ImmutableSet. of(new Log4JLoggingModule()), + overrides).getProviderSpecificContext(); client = context.getApi(); socketTester = new RetryablePredicate(new InetSocketAddressConnect(), 180, 1, TimeUnit.SECONDS); diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java new file mode 100644 index 0000000000..822318cb6e --- /dev/null +++ b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java @@ -0,0 +1,88 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute; + +import static org.testng.Assert.assertEquals; + +import java.io.IOException; + +import org.jclouds.compute.BaseComputeServiceLiveTest; +import org.jclouds.compute.ComputeServiceContextFactory; +import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.deltacloud.DeltacloudAsyncClient; +import org.jclouds.deltacloud.DeltacloudClient; +import org.jclouds.domain.LocationScope; +import org.jclouds.rest.RestContext; +import org.jclouds.ssh.jsch.config.JschSshClientModule; +import org.testng.annotations.Test; + +/** + * + * + * @author Adrian Cole + */ +@Test(groups = "live", enabled = true, sequential = true) +public class DeltacloudComputeServiceLiveTest extends BaseComputeServiceLiveTest { + public DeltacloudComputeServiceLiveTest() { + provider = "deltacloud"; + } + + @Override + protected JschSshClientModule getSshModule() { + return new JschSshClientModule(); + } + + public void testAssignability() throws Exception { + @SuppressWarnings("unused") + RestContext tmContext = new ComputeServiceContextFactory() + .createContext(provider, identity, credential).getProviderSpecificContext(); + } + + @Override + protected void checkNodes(Iterable nodes, String tag) throws IOException { + super.checkNodes(nodes, tag); + for (NodeMetadata node : nodes) { + assertEquals(node.getLocation().getScope(), LocationScope.HOST); + } + } + + @Test(enabled = true, dependsOnMethods = "testReboot", expectedExceptions = UnsupportedOperationException.class) + public void testSuspendResume() throws Exception { + super.testSuspendResume(); + } + + @Test(enabled = true, dependsOnMethods = "testSuspendResume") + @Override + public void testGetNodesWithDetails() throws Exception { + super.testGetNodesWithDetails(); + } + + @Test(enabled = true, dependsOnMethods = "testSuspendResume") + @Override + public void testListNodes() throws Exception { + super.testListNodes(); + } + + @Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails" }) + @Override + public void testDestroyNodes() { + super.testDestroyNodes(); + } +} diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java new file mode 100644 index 0000000000..a6e4b76805 --- /dev/null +++ b/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java @@ -0,0 +1,83 @@ +/** + * + * Copyright (C) 2010 Cloud Conscious, LLC. + * + * ==================================================================== + * Licensed 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.deltacloud.compute; + +import static org.jclouds.compute.util.ComputeServiceUtils.getCores; +import static org.testng.Assert.assertEquals; + +import java.util.Set; + +import org.jclouds.compute.BaseTemplateBuilderLiveTest; +import org.jclouds.compute.domain.OsFamily; +import org.jclouds.compute.domain.OsFamilyVersion64Bit; +import org.jclouds.compute.domain.Template; +import org.testng.annotations.Test; + +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableSet; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live") +public class DeltacloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { + + public DeltacloudTemplateBuilderLiveTest() { + provider = "deltacloud"; + } + + @Override + protected Predicate defineUnsupportedOperatingSystems() { + return new Predicate() { + + @Override + public boolean apply(OsFamilyVersion64Bit input) { + switch (input.family) { + case UBUNTU: + return input.version.equals("11.04") || input.version.equals("8.04") || !input.is64Bit; + case CENTOS: + return input.version.matches("5.[023]") || !input.is64Bit; + case WINDOWS: + return input.version.equals("2008") || input.version.indexOf("2003") != -1 + || (input.version.equals("2008 R2") && !input.is64Bit); + default: + return true; + } + } + + }; + } + + @Test + public void testTemplateBuilder() { + Template defaultTemplate = this.context.getComputeService().templateBuilder().build(); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04"); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(defaultTemplate.getLocation().getId(), "us"); + assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); + } + + @Override + protected Set getIso3166Codes() { + return ImmutableSet. of(); + } +} From d169658c655f66d27c31eb26122789a2181cf482 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 4 Apr 2011 03:09:36 -0700 Subject: [PATCH 3/5] Issue 427:support deltacloud endpoints --- README.txt | 2 +- allcompute/pom.xml | 5 +++++ {sandbox-apis => apis}/deltacloud/README.txt | 0 {sandbox-apis => apis}/deltacloud/pom.xml | 0 .../java/org/jclouds/deltacloud/DeltacloudAsyncClient.java | 0 .../main/java/org/jclouds/deltacloud/DeltacloudClient.java | 0 .../org/jclouds/deltacloud/DeltacloudContextBuilder.java | 0 .../org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java | 0 .../org/jclouds/deltacloud/collections/HardwareProfiles.java | 0 .../main/java/org/jclouds/deltacloud/collections/Images.java | 0 .../org/jclouds/deltacloud/collections/InstanceStates.java | 0 .../java/org/jclouds/deltacloud/collections/Instances.java | 0 .../main/java/org/jclouds/deltacloud/collections/Realms.java | 0 .../config/DeltacloudComputeServiceContextModule.java | 0 .../deltacloud/compute/functions/DeltacloudImageToImage.java | 0 .../compute/functions/DeltacloudImageToOperatingSystem.java | 0 .../compute/functions/HardwareProfileToHardware.java | 0 .../deltacloud/compute/functions/InstanceToNodeMetadata.java | 0 .../deltacloud/compute/functions/RealmToLocation.java | 0 .../compute/strategy/DeltacloudComputeServiceAdapter.java | 0 .../deltacloud/config/DeltacloudRestClientModule.java | 0 .../java/org/jclouds/deltacloud/domain/Architecture.java | 0 .../org/jclouds/deltacloud/domain/DeltacloudCollection.java | 0 .../org/jclouds/deltacloud/domain/EnumHardwareProperty.java | 0 .../src/main/java/org/jclouds/deltacloud/domain/Feature.java | 0 .../org/jclouds/deltacloud/domain/FixedHardwareProperty.java | 0 .../org/jclouds/deltacloud/domain/HardwareParameter.java | 0 .../java/org/jclouds/deltacloud/domain/HardwareProfile.java | 0 .../java/org/jclouds/deltacloud/domain/HardwareProperty.java | 0 .../src/main/java/org/jclouds/deltacloud/domain/Image.java | 0 .../main/java/org/jclouds/deltacloud/domain/Instance.java | 0 .../org/jclouds/deltacloud/domain/KeyAuthentication.java | 0 .../deltacloud/domain/ParameterizedHardwareProperty.java | 0 .../jclouds/deltacloud/domain/PasswordAuthentication.java | 0 .../org/jclouds/deltacloud/domain/RangeHardwareProperty.java | 0 .../src/main/java/org/jclouds/deltacloud/domain/Realm.java | 0 .../main/java/org/jclouds/deltacloud/domain/Transition.java | 0 .../jclouds/deltacloud/domain/TransitionAutomatically.java | 0 .../org/jclouds/deltacloud/domain/TransitionOnAction.java | 0 .../deltacloud/domain/internal/BaseHardwareProperty.java | 0 .../deltacloud/functions/ReturnVoidOnRedirectedDelete.java | 0 .../jclouds/deltacloud/handlers/DeltacloudErrorHandler.java | 0 .../handlers/DeltacloudRedirectionRetryHandler.java | 0 .../jclouds/deltacloud/options/CreateInstanceOptions.java | 0 .../org/jclouds/deltacloud/predicates/InstanceFinished.java | 0 .../org/jclouds/deltacloud/predicates/InstanceRunning.java | 0 .../org/jclouds/deltacloud/predicates/InstanceState.java | 0 .../jclouds/deltacloud/xml/DeltacloudCollectionHandler.java | 0 .../jclouds/deltacloud/xml/DeltacloudCollectionsHandler.java | 0 .../org/jclouds/deltacloud/xml/HardwareProfileHandler.java | 0 .../org/jclouds/deltacloud/xml/HardwareProfilesHandler.java | 0 .../org/jclouds/deltacloud/xml/HardwarePropertyHandler.java | 0 .../main/java/org/jclouds/deltacloud/xml/ImageHandler.java | 0 .../main/java/org/jclouds/deltacloud/xml/ImagesHandler.java | 0 .../java/org/jclouds/deltacloud/xml/InstanceHandler.java | 0 .../org/jclouds/deltacloud/xml/InstanceStatesHandler.java | 0 .../java/org/jclouds/deltacloud/xml/InstancesHandler.java | 0 .../main/java/org/jclouds/deltacloud/xml/RealmHandler.java | 0 .../main/java/org/jclouds/deltacloud/xml/RealmsHandler.java | 0 .../org/jclouds/deltacloud/DeltacloudAsyncClientTest.java | 0 .../org/jclouds/deltacloud/DeltacloudClientLiveTest.java | 0 .../jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java | 0 .../deltacloud/compute/DeltacloudComputeServiceLiveTest.java | 2 +- .../compute/DeltacloudTemplateBuilderLiveTest.java | 0 .../deltacloud/handlers/DeltacloudErrorHandlerTest.java | 0 .../handlers/DeltacloudRedirectionRetryHandlerTest.java | 0 .../deltacloud/options/CreateInstanceOptionsTest.java | 0 .../deltacloud/xml/DeltacloudCollectionsHandlerTest.java | 0 .../jclouds/deltacloud/xml/HardwareProfileHandlerTest.java | 0 .../jclouds/deltacloud/xml/HardwareProfilesHandlerTest.java | 0 .../java/org/jclouds/deltacloud/xml/ImageHandlerTest.java | 0 .../java/org/jclouds/deltacloud/xml/ImagesHandlerTest.java | 0 .../java/org/jclouds/deltacloud/xml/InstanceHandlerTest.java | 0 .../jclouds/deltacloud/xml/InstanceStatesHandlerTest.java | 0 .../org/jclouds/deltacloud/xml/InstancesHandlerTest.java | 0 .../java/org/jclouds/deltacloud/xml/RealmHandlerTest.java | 0 .../java/org/jclouds/deltacloud/xml/RealmsHandlerTest.java | 0 .../deltacloud/src/test/resources/links.xml | 0 .../deltacloud/src/test/resources/log4j.xml | 0 .../src/test/resources/test_get_hardware_profile.xml | 0 .../deltacloud/src/test/resources/test_get_image.xml | 0 .../deltacloud/src/test/resources/test_get_instance.xml | 0 .../deltacloud/src/test/resources/test_get_instance_key.xml | 0 .../src/test/resources/test_get_instance_nokey.xml | 0 .../deltacloud/src/test/resources/test_get_instance_pw.xml | 0 .../deltacloud/src/test/resources/test_get_realm.xml | 0 .../deltacloud/src/test/resources/test_get_states.xml | 0 .../src/test/resources/test_list_hardware_profiles.xml | 0 .../deltacloud/src/test/resources/test_list_images.xml | 0 .../deltacloud/src/test/resources/test_list_instances.xml | 0 .../deltacloud/src/test/resources/test_list_realms.xml | 0 apis/pom.xml | 1 + compute/src/main/clojure/org/jclouds/compute.clj | 2 +- .../java/org/jclouds/compute/BaseComputeServiceLiveTest.java | 5 ++--- compute/src/test/java/org/jclouds/compute/RunScriptData.java | 4 ++-- compute/src/test/resources/initscript_with_jboss.sh | 2 +- 96 files changed, 14 insertions(+), 9 deletions(-) rename {sandbox-apis => apis}/deltacloud/README.txt (100%) rename {sandbox-apis => apis}/deltacloud/pom.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/collections/HardwareProfiles.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Images.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/collections/InstanceStates.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Instances.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Realms.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/config/DeltacloudRestClientModule.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Architecture.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/DeltacloudCollection.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/EnumHardwareProperty.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Feature.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/FixedHardwareProperty.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareParameter.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProfile.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProperty.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Image.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Instance.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/KeyAuthentication.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/ParameterizedHardwareProperty.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/PasswordAuthentication.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/RangeHardwareProperty.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Realm.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Transition.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionAutomatically.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/domain/internal/BaseHardwareProperty.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/functions/ReturnVoidOnRedirectedDelete.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfileHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfilesHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwarePropertyHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImageHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImagesHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceStatesHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstancesHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmsHandler.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudAsyncClientTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java (99%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/options/CreateInstanceOptionsTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfileHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfilesHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImageHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImagesHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceStatesHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstancesHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmsHandlerTest.java (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/links.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/log4j.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_hardware_profile.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_image.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_instance.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_instance_key.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_instance_nokey.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_instance_pw.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_realm.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_get_states.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_list_hardware_profiles.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_list_images.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_list_instances.xml (100%) rename {sandbox-apis => apis}/deltacloud/src/test/resources/test_list_realms.xml (100%) diff --git a/README.txt b/README.txt index a146e4f169..5eae26689a 100644 --- a/README.txt +++ b/README.txt @@ -10,7 +10,7 @@ data. our current version is 1.0-beta-9b our dev version is 1.0-SNAPSHOT -our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory), +our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory), deltacloud, cloudservers-uk, vcloud (generic), ec2 (generic), byon, trmk-ecloud, trmk-vcloudexpress, eucalyptus (generic), cloudsigma-zrh, elasticstack(generic), bluelock-vclouddirector, diff --git a/allcompute/pom.xml b/allcompute/pom.xml index 9e145f8790..06be1cbc40 100644 --- a/allcompute/pom.xml +++ b/allcompute/pom.xml @@ -34,6 +34,11 @@ eucalyptus-partnercloud-ec2 ${project.version} + + org.jclouds.api + deltacloud + ${project.version} + org.jclouds.provider aws-ec2 diff --git a/sandbox-apis/deltacloud/README.txt b/apis/deltacloud/README.txt similarity index 100% rename from sandbox-apis/deltacloud/README.txt rename to apis/deltacloud/README.txt diff --git a/sandbox-apis/deltacloud/pom.xml b/apis/deltacloud/pom.xml similarity index 100% rename from sandbox-apis/deltacloud/pom.xml rename to apis/deltacloud/pom.xml diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudAsyncClient.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudClient.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudContextBuilder.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/DeltacloudPropertiesBuilder.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/HardwareProfiles.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/HardwareProfiles.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/HardwareProfiles.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/HardwareProfiles.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Images.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Images.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Images.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Images.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/InstanceStates.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/InstanceStates.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/InstanceStates.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/InstanceStates.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Instances.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Instances.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Instances.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Instances.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Realms.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Realms.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Realms.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/collections/Realms.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/config/DeltacloudComputeServiceContextModule.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToOperatingSystem.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/HardwareProfileToHardware.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/InstanceToNodeMetadata.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/RealmToLocation.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/strategy/DeltacloudComputeServiceAdapter.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/config/DeltacloudRestClientModule.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/config/DeltacloudRestClientModule.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/config/DeltacloudRestClientModule.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/config/DeltacloudRestClientModule.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Architecture.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Architecture.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Architecture.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Architecture.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/DeltacloudCollection.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/DeltacloudCollection.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/DeltacloudCollection.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/DeltacloudCollection.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/EnumHardwareProperty.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/EnumHardwareProperty.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/EnumHardwareProperty.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/EnumHardwareProperty.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Feature.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Feature.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Feature.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Feature.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/FixedHardwareProperty.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/FixedHardwareProperty.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/FixedHardwareProperty.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/FixedHardwareProperty.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareParameter.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareParameter.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareParameter.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareParameter.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProfile.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProfile.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProfile.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProfile.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProperty.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProperty.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProperty.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/HardwareProperty.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Image.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Image.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Image.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Image.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Instance.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Instance.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Instance.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Instance.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/KeyAuthentication.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/KeyAuthentication.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/KeyAuthentication.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/KeyAuthentication.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/ParameterizedHardwareProperty.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/ParameterizedHardwareProperty.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/ParameterizedHardwareProperty.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/ParameterizedHardwareProperty.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/PasswordAuthentication.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/PasswordAuthentication.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/PasswordAuthentication.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/PasswordAuthentication.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/RangeHardwareProperty.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/RangeHardwareProperty.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/RangeHardwareProperty.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/RangeHardwareProperty.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Realm.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Realm.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Realm.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Realm.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Transition.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Transition.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Transition.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/Transition.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionAutomatically.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionAutomatically.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionAutomatically.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionAutomatically.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/TransitionOnAction.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/internal/BaseHardwareProperty.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/internal/BaseHardwareProperty.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/internal/BaseHardwareProperty.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/domain/internal/BaseHardwareProperty.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/functions/ReturnVoidOnRedirectedDelete.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/functions/ReturnVoidOnRedirectedDelete.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/functions/ReturnVoidOnRedirectedDelete.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/functions/ReturnVoidOnRedirectedDelete.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/options/CreateInstanceOptions.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceFinished.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceRunning.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/predicates/InstanceState.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfileHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfileHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfileHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfileHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfilesHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfilesHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfilesHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwareProfilesHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwarePropertyHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwarePropertyHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwarePropertyHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/HardwarePropertyHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImageHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImageHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImageHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImageHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImagesHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImagesHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImagesHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/ImagesHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceStatesHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceStatesHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceStatesHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstanceStatesHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstancesHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstancesHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstancesHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/InstancesHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmHandler.java diff --git a/sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmsHandler.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmsHandler.java similarity index 100% rename from sandbox-apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmsHandler.java rename to apis/deltacloud/src/main/java/org/jclouds/deltacloud/xml/RealmsHandler.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudAsyncClientTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudAsyncClientTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudAsyncClientTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudAsyncClientTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/DeltacloudClientLiveTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/ReadOnlyDeltacloudClientLiveTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java similarity index 99% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java index 822318cb6e..f6c4b4b2dd 100644 --- a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java +++ b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudComputeServiceLiveTest.java @@ -59,7 +59,7 @@ public class DeltacloudComputeServiceLiveTest extends BaseComputeServiceLiveTest protected void checkNodes(Iterable nodes, String tag) throws IOException { super.checkNodes(nodes, tag); for (NodeMetadata node : nodes) { - assertEquals(node.getLocation().getScope(), LocationScope.HOST); + assertEquals(node.getLocation().getScope(), LocationScope.ZONE); } } diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudErrorHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/handlers/DeltacloudRedirectionRetryHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/options/CreateInstanceOptionsTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/options/CreateInstanceOptionsTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/options/CreateInstanceOptionsTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/options/CreateInstanceOptionsTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/DeltacloudCollectionsHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfileHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfileHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfileHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfileHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfilesHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfilesHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfilesHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/HardwareProfilesHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImageHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImageHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImageHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImageHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImagesHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImagesHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImagesHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/ImagesHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceStatesHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceStatesHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceStatesHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstanceStatesHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstancesHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstancesHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstancesHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/InstancesHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmsHandlerTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmsHandlerTest.java similarity index 100% rename from sandbox-apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmsHandlerTest.java rename to apis/deltacloud/src/test/java/org/jclouds/deltacloud/xml/RealmsHandlerTest.java diff --git a/sandbox-apis/deltacloud/src/test/resources/links.xml b/apis/deltacloud/src/test/resources/links.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/links.xml rename to apis/deltacloud/src/test/resources/links.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/log4j.xml b/apis/deltacloud/src/test/resources/log4j.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/log4j.xml rename to apis/deltacloud/src/test/resources/log4j.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_hardware_profile.xml b/apis/deltacloud/src/test/resources/test_get_hardware_profile.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_hardware_profile.xml rename to apis/deltacloud/src/test/resources/test_get_hardware_profile.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_image.xml b/apis/deltacloud/src/test/resources/test_get_image.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_image.xml rename to apis/deltacloud/src/test/resources/test_get_image.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_instance.xml b/apis/deltacloud/src/test/resources/test_get_instance.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_instance.xml rename to apis/deltacloud/src/test/resources/test_get_instance.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_instance_key.xml b/apis/deltacloud/src/test/resources/test_get_instance_key.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_instance_key.xml rename to apis/deltacloud/src/test/resources/test_get_instance_key.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_instance_nokey.xml b/apis/deltacloud/src/test/resources/test_get_instance_nokey.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_instance_nokey.xml rename to apis/deltacloud/src/test/resources/test_get_instance_nokey.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_instance_pw.xml b/apis/deltacloud/src/test/resources/test_get_instance_pw.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_instance_pw.xml rename to apis/deltacloud/src/test/resources/test_get_instance_pw.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_realm.xml b/apis/deltacloud/src/test/resources/test_get_realm.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_realm.xml rename to apis/deltacloud/src/test/resources/test_get_realm.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_get_states.xml b/apis/deltacloud/src/test/resources/test_get_states.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_get_states.xml rename to apis/deltacloud/src/test/resources/test_get_states.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_list_hardware_profiles.xml b/apis/deltacloud/src/test/resources/test_list_hardware_profiles.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_list_hardware_profiles.xml rename to apis/deltacloud/src/test/resources/test_list_hardware_profiles.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_list_images.xml b/apis/deltacloud/src/test/resources/test_list_images.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_list_images.xml rename to apis/deltacloud/src/test/resources/test_list_images.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_list_instances.xml b/apis/deltacloud/src/test/resources/test_list_instances.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_list_instances.xml rename to apis/deltacloud/src/test/resources/test_list_instances.xml diff --git a/sandbox-apis/deltacloud/src/test/resources/test_list_realms.xml b/apis/deltacloud/src/test/resources/test_list_realms.xml similarity index 100% rename from sandbox-apis/deltacloud/src/test/resources/test_list_realms.xml rename to apis/deltacloud/src/test/resources/test_list_realms.xml diff --git a/apis/pom.xml b/apis/pom.xml index 3bc72e0129..1c913b32bb 100644 --- a/apis/pom.xml +++ b/apis/pom.xml @@ -37,6 +37,7 @@ byon s3 ec2 + deltacloud walrus scality-rs2 eucalyptus diff --git a/compute/src/main/clojure/org/jclouds/compute.clj b/compute/src/main/clojure/org/jclouds/compute.clj index ae357d167c..a972889405 100644 --- a/compute/src/main/clojure/org/jclouds/compute.clj +++ b/compute/src/main/clojure/org/jclouds/compute.clj @@ -25,7 +25,7 @@ Current supported providers are: cloudservers-uk, cloudservers-us, byon, cloudsigma-zrh, stub, trmk-ecloud, trmk-vcloudexpress, vcloud, bluelock, eucalyptus, slicehost, elastichosts-lon-p, elastichosts-sat-p, elastichosts, - openhosting-east1, serverlove-z1-man, skalicloud-sdg-my] + openhosting-east1, serverlove-z1-man, skalicloud-sdg-my, deltacloud] Here's an example of getting some compute configuration from rackspace: diff --git a/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java index 4eb69cb03f..12c79988b1 100755 --- a/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java @@ -35,8 +35,8 @@ import static org.jclouds.compute.options.TemplateOptions.Builder.blockOnComplet import static org.jclouds.compute.options.TemplateOptions.Builder.overrideCredentialsWith; import static org.jclouds.compute.predicates.NodePredicates.TERMINATED; import static org.jclouds.compute.predicates.NodePredicates.all; -import static org.jclouds.compute.predicates.NodePredicates.runningInGroup; import static org.jclouds.compute.predicates.NodePredicates.inGroup; +import static org.jclouds.compute.predicates.NodePredicates.runningInGroup; import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -64,7 +64,6 @@ import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeState; import org.jclouds.compute.domain.OperatingSystem; -import org.jclouds.compute.domain.OperatingSystemBuilder; import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; @@ -207,7 +206,7 @@ public abstract class BaseComputeServiceLiveTest { @Test(enabled = true, expectedExceptions = NoSuchElementException.class) public void testCorrectExceptionRunningNodesNotFound() throws Exception { - client.runScriptOnNodesMatching(runningInGroup("zebras-are-awesome"), buildScript(new OperatingSystemBuilder() + client.runScriptOnNodesMatching(runningInGroup("zebras-are-awesome"), buildScript(new OperatingSystem.Builder() .family(OsFamily.UBUNTU).description("ffoo").build())); } diff --git a/compute/src/test/java/org/jclouds/compute/RunScriptData.java b/compute/src/test/java/org/jclouds/compute/RunScriptData.java index 6d7595a54c..177621d3b6 100644 --- a/compute/src/test/java/org/jclouds/compute/RunScriptData.java +++ b/compute/src/test/java/org/jclouds/compute/RunScriptData.java @@ -76,9 +76,9 @@ public class RunScriptData { envVariables, ImmutableList. of(new AuthorizeRSAPublicKey(publicKey),// installJavaAndCurl(os),// - authorizePortInIpTables(8080),// + authorizePortInIpTables(8080), extractTargzIntoDirectory(URI.create(System.getProperty("test.jboss-url", - "http://d19xvfg065k8li.cloudfront.net/jboss-6.0.0.Final.tar.gz")), "/usr/local"),// + "http://d37gkgjhl3prlk.cloudfront.net/jboss-6.0.0.Final.tar.gz")), "/usr/local"),// exec("{md} " + jbossHome), exec("mv /usr/local/jboss-*/* " + jbossHome),// exec("chmod -R oug+r+w " + jbossHome)),// ImmutableList diff --git a/compute/src/test/resources/initscript_with_jboss.sh b/compute/src/test/resources/initscript_with_jboss.sh index 9c1b7f3242..42eea52f62 100644 --- a/compute/src/test/resources/initscript_with_jboss.sh +++ b/compute/src/test/resources/initscript_with_jboss.sh @@ -72,7 +72,7 @@ END_OF_FILE iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 8080 -j ACCEPT iptables-save - curl -X GET -s --retry 20 http://d19xvfg065k8li.cloudfront.net/jboss-6.0.0.Final.tar.gz |(mkdir -p /usr/local &&cd /usr/local &&tar -xpzf -) + curl -X GET -s --retry 20 http://d37gkgjhl3prlk.cloudfront.net/jboss-6.0.0.Final.tar.gz |(mkdir -p /usr/local &&cd /usr/local &&tar -xpzf -) mkdir -p /usr/local/jboss mv /usr/local/jboss-*/* /usr/local/jboss chmod -R oug+r+w /usr/local/jboss From 99ac814d51d49bb189b0a663a67bf7a19fe7913d Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 4 Apr 2011 03:43:53 -0700 Subject: [PATCH 4/5] updated delta to be consistent with ids --- .../deltacloud/compute/functions/DeltacloudImageToImage.java | 3 ++- .../compute/strategy/DeltacloudComputeServiceAdapter.java | 4 ++-- .../deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java index edd28bcb1a..874ec191e6 100644 --- a/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java +++ b/apis/deltacloud/src/main/java/org/jclouds/deltacloud/compute/functions/DeltacloudImageToImage.java @@ -42,7 +42,8 @@ public class DeltacloudImageToImage implements Function credentialStore) { - Instance instance = client.createInstance(template.getImage().getId(), CreateInstanceOptions.Builder.named(name) - .hardwareProfile(template.getHardware().getId()).realm(template.getLocation().getId())); + Instance instance = client.createInstance(template.getImage().getProviderId(), CreateInstanceOptions.Builder + .named(name).hardwareProfile(template.getHardware().getId()).realm(template.getLocation().getId())); if (instance.getAuthentication() != null && instance.getAuthentication() instanceof PasswordAuthentication) { Credentials creds = PasswordAuthentication.class.cast(instance.getAuthentication()).getLoginCredentials(); // store the credentials so that later functions can use them diff --git a/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java index a6e4b76805..02644b9d0d 100644 --- a/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java +++ b/apis/deltacloud/src/test/java/org/jclouds/deltacloud/compute/DeltacloudTemplateBuilderLiveTest.java @@ -72,7 +72,7 @@ public class DeltacloudTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04"); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(defaultTemplate.getLocation().getId(), "us"); + assertEquals(defaultTemplate.getLocation().getId(), "http://localhost:3001/api/realms/us"); assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); } From c0a261334bf16266b19e34fb829b0b7233c1130f Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 4 Apr 2011 14:37:46 -0700 Subject: [PATCH 5/5] added large container list test in clj --- .../src/test/clojure/org/jclouds/blobstore_test.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj b/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj index 1a347a7d1c..6c3d917b72 100644 --- a/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj +++ b/blobstore/src/test/clojure/org/jclouds/blobstore_test.clj @@ -77,6 +77,18 @@ (is (= 3 (count (list-container "container" :with-details true)))) (is (= 1 (count (list-container "container" :in-directory "dir"))))) +(deftest large-container-list-test + (let [container-name "test" + total-blobs 10000] + + ;; create a container full of blobs + (create-container container-name) + (dotimes [i total-blobs] (upload-blob container-name (str i) (str i))) + + ;; verify + (is (= total-blobs (count-blobs container-name))))) + + (deftest get-blob-test (is (create-container "blob")) (is (upload-blob "blob" "blob1" "blob1"))