You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/01 18:46:57 UTC
[39/50] brooklyn-library git commit: Redis: split interface+impl,
and fix ec2 test
Redis: split interface+impl, and fix ec2 test
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/c06d64c0
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/c06d64c0
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/c06d64c0
Branch: refs/heads/0.5.0
Commit: c06d64c0b7764baa7d31938c991b45d4c94bd848
Parents: 464ef00
Author: Aled Sage <al...@gmail.com>
Authored: Mon Apr 22 13:09:04 2013 +0100
Committer: Andrew Kennedy <an...@cloudsoftcorp.com>
Committed: Wed Apr 24 13:25:43 2013 +0100
----------------------------------------------------------------------
.../entity/nosql/redis/RedisCluster.java | 71 ----------
.../entity/nosql/redis/RedisClusterImpl.java | 66 +++++++++
.../brooklyn/entity/nosql/redis/RedisShard.java | 23 ----
.../entity/nosql/redis/RedisShardImpl.java | 22 +++
.../brooklyn/entity/nosql/redis/RedisSlave.java | 41 ------
.../entity/nosql/redis/RedisSlaveImpl.java | 42 ++++++
.../brooklyn/entity/nosql/redis/RedisStore.java | 134 -------------------
.../entity/nosql/redis/RedisStoreImpl.java | 109 +++++++++++++++
.../entity/nosql/redis/RedisStoreSshDriver.java | 6 +-
.../entity/nosql/redis/RedisEc2LiveTest.java | 10 +-
.../nosql/redis/RedisIntegrationTest.groovy | 16 ++-
11 files changed, 260 insertions(+), 280 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisCluster.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisCluster.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisCluster.java
deleted file mode 100644
index 7d063b5..0000000
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisCluster.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package brooklyn.entity.nosql.redis;
-
-import java.util.Collection;
-import java.util.Map;
-
-import brooklyn.catalog.Catalog;
-import brooklyn.entity.Entity;
-import brooklyn.entity.basic.AbstractEntity;
-import brooklyn.entity.basic.BasicConfigurableEntityFactory;
-import brooklyn.entity.group.DynamicCluster;
-import brooklyn.entity.group.DynamicClusterImpl;
-import brooklyn.entity.trait.Startable;
-import brooklyn.location.Location;
-import brooklyn.util.MutableMap;
-
-import com.google.common.collect.Maps;
-
-/**
- * A cluster of {@link RedisStore}s with ione master and a group of slaves.
- *
- * The slaves are contained in a {@link DynamicCluster} which can be resized by a policy if required.
- *
- * TODO add sensors with aggregated Redis statistics from cluster
- */
-@Catalog(name="Redis Cluster", description="Redis is an open-source, networked, in-memory, key-value data store with optional durability", iconUrl="classpath:///redis-logo.jpeg")
-public class RedisCluster extends AbstractEntity implements Startable {
- Map redisProperties = Maps.newLinkedHashMap();
- RedisCluster master;
- DynamicCluster slaves;
-
- public RedisCluster() {
- this(MutableMap.of(), null);
- }
- public RedisCluster(Map properties) {
- this(properties, null);
- }
- public RedisCluster(Entity parent) {
- this(MutableMap.of(), parent);
- }
- public RedisCluster(Map properties, Entity parent) {
- super(properties, parent);
-
- redisProperties.putAll(properties);
- redisProperties.put("factory", new BasicConfigurableEntityFactory(RedisSlave.class));
- }
-
- @Override
- public void start(Collection<? extends Location> locations) {
- master = new RedisCluster(redisProperties, this);
- master.start(locations);
- redisProperties.put("master", master);
-
- slaves = new DynamicClusterImpl(redisProperties, this);
- slaves.start(locations);
-
- setAttribute(Startable.SERVICE_UP, true);
- }
-
- @Override
- public void stop() {
- slaves.stop();
- master.stop();
-
- setAttribute(Startable.SERVICE_UP, false);
- }
-
- @Override
- public void restart() {
- throw new UnsupportedOperationException();
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisClusterImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisClusterImpl.java
new file mode 100644
index 0000000..08d114a
--- /dev/null
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisClusterImpl.java
@@ -0,0 +1,66 @@
+package brooklyn.entity.nosql.redis;
+
+import java.util.Collection;
+import java.util.Map;
+
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.AbstractEntity;
+import brooklyn.entity.basic.BasicConfigurableEntityFactory;
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.group.DynamicCluster;
+import brooklyn.entity.proxying.EntitySpecs;
+import brooklyn.entity.trait.Startable;
+import brooklyn.location.Location;
+import brooklyn.util.MutableMap;
+
+import com.google.common.collect.Maps;
+
+public class RedisClusterImpl extends AbstractEntity implements RedisCluster {
+ Map redisProperties = Maps.newLinkedHashMap();
+ RedisStore master;
+ DynamicCluster slaves;
+
+ public RedisClusterImpl() {
+ this(MutableMap.of(), null);
+ }
+ public RedisClusterImpl(Map properties) {
+ this(properties, null);
+ }
+ public RedisClusterImpl(Entity parent) {
+ this(MutableMap.of(), parent);
+ }
+ public RedisClusterImpl(Map properties, Entity parent) {
+ super(properties, parent);
+
+ redisProperties.putAll(properties);
+ }
+
+ @Override
+ public void start(Collection<? extends Location> locations) {
+ master = addChild(EntitySpecs.spec(RedisStore.class)
+ .configure(redisProperties));
+ Entities.manage(master);
+ master.start(locations);
+ redisProperties.put("master", master);
+
+ slaves = addChild(EntitySpecs.spec(DynamicCluster.class)
+ .configure(redisProperties)
+ .configure(DynamicCluster.FACTORY, new BasicConfigurableEntityFactory(RedisSlave.class)));
+ slaves.start(locations);
+
+ setAttribute(Startable.SERVICE_UP, true);
+ }
+
+ @Override
+ public void stop() {
+ if (slaves != null) slaves.stop();
+ if (master != null) master.stop();
+
+ setAttribute(Startable.SERVICE_UP, false);
+ }
+
+ @Override
+ public void restart() {
+ throw new UnsupportedOperationException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShard.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShard.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShard.java
deleted file mode 100644
index 9cad4ce..0000000
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShard.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package brooklyn.entity.nosql.redis;
-
-import java.util.Map;
-
-import brooklyn.entity.Entity;
-import brooklyn.entity.basic.AbstractEntity;
-import brooklyn.entity.nosql.Shard;
-import brooklyn.util.MutableMap;
-
-public class RedisShard extends AbstractEntity implements Shard {
- public RedisShard() {
- this(MutableMap.of(), null);
- }
- public RedisShard(Map properties) {
- this(properties, null);
- }
- public RedisShard(Entity parent) {
- this(MutableMap.of(), parent);
- }
- public RedisShard(Map properties, Entity parent) {
- super(properties, parent);
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShardImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShardImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShardImpl.java
new file mode 100644
index 0000000..0eee09f
--- /dev/null
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisShardImpl.java
@@ -0,0 +1,22 @@
+package brooklyn.entity.nosql.redis;
+
+import java.util.Map;
+
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.AbstractEntity;
+import brooklyn.util.MutableMap;
+
+public class RedisShardImpl extends AbstractEntity implements RedisShard {
+ public RedisShardImpl() {
+ this(MutableMap.of(), null);
+ }
+ public RedisShardImpl(Map properties) {
+ this(properties, null);
+ }
+ public RedisShardImpl(Entity parent) {
+ this(MutableMap.of(), parent);
+ }
+ public RedisShardImpl(Map properties, Entity parent) {
+ super(properties, parent);
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlave.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlave.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlave.java
deleted file mode 100644
index cf4815b..0000000
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlave.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package brooklyn.entity.nosql.redis;
-
-import java.util.Map;
-
-import brooklyn.entity.Entity;
-import brooklyn.util.MutableMap;
-
-import com.google.common.base.Preconditions;
-
-/**
- * A {@link RedisStore} configured as a slave.
- *
- * The {@code master} property must be set to the master Redis store entity.
- */
-public class RedisSlave extends RedisStore {
- RedisStore master;
-
- public RedisSlave() {
- this(MutableMap.of(), null);
- }
- public RedisSlave(Map properties) {
- this(properties, null);
- }
- public RedisSlave(Entity parent) {
- this(MutableMap.of(), parent);
- }
- public RedisSlave(Map properties, Entity parent) {
- super(properties, parent);
-
- Preconditions.checkArgument(properties.containsKey("master"), "The Redis master entity must be specified");
- master = (RedisStore) properties.get("master");
- }
-
- @Override
- public String getConfigData(int port, boolean include) {
- String masterAddress = master.getAddress();
- int masterPort = getParent().getAttribute(REDIS_PORT);
-
- return super.getConfigData(port, include) + "slaveof "+masterAddress+" "+masterPort;
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlaveImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlaveImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlaveImpl.java
new file mode 100644
index 0000000..2ea0783
--- /dev/null
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisSlaveImpl.java
@@ -0,0 +1,42 @@
+package brooklyn.entity.nosql.redis;
+
+import java.util.Map;
+
+import brooklyn.entity.Entity;
+import brooklyn.util.MutableMap;
+
+import com.google.common.base.Preconditions;
+
+/**
+ * A {@link RedisStore} configured as a slave.
+ *
+ * The {@code master} property must be set to the master Redis store entity.
+ */
+public class RedisSlaveImpl extends RedisStoreImpl implements RedisSlave {
+ RedisStore master;
+
+ public RedisSlaveImpl() {
+ this(MutableMap.of(), null);
+ }
+ public RedisSlaveImpl(Map properties) {
+ this(properties, null);
+ }
+ public RedisSlaveImpl(Entity parent) {
+ this(MutableMap.of(), parent);
+ }
+ public RedisSlaveImpl(Map properties, Entity parent) {
+ super(properties, parent);
+
+ // TODO Use config key for "master"
+ Preconditions.checkArgument(properties.containsKey("master"), "The Redis master entity must be specified");
+ master = (RedisStore) properties.get("master");
+ }
+
+ @Override
+ public String getConfigData(int port, boolean include) {
+ String masterAddress = master.getAddress();
+ int masterPort = getParent().getAttribute(REDIS_PORT);
+
+ return super.getConfigData(port, include) + "slaveof "+masterAddress+" "+masterPort;
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStore.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStore.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStore.java
deleted file mode 100644
index 7272088..0000000
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStore.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package brooklyn.entity.nosql.redis;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.util.Map;
-import java.util.concurrent.Callable;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import brooklyn.catalog.Catalog;
-import brooklyn.config.ConfigKey;
-import brooklyn.entity.Entity;
-import brooklyn.entity.basic.SoftwareProcess;
-import brooklyn.entity.basic.SoftwareProcessImpl;
-import brooklyn.entity.nosql.DataStore;
-import brooklyn.event.AttributeSensor;
-import brooklyn.event.basic.BasicAttributeSensor;
-import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
-import brooklyn.event.basic.BasicConfigKey;
-import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
-import brooklyn.location.MachineLocation;
-import brooklyn.location.basic.SshMachineLocation;
-import brooklyn.util.MutableMap;
-import brooklyn.util.flags.SetFromFlag;
-
-/**
- * An entity that represents a Redis key-value store service.
- *
- * TODO add sensors with Redis statistics using INFO command
- */
-@Catalog(name="Redis Server", description="Redis is an open-source, networked, in-memory, key-value data store with optional durability", iconUrl="classpath:///redis-logo.jpeg")
-public class RedisStore extends SoftwareProcessImpl implements DataStore {
- protected static final Logger LOG = LoggerFactory.getLogger(RedisStore.class);
-
- @SetFromFlag("version")
- public static final BasicConfigKey<String> SUGGESTED_VERSION =
- new BasicConfigKey<String>(SoftwareProcess.SUGGESTED_VERSION, "2.6.7");
-
- @SetFromFlag("downloadUrl")
- public static final BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey<String>(
- SoftwareProcess.DOWNLOAD_URL, "http://redis.googlecode.com/files/redis-${version}.tar.gz");
-
- public static final PortAttributeSensorAndConfigKey REDIS_PORT = new PortAttributeSensorAndConfigKey("redis.port", "Redis port number", 6379);
- public static final ConfigKey<String> REDIS_CONFIG_FILE = new BasicConfigKey<String>(String.class, "redis.config.file", "Redis user configuration file");
- public static final AttributeSensor<Integer> UPTIME = new BasicAttributeSensor<Integer>(Integer.class, "redis.uptime", "Redis uptime in seconds");
-
- public RedisStore() {
- this(MutableMap.of(), null);
- }
- public RedisStore(Map properties) {
- this(properties, null);
- }
- public RedisStore(Entity parent) {
- this(MutableMap.of(), parent);
- }
- public RedisStore(Map properties, Entity parent) {
- super(properties, parent);
-
- setConfigIfValNonNull(REDIS_PORT, properties.get("redisPort"));
- setConfigIfValNonNull(REDIS_CONFIG_FILE, properties.get("configFile"));
- }
-
- @Override
- protected void connectSensors() {
- super.connectSensors();
-
- connectServiceUpIsRunning();
-
- // TODO IF desired, port this for setting UPTIME (because legacy sshAdapter is deleted)
-// String output = sshAdapter.newOutputValueProvider("${driver.runDir}/bin/redis-cli info").compute()
-// for (String line : output.split("\n")) {
-// if (line =~ /^uptime_in_seconds:/) {
-// String data = line.trim()
-// int colon = data.indexOf(":")
-// return Integer.parseInt(data.substring(colon + 1))
-// }
-// }
- }
-
- @Override
- public void disconnectSensors() {
- super.disconnectSensors();
- disconnectServiceUpIsRunning();
- }
-
- public Class getDriverInterface() {
- return RedisStoreDriver.class;
- }
-
- @Override
- public RedisStoreDriver getDriver() {
- return (RedisStoreDriver) super.getDriver();
- }
-
- public String getAddress() {
- MachineLocation machine = getMachineOrNull();
- return (machine != null) ? machine.getAddress().getHostAddress() : null;
- }
-
-
- // FIXME Don't want to hard-code this as SshMachineLocatoin; want generic way of doing machine.copyTo
- @Override
- protected SshMachineLocation getMachineOrNull() {
- return (SshMachineLocation) super.getMachineOrNull();
- }
-
- // FIXME This logic should all be in the driver
- void doExtraConfigurationDuringStart() {
- int port = getAttribute(REDIS_PORT);
- boolean include = false;
-
- String includeName = getConfig(REDIS_CONFIG_FILE);
- if (includeName != null && includeName.length() > 0) {
- File includeFile = new File(includeName);
- include = includeFile.exists();
- }
-
- getMachineOrNull().copyTo(new ByteArrayInputStream(getConfigData(port, include).getBytes()), getDriver().getRunDir()+"/redis.conf");
- if (include) getMachineOrNull().copyTo(new File(includeName), getDriver().getRunDir()+"/include.conf");
-
- super.configure();
- }
-
- public String getConfigData(int port, boolean include) {
- String data =
- "daemonize yes"+"\n"+
- "pidfile "+getDriver().getRunDir()+"/pid.txt"+"\n"+
- "port "+port+"\n";
-
- if (include) data += "include "+getDriver().getRunDir()+"/include.conf";
- return data;
- }
-}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreImpl.java
new file mode 100644
index 0000000..5c454cd
--- /dev/null
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreImpl.java
@@ -0,0 +1,109 @@
+package brooklyn.entity.nosql.redis;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.SoftwareProcessImpl;
+import brooklyn.location.MachineLocation;
+import brooklyn.location.basic.SshMachineLocation;
+import brooklyn.util.MutableMap;
+
+/**
+ * An entity that represents a Redis key-value store service.
+ *
+ * TODO add sensors with Redis statistics using INFO command
+ */
+public class RedisStoreImpl extends SoftwareProcessImpl implements RedisStore {
+ protected static final Logger LOG = LoggerFactory.getLogger(RedisStore.class);
+
+ public RedisStoreImpl() {
+ this(MutableMap.of(), null);
+ }
+ public RedisStoreImpl(Map properties) {
+ this(properties, null);
+ }
+ public RedisStoreImpl(Entity parent) {
+ this(MutableMap.of(), parent);
+ }
+ public RedisStoreImpl(Map properties, Entity parent) {
+ super(properties, parent);
+ }
+
+ @Override
+ protected void connectSensors() {
+ super.connectSensors();
+
+ connectServiceUpIsRunning();
+
+ // TODO IF desired, port this for setting UPTIME (because legacy sshAdapter is deleted)
+// String output = sshAdapter.newOutputValueProvider("${driver.runDir}/bin/redis-cli info").compute()
+// for (String line : output.split("\n")) {
+// if (line =~ /^uptime_in_seconds:/) {
+// String data = line.trim()
+// int colon = data.indexOf(":")
+// return Integer.parseInt(data.substring(colon + 1))
+// }
+// }
+ }
+
+ @Override
+ public void disconnectSensors() {
+ super.disconnectSensors();
+ disconnectServiceUpIsRunning();
+ }
+
+ public Class getDriverInterface() {
+ return RedisStoreDriver.class;
+ }
+
+ @Override
+ public RedisStoreDriver getDriver() {
+ return (RedisStoreDriver) super.getDriver();
+ }
+
+ @Override
+ public String getAddress() {
+ MachineLocation machine = getMachineOrNull();
+ return (machine != null) ? machine.getAddress().getHostAddress() : null;
+ }
+
+
+ // FIXME Don't want to hard-code this as SshMachineLocatoin; want generic way of doing machine.copyTo
+ @Override
+ protected SshMachineLocation getMachineOrNull() {
+ return (SshMachineLocation) super.getMachineOrNull();
+ }
+
+ // FIXME This logic should all be in the driver
+ void doExtraConfigurationDuringStart() {
+ int port = getAttribute(REDIS_PORT);
+ boolean include = false;
+
+ String includeName = getConfig(REDIS_CONFIG_FILE);
+ if (includeName != null && includeName.length() > 0) {
+ File includeFile = new File(includeName);
+ include = includeFile.exists();
+ }
+
+ getMachineOrNull().copyTo(new ByteArrayInputStream(getConfigData(port, include).getBytes()), getDriver().getRunDir()+"/redis.conf");
+ if (include) getMachineOrNull().copyTo(new File(includeName), getDriver().getRunDir()+"/include.conf");
+
+ super.configure();
+ }
+
+ @Override
+ public String getConfigData(int port, boolean include) {
+ String data =
+ "daemonize yes"+"\n"+
+ "pidfile "+getDriver().getRunDir()+"/pid.txt"+"\n"+
+ "port "+port+"\n";
+
+ if (include) data += "include "+getDriver().getRunDir()+"/include.conf";
+ return data;
+ }
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
index 7ae292a..8b8e8ae 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
@@ -21,13 +21,13 @@ public class RedisStoreSshDriver extends AbstractSoftwareProcessSshDriver implem
private String expandedInstallDir;
- public RedisStoreSshDriver(RedisStore entity, SshMachineLocation machine) {
+ public RedisStoreSshDriver(RedisStoreImpl entity, SshMachineLocation machine) {
super(entity, machine);
}
@Override
- public RedisStore getEntity() {
- return (RedisStore) super.getEntity();
+ public RedisStoreImpl getEntity() {
+ return (RedisStoreImpl) super.getEntity();
}
protected Integer getRedisPort() {
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisEc2LiveTest.java b/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisEc2LiveTest.java
index 187f981..a3eeb2f 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisEc2LiveTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisEc2LiveTest.java
@@ -8,20 +8,28 @@ import org.testng.annotations.Test;
import redis.clients.jedis.Connection;
import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.proxying.EntitySpecs;
import brooklyn.location.Location;
import brooklyn.test.EntityTestUtils;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
public class RedisEc2LiveTest extends AbstractEc2LiveTest {
@SuppressWarnings("unused")
private static final Logger LOG = LoggerFactory.getLogger(RedisEc2LiveTest.class);
+ @Test(groups = {"Live"})
+ public void test_CentOS_6_3() throws Exception {
+ // Image: {id=us-east-1/ami-7d7bfc14, providerId=ami-7d7bfc14, name=RightImage_CentOS_6.3_x64_v5.8.8.5, location={scope=REGION, id=us-east-1, description=us-east-1, parent=aws-ec2, iso3166Codes=[US-VA]}, os={family=centos, arch=paravirtual, version=6.0, description=rightscale-us-east/RightImage_CentOS_6.3_x64_v5.8.8.5.manifest.xml, is64Bit=true}, description=rightscale-us-east/RightImage_CentOS_6.3_x64_v5.8.8.5.manifest.xml, version=5.8.8.5, status=AVAILABLE[available], loginUser=root, userMetadata={owner=411009282317, rootDeviceType=instance-store, virtualizationType=paravirtual, hypervisor=xen}}
+ runTest(ImmutableMap.of("imageId", "us-east-1/ami-7d7bfc14", "hardwareId", SMALL_HARDWARE_ID));
+ }
+
@Override
protected void doTest(Location loc) throws Exception {
// Start Redis
- RedisStore redis = new RedisStore(app);
+ RedisStore redis = app.createAndManageChild(EntitySpecs.spec(RedisStore.class));
app.start(ImmutableList.of(loc));
EntityTestUtils.assertAttributeEqualsEventually(redis, RedisStore.SERVICE_UP, true);
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/c06d64c0/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.groovy
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.groovy b/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.groovy
index c737070..44d9e0e 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.groovy
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/redis/RedisIntegrationTest.groovy
@@ -10,11 +10,13 @@ import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test
import redis.clients.jedis.Connection
+import brooklyn.entity.basic.ApplicationBuilder
+import brooklyn.entity.basic.Entities
+import brooklyn.entity.proxying.EntitySpecs
import brooklyn.entity.trait.Startable
import brooklyn.location.Location
import brooklyn.location.basic.LocalhostMachineProvisioningLocation
import brooklyn.test.entity.TestApplication
-import brooklyn.test.entity.TestApplicationImpl
import brooklyn.util.internal.TimeExtras
/**
@@ -31,15 +33,15 @@ public class RedisIntegrationTest {
private Location testLocation
private RedisStore redis
- @BeforeMethod(groups = "Integration")
+ @BeforeMethod(alwaysRun=true)
public void setup() {
- app = new TestApplicationImpl();
+ app = ApplicationBuilder.newManagedApp(TestApplication.class);
testLocation = new LocalhostMachineProvisioningLocation(name:'london')
}
- @AfterMethod(groups = "Integration")
+ @AfterMethod(alwaysRun=true)
public void shutdown() {
- if (app != null) app.stop()
+ if (app != null) Entities.destroyAll(app);
}
/**
@@ -48,7 +50,7 @@ public class RedisIntegrationTest {
// FIXME Marked as WIP because failing in jenkins; environmental differences?
@Test(groups = ["Integration"])
public void canStartupAndShutdown() {
- redis = new RedisStore(parent:app);
+ redis = app.createAndManageChild(EntitySpecs.spec(RedisStore.class));
app.start([ testLocation ])
executeUntilSucceeds() {
assertTrue redis.getAttribute(Startable.SERVICE_UP)
@@ -65,7 +67,7 @@ public class RedisIntegrationTest {
@Test(groups = ["Integration"])
public void testRedisConnection() {
// Start Redis
- redis = new RedisStore(parent:app)
+ redis = app.createAndManageChild(EntitySpecs.spec(RedisStore.class));
app.start([ testLocation ])
executeUntilSucceeds {
assertTrue redis.getAttribute(Startable.SERVICE_UP)