You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2016/09/30 13:01:37 UTC
[3/5] brooklyn-server git commit: Refactor
JcloudsRebindWithYamlDslTest
Refactor JcloudsRebindWithYamlDslTest
Remove duplication from JcloudsRebindWithExternalConfigTest, creating
common abstract super-type.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6604f7a9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6604f7a9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6604f7a9
Branch: refs/heads/master
Commit: 6604f7a9d7deefedce0283e20d883563dc7e366d
Parents: 5494ac4
Author: Aled Sage <al...@gmail.com>
Authored: Tue Sep 27 17:18:04 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Fri Sep 30 12:44:55 2016 +0100
----------------------------------------------------------------------
.../brooklyn/JcloudsRebindStubYamlTest.java | 99 ++++++++++++++++++++
.../JcloudsRebindWithExternalConfigTest.java | 72 +-------------
.../brooklyn/JcloudsRebindWithYamlDslTest.java | 82 ++++------------
.../core/mgmt/rebind/RebindTestFixture.java | 2 +-
.../location/jclouds/JcloudsRebindStubTest.java | 18 ++--
5 files changed, 130 insertions(+), 143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6604f7a9/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindStubYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindStubYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindStubYamlTest.java
new file mode 100644
index 0000000..c6fbcd1
--- /dev/null
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindStubYamlTest.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.camp.brooklyn;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.File;
+
+import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.JcloudsRebindStubTest;
+import org.testng.annotations.AfterMethod;
+
+/**
+ * Implementation notes. This relies on the test {@link JcloudsRebindStubTest#testRebind()}.
+ * It changes the setup for the test in the following ways:
+ * <ul>
+ * <li>Location is defined in YAML, and refers to the external config for the identity/credential.
+ * <li>When creating management context, it also creates {@link BrooklynCampPlatformLauncherNoServer}.
+ * <li>It uses {@link JcloudsRebindStubYamlTest#ByonComputeServiceStaticRef} to allow
+ * the test's {@link ComputeServiceRegistry} to be wired up via YAML.
+ * </ul>
+ *
+ * See {@link JcloudsRebindStubTest} for explanation why this is "Live" - it will not create VMs,
+ * but does retrieve list of images etc.
+ */
+public abstract class JcloudsRebindStubYamlTest extends JcloudsRebindStubTest {
+
+ protected BrooklynCampPlatformLauncherNoServer origLauncher;
+ protected BrooklynCampPlatformLauncherNoServer newLauncher;
+
+ @Override
+ @AfterMethod(alwaysRun=true)
+ public void tearDown() throws Exception {
+ try {
+ super.tearDown();
+ } finally {
+ ByonComputeServiceStaticRef.clearInstance();
+ if (origLauncher != null) origLauncher.stopServers();
+ if (newLauncher != null) newLauncher.stopServers();
+ }
+ }
+
+ @Override
+ protected LocalManagementContext createOrigManagementContext() {
+ origLauncher = new BrooklynCampPlatformLauncherNoServer() {
+ @Override
+ protected LocalManagementContext newMgmtContext() {
+ return JcloudsRebindStubYamlTest.super.createOrigManagementContext();
+ }
+ };
+ origLauncher.launch();
+ LocalManagementContext mgmt = (LocalManagementContext) origLauncher.getBrooklynMgmt();
+ return mgmt;
+ }
+
+ @Override
+ protected LocalManagementContext createNewManagementContext(final File mementoDir, final HighAvailabilityMode haMode) {
+ newLauncher = new BrooklynCampPlatformLauncherNoServer() {
+ @Override
+ protected LocalManagementContext newMgmtContext() {
+ return JcloudsRebindStubYamlTest.super.createNewManagementContext(mementoDir, haMode);
+ }
+ };
+ newLauncher.launch();
+ return (LocalManagementContext) newLauncher.getBrooklynMgmt();
+ }
+
+ public static class ByonComputeServiceStaticRef {
+ private static volatile ComputeServiceRegistry instance;
+
+ public ComputeServiceRegistry asComputeServiceRegistry() {
+ return checkNotNull(instance, "instance");
+ }
+ static void setInstance(ComputeServiceRegistry val) {
+ instance = val;
+ }
+ static void clearInstance() {
+ instance = null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6604f7a9/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithExternalConfigTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithExternalConfigTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithExternalConfigTest.java
index 160a9c2..fd3baa0 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithExternalConfigTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithExternalConfigTest.java
@@ -20,25 +20,20 @@ package org.apache.brooklyn.camp.brooklyn;
import static com.google.common.base.Preconditions.checkNotNull;
-import java.io.File;
import java.util.Map;
import org.apache.brooklyn.api.entity.Application;
import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer;
import org.apache.brooklyn.core.config.external.InPlaceExternalConfigSupplier;
import org.apache.brooklyn.core.entity.trait.Startable;
import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry;
import org.apache.brooklyn.location.jclouds.JcloudsLocation;
import org.apache.brooklyn.location.jclouds.JcloudsPropertiesFromBrooklynProperties;
-import org.apache.brooklyn.location.jclouds.JcloudsRebindStubTest;
import org.apache.brooklyn.util.collections.MutableMap;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.google.common.base.Joiner;
@@ -46,37 +41,14 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
/**
- * Implementation notes. This relies on the test {@link JcloudsRebindStubTest#testRebind()}.
* It changes the setup for the test in the following ways:
* <ul>
* <li>Brooklyn properties defines external config
- * <li>Location is defined in YAML, and refers to the external config for the identity/credential.
- * <li>When creating management context, it also creates {@link BrooklynCampPlatformLauncherNoServer}.
- * <li>It uses {@link JcloudsRebindWithExternalConfigTest#ByonComputeServiceStaticRef} to allow
- * the test's {@link ComputeServiceRegistry} to be wired up via YAML.
* </ul>
- *
- * See {@link JcloudsRebindStubTest} for explanation why this is "Live" - it will not create VMs,
- * but does retrieve list of images etc.
*/
@Test(groups={"Live", "Live-sanity"})
-public class JcloudsRebindWithExternalConfigTest extends JcloudsRebindStubTest {
+public class JcloudsRebindWithExternalConfigTest extends JcloudsRebindStubYamlTest {
- private BrooklynCampPlatformLauncherNoServer origLauncher;
- private BrooklynCampPlatformLauncherNoServer newLauncher;
-
- @Override
- @AfterMethod(alwaysRun=true)
- public void tearDown() throws Exception {
- try {
- super.tearDown();
- } finally {
- ByonComputeServiceStaticRef.clearInstance();
- if (origLauncher != null) origLauncher.stopServers();
- if (newLauncher != null) newLauncher.stopServers();
- }
- }
-
@Override
protected BrooklynProperties createBrooklynProperties() {
BrooklynProperties result = super.createBrooklynProperties();
@@ -93,39 +65,15 @@ public class JcloudsRebindWithExternalConfigTest extends JcloudsRebindStubTest {
}
@Override
- protected LocalManagementContext createOrigManagementContext() {
- origLauncher = new BrooklynCampPlatformLauncherNoServer() {
- @Override
- protected LocalManagementContext newMgmtContext() {
- return JcloudsRebindWithExternalConfigTest.super.createOrigManagementContext();
- }
- };
- origLauncher.launch();
- LocalManagementContext mgmt = (LocalManagementContext) origLauncher.getBrooklynMgmt();
- return mgmt;
- }
-
- @Override
- protected LocalManagementContext createNewManagementContext(final File mementoDir, final HighAvailabilityMode haMode) {
- newLauncher = new BrooklynCampPlatformLauncherNoServer() {
- @Override
- protected LocalManagementContext newMgmtContext() {
- return JcloudsRebindWithExternalConfigTest.super.createNewManagementContext(mementoDir, haMode);
- }
- };
- newLauncher.launch();
- return (LocalManagementContext) newLauncher.getBrooklynMgmt();
- }
-
- @Override
protected JcloudsLocation newJcloudsLocation(ComputeServiceRegistry computeServiceRegistry) throws Exception {
ByonComputeServiceStaticRef.setInstance(computeServiceRegistry);
String yaml = Joiner.on("\n").join(
"location:",
- " jclouds:softlayer:",
+ " "+LOCATION_SPEC+":",
" identity: $brooklyn:external(\"creds\", \"test-identity\")",
" credential: $brooklyn:external(\"creds\", \"test-credential\")",
+ " imageId: "+IMAGE_ID,
" jclouds.computeServiceRegistry:",
" $brooklyn:object:",
" type: "+ByonComputeServiceStaticRef.class.getName(),
@@ -141,18 +89,4 @@ public class JcloudsRebindWithExternalConfigTest extends JcloudsRebindStubTest {
return (JcloudsLocation) Iterables.getOnlyElement(app.getLocations());
}
-
- public static class ByonComputeServiceStaticRef {
- private static volatile ComputeServiceRegistry instance;
-
- public ComputeServiceRegistry asComputeServiceRegistry() {
- return checkNotNull(instance, "instance");
- }
- static void setInstance(ComputeServiceRegistry val) {
- instance = val;
- }
- static void clearInstance() {
- instance = null;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6604f7a9/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
index ce91156..5864a9a 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JcloudsRebindWithYamlDslTest.java
@@ -18,10 +18,8 @@
*/
package org.apache.brooklyn.camp.brooklyn;
-import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
-import java.io.File;
import java.util.Map;
import org.apache.brooklyn.api.entity.Application;
@@ -29,16 +27,16 @@ import org.apache.brooklyn.api.entity.Entity;
import org.apache.brooklyn.api.entity.EntitySpec;
import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer;
import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.core.location.Machines;
import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
import org.apache.brooklyn.entity.machine.MachineEntity;
import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry;
import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.location.jclouds.JcloudsMachineLocation;
import org.apache.brooklyn.location.jclouds.JcloudsRebindStubTest;
import org.apache.brooklyn.location.ssh.SshMachineLocation;
import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.google.common.base.Joiner;
@@ -46,7 +44,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
/**
- * This is primarily to test https://issues.apache.org/jira/browse/BROOKLYN-349
+ * This is primarily to test https://issues.apache.org/jira/browse/BROOKLYN-349.
+ * It confirms that entity "provisioning.properties" get passed through to the machine.
*
* As per the other {@link JcloudsRebindStubTest} tests, it will connect to SoftLayer to retrieve
* image details (so needs real credentials), but it will then stub out the VM creation.
@@ -63,47 +62,9 @@ import com.google.common.collect.Iterables;
* </ul>
*/
@Test(groups={"Live", "Live-sanity"})
-public class JcloudsRebindWithYamlDslTest extends JcloudsRebindStubTest {
+public class JcloudsRebindWithYamlDslTest extends JcloudsRebindStubYamlTest {
- private BrooklynCampPlatformLauncherNoServer origLauncher;
- private BrooklynCampPlatformLauncherNoServer newLauncher;
-
- @Override
- @AfterMethod(alwaysRun=true)
- public void tearDown() throws Exception {
- try {
- super.tearDown();
- } finally {
- ByonComputeServiceStaticRef.clearInstance();
- if (origLauncher != null) origLauncher.stopServers();
- if (newLauncher != null) newLauncher.stopServers();
- }
- }
-
- @Override
- protected LocalManagementContext createOrigManagementContext() {
- origLauncher = new BrooklynCampPlatformLauncherNoServer() {
- @Override
- protected LocalManagementContext newMgmtContext() {
- return JcloudsRebindWithYamlDslTest.super.createOrigManagementContext();
- }
- };
- origLauncher.launch();
- LocalManagementContext mgmt = (LocalManagementContext) origLauncher.getBrooklynMgmt();
- return mgmt;
- }
-
- @Override
- protected LocalManagementContext createNewManagementContext(final File mementoDir) {
- newLauncher = new BrooklynCampPlatformLauncherNoServer() {
- @Override
- protected LocalManagementContext newMgmtContext() {
- return JcloudsRebindWithYamlDslTest.super.createNewManagementContext(mementoDir);
- }
- };
- newLauncher.launch();
- return (LocalManagementContext) newLauncher.getBrooklynMgmt();
- }
+ protected Entity origApp;
@Override
protected JcloudsLocation newJcloudsLocation(ComputeServiceRegistry computeServiceRegistry) throws Exception {
@@ -124,7 +85,8 @@ public class JcloudsRebindWithYamlDslTest extends JcloudsRebindStubTest {
String yaml = Joiner.on("\n").join(
"location:",
- " jclouds:softlayer:",
+ " "+LOCATION_SPEC+":",
+ " imageId: "+IMAGE_ID,
" jclouds.computeServiceRegistry:",
" $brooklyn:object:",
" type: "+ByonComputeServiceStaticRef.class.getName(),
@@ -142,9 +104,15 @@ public class JcloudsRebindWithYamlDslTest extends JcloudsRebindStubTest {
EntitySpec<?> spec =
mgmt().getTypeRegistry().createSpecFromPlan(CampTypePlanTransformer.FORMAT, yaml, RegisteredTypeLoadingContexts.spec(Application.class), EntitySpec.class);
- final Entity app = mgmt().getEntityManager().createEntity(spec);
- final MachineEntity entity = (MachineEntity) Iterables.getOnlyElement(app.getChildren());
- app.invoke(Startable.START, ImmutableMap.<String, Object>of()).get();
+ origApp = mgmt().getEntityManager().createEntity(spec);
+
+ return (JcloudsLocation) Iterables.getOnlyElement(origApp.getLocations());
+ }
+
+ @Override
+ protected JcloudsMachineLocation obtainMachine(JcloudsLocation jcloudsLoc, Map<?,?> props) throws Exception {
+ final MachineEntity entity = (MachineEntity) Iterables.getOnlyElement(origApp.getChildren());
+ origApp.invoke(Startable.START, ImmutableMap.<String, Object>of()).get();
// Execute ssh (with RecordingSshTool), and confirm was given resolved password
entity.execCommand("mycmd");
@@ -152,20 +120,6 @@ public class JcloudsRebindWithYamlDslTest extends JcloudsRebindStubTest {
ExecCmd execCmd = RecordingSshTool.getLastExecCmd();
assertEquals(constructorProps.get("password"), "myYamlPassword", "constructorProps: "+constructorProps+"; execProps: "+execCmd.props);
- return (JcloudsLocation) Iterables.getOnlyElement(app.getLocations());
- }
-
- public static class ByonComputeServiceStaticRef {
- private static volatile ComputeServiceRegistry instance;
-
- public ComputeServiceRegistry asComputeServiceRegistry() {
- return checkNotNull(instance, "instance");
- }
- static void setInstance(ComputeServiceRegistry val) {
- instance = val;
- }
- static void clearInstance() {
- instance = null;
- }
+ return Machines.findUniqueMachineLocation(entity.getLocations(), JcloudsMachineLocation.class).get();
}
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6604f7a9/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
index 5af282b..5ed62c1 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
@@ -43,7 +43,6 @@ import org.apache.brooklyn.core.internal.BrooklynProperties;
import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
import org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore;
-import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils;
import org.apache.brooklyn.core.mgmt.persist.FileBasedObjectStore;
import org.apache.brooklyn.core.mgmt.persist.PersistMode;
import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
@@ -301,6 +300,7 @@ public abstract class RebindTestFixture<T extends StartableApplication> {
return hotStandby(RebindOptions.create());
}
+ @SuppressWarnings("unchecked")
protected T hotStandby(RebindOptions options) throws Exception {
if (newApp != null || newManagementContext != null) {
throw new IllegalStateException("already rebound - use switchOriginalToNewManagementContext() if you are trying to rebind multiple times");
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6604f7a9/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsRebindStubTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsRebindStubTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsRebindStubTest.java
index bea39b6..6f09007 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsRebindStubTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsRebindStubTest.java
@@ -18,13 +18,12 @@
*/
package org.apache.brooklyn.location.jclouds;
-import static com.google.common.base.Preconditions.checkNotNull;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import java.net.URI;
import java.util.List;
-import java.util.Set;
+import java.util.Map;
import org.apache.brooklyn.api.mgmt.ManagementContext;
import org.apache.brooklyn.core.entity.Entities;
@@ -32,8 +31,6 @@ import org.apache.brooklyn.core.internal.BrooklynProperties;
import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
import org.apache.brooklyn.core.test.entity.TestApplication;
import org.apache.brooklyn.util.exceptions.CompoundRuntimeException;
-import org.jclouds.compute.ComputeService;
-import org.jclouds.compute.RunNodesException;
import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadata.Status;
@@ -44,7 +41,6 @@ import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.domain.internal.HardwareImpl;
import org.jclouds.compute.domain.internal.NodeMetadataImpl;
-import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.domain.LocationScope;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.domain.internal.LocationImpl;
@@ -81,8 +77,8 @@ public class JcloudsRebindStubTest extends RebindTestFixtureWithApp {
private static final Logger LOG = LoggerFactory.getLogger(JcloudsRebindStubTest.class);
public static final String PROVIDER = AbstractJcloudsLiveTest.SOFTLAYER_PROVIDER;
- public static final String SOFTLAYER_LOCATION_SPEC = "jclouds:" + PROVIDER;
- public static final String SOFTLAYER_IMAGE_ID = "UBUNTU_14_64";
+ public static final String LOCATION_SPEC = "jclouds:" + PROVIDER;
+ public static final String IMAGE_ID = "UBUNTU_14_64";
protected List<ManagementContext> mgmts;
protected Multimap<ManagementContext, JcloudsSshMachineLocation> machines;
@@ -172,7 +168,7 @@ public class JcloudsRebindStubTest extends RebindTestFixtureWithApp {
Predicates.<Image>alwaysTrue(), // supportsImage,
(String)null, // hypervisor
false),
- SOFTLAYER_IMAGE_ID,
+ IMAGE_ID,
new OperatingSystem(
OsFamily.CENTOS,
"myOsName",
@@ -192,7 +188,7 @@ public class JcloudsRebindStubTest extends RebindTestFixtureWithApp {
JcloudsLocation origJcloudsLoc = newJcloudsLocation(computeServiceRegistry);
- JcloudsSshMachineLocation origMachine = (JcloudsSshMachineLocation) origJcloudsLoc.obtain(ImmutableMap.of("imageId", SOFTLAYER_IMAGE_ID));
+ JcloudsSshMachineLocation origMachine = (JcloudsSshMachineLocation) obtainMachine(origJcloudsLoc, ImmutableMap.of("imageId", IMAGE_ID));
String origHostname = origMachine.getHostname();
NodeMetadata origNode = origMachine.getNode();
@@ -217,6 +213,10 @@ public class JcloudsRebindStubTest extends RebindTestFixtureWithApp {
assertEquals(newJcloudsLoc.getProvider(), origJcloudsLoc.getProvider());
}
+ protected JcloudsMachineLocation obtainMachine(JcloudsLocation jcloudsLoc, Map<?,?> props) throws Exception {
+ return (JcloudsMachineLocation) jcloudsLoc.obtain(ImmutableMap.of("imageId", IMAGE_ID));
+ }
+
protected JcloudsLocation newJcloudsLocation(ComputeServiceRegistry computeServiceRegistry) throws Exception {
return (JcloudsLocation) mgmt().getLocationRegistry().getLocationManaged("jclouds:softlayer", ImmutableMap.of(
JcloudsLocation.COMPUTE_SERVICE_REGISTRY, computeServiceRegistry,