http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationRebindTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationRebindTest.java b/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationRebindTest.java index ffd6d60..994dfea 100644 --- a/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationRebindTest.java +++ b/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationRebindTest.java @@ -56,15 +56,15 @@ public class FixedListMachineProvisioningLocationRebindTest { mementoDir = Os.newTempDir(getClass()); origManagementContext = RebindTestUtils.newPersistingManagementContext(mementoDir, classLoader, 1); - origLoc = new FixedListMachineProvisioningLocation.Builder(origManagementContext.getLocationManager()) - .addAddresses("localhost", "127.0.0.1") - .user("myuser") - .keyFile("/path/to/myPrivateKeyFile") - .keyData("myKeyData") - .keyPassphrase("myKeyPassphrase") - .build(); + origLoc = new FixedListMachineProvisioningLocation.Builder(origManagementContext.getLocationManager()) + .addAddresses("localhost", "127.0.0.1") + .user("myuser") + .keyFile("/path/to/myPrivateKeyFile") + .keyData("myKeyData") + .keyPassphrase("myKeyPassphrase") + .build(); origApp = ApplicationBuilder.newManagedApp(TestApplication.class, origManagementContext); - origApp.start(ImmutableList.of(origLoc)); + origApp.start(ImmutableList.of(origLoc)); } @AfterMethod(alwaysRun = true) @@ -76,38 +76,38 @@ public class FixedListMachineProvisioningLocationRebindTest { @Test public void testRebindPreservesConfig() throws Exception { - newApp = rebind(); - FixedListMachineProvisioningLocation<SshMachineLocation> newLoc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(newApp.getLocations(), 0); - - assertEquals(newLoc.getId(), origLoc.getId()); - assertEquals(newLoc.getDisplayName(), origLoc.getDisplayName()); - assertEquals(newLoc.getHostGeoInfo(), origLoc.getHostGeoInfo()); - assertEquals(newLoc.getConfig(LocationConfigKeys.USER), origLoc.getConfig(LocationConfigKeys.USER)); - assertEquals(newLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE), origLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE)); - assertEquals(newLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_FILE), origLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_FILE)); - assertEquals(newLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_DATA), origLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_DATA)); + newApp = rebind(); + FixedListMachineProvisioningLocation<SshMachineLocation> newLoc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(newApp.getLocations(), 0); + + assertEquals(newLoc.getId(), origLoc.getId()); + assertEquals(newLoc.getDisplayName(), origLoc.getDisplayName()); + assertEquals(newLoc.getHostGeoInfo(), origLoc.getHostGeoInfo()); + assertEquals(newLoc.getConfig(LocationConfigKeys.USER), origLoc.getConfig(LocationConfigKeys.USER)); + assertEquals(newLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE), origLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE)); + assertEquals(newLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_FILE), origLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_FILE)); + assertEquals(newLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_DATA), origLoc.getConfig(LocationConfigKeys.PRIVATE_KEY_DATA)); } @Test public void testRebindParentRelationship() throws Exception { - newApp = rebind(); - FixedListMachineProvisioningLocation<SshMachineLocation> newLoc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(newApp.getLocations(), 0); - - assertLocationIdsEqual(newLoc.getChildren(), origLoc.getChildren()); - assertEquals(Iterables.get(newLoc.getChildren(), 0).getParent(), newLoc); - assertEquals(Iterables.get(newLoc.getChildren(), 1).getParent(), newLoc); + newApp = rebind(); + FixedListMachineProvisioningLocation<SshMachineLocation> newLoc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(newApp.getLocations(), 0); + + assertLocationIdsEqual(newLoc.getChildren(), origLoc.getChildren()); + assertEquals(Iterables.get(newLoc.getChildren(), 0).getParent(), newLoc); + assertEquals(Iterables.get(newLoc.getChildren(), 1).getParent(), newLoc); } @Test public void testRebindPreservesInUseMachines() throws Exception { - SshMachineLocation inuseMachine = origLoc.obtain(); - origApp.setAttribute(TestApplication.SERVICE_UP, true); // to force persist, and thus avoid race - - newApp = rebind(); - FixedListMachineProvisioningLocation<SshMachineLocation> newLoc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(newApp.getLocations(), 0); - - assertLocationIdsEqual(newLoc.getInUse(), origLoc.getInUse()); - assertLocationIdsEqual(newLoc.getAvailable(), origLoc.getAvailable()); + SshMachineLocation inuseMachine = origLoc.obtain(); + origApp.setAttribute(TestApplication.SERVICE_UP, true); // to force persist, and thus avoid race + + newApp = rebind(); + FixedListMachineProvisioningLocation<SshMachineLocation> newLoc = (FixedListMachineProvisioningLocation<SshMachineLocation>) Iterables.get(newApp.getLocations(), 0); + + assertLocationIdsEqual(newLoc.getInUse(), origLoc.getInUse()); + assertLocationIdsEqual(newLoc.getAvailable(), origLoc.getAvailable()); } private TestApplication rebind() throws Exception { @@ -116,14 +116,14 @@ public class FixedListMachineProvisioningLocationRebindTest { } private void assertLocationIdsEqual(Iterable<? extends Location> actual, Iterable<? extends Location> expected) { - Function<Location, String> locationIdFunction = new Function<Location, String>() { - @Override public String apply(@Nullable Location input) { - return (input != null) ? input.getId() : null; - } - }; - Set<String> actualIds = MutableSet.copyOf(Iterables.transform(actual, locationIdFunction)); - Set<String> expectedIds = MutableSet.copyOf(Iterables.transform(expected, locationIdFunction)); - - assertEquals(actualIds, expectedIds); + Function<Location, String> locationIdFunction = new Function<Location, String>() { + @Override public String apply(@Nullable Location input) { + return (input != null) ? input.getId() : null; + } + }; + Set<String> actualIds = MutableSet.copyOf(Iterables.transform(actual, locationIdFunction)); + Set<String> expectedIds = MutableSet.copyOf(Iterables.transform(expected, locationIdFunction)); + + assertEquals(actualIds, expectedIds); } }
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationTest.java b/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationTest.java index 40097bd..218820e 100644 --- a/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationTest.java +++ b/core/src/test/java/brooklyn/location/basic/FixedListMachineProvisioningLocationTest.java @@ -69,7 +69,7 @@ public class FixedListMachineProvisioningLocationTest { @Test public void testSetsChildLocations() throws NoMachinesAvailableException { // Available machines should be listed as children - assertEquals(ImmutableList.copyOf(provisioner.getChildren()), ImmutableList.of(machine)); + assertEquals(ImmutableList.copyOf(provisioner.getChildren()), ImmutableList.of(machine)); // In-use machines should also be listed as children provisioner.obtain(); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/location/basic/LegacyAbstractLocationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/location/basic/LegacyAbstractLocationTest.java b/core/src/test/java/brooklyn/location/basic/LegacyAbstractLocationTest.java index 8d97f3a..fa4f6d7 100644 --- a/core/src/test/java/brooklyn/location/basic/LegacyAbstractLocationTest.java +++ b/core/src/test/java/brooklyn/location/basic/LegacyAbstractLocationTest.java @@ -37,12 +37,12 @@ import com.google.common.collect.ImmutableList; public class LegacyAbstractLocationTest { private static class ConcreteLocation extends AbstractLocation { - @SetFromFlag(defaultVal="mydefault") + @SetFromFlag(defaultVal="mydefault") String myfield; public ConcreteLocation() { - super(); - } + super(); + } public ConcreteLocation(Map properties) { super(properties); @@ -138,7 +138,7 @@ public class LegacyAbstractLocationTest { @Test public void testFieldSetFromFlag() { - ConcreteLocation loc = new ConcreteLocation(MutableMap.of("myfield", "myval")); + ConcreteLocation loc = new ConcreteLocation(MutableMap.of("myfield", "myval")); assertEquals(loc.myfield, "myval"); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/location/basic/LocationExtensionsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/location/basic/LocationExtensionsTest.java b/core/src/test/java/brooklyn/location/basic/LocationExtensionsTest.java index 7431061..974fbfb 100644 --- a/core/src/test/java/brooklyn/location/basic/LocationExtensionsTest.java +++ b/core/src/test/java/brooklyn/location/basic/LocationExtensionsTest.java @@ -38,8 +38,8 @@ public class LocationExtensionsTest { private static final long serialVersionUID = 2407231019435442876L; public ConcreteLocation() { - super(); - } + super(); + } } public interface MyExtension { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/test/entity/TestEntityImpl.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/test/entity/TestEntityImpl.java b/core/src/test/java/brooklyn/test/entity/TestEntityImpl.java index cef1fee..c7952a4 100644 --- a/core/src/test/java/brooklyn/test/entity/TestEntityImpl.java +++ b/core/src/test/java/brooklyn/test/entity/TestEntityImpl.java @@ -45,10 +45,10 @@ import com.google.common.collect.Lists; public class TestEntityImpl extends AbstractEntity implements TestEntity { private static final Logger LOG = LoggerFactory.getLogger(TestEntityImpl.class); - protected int sequenceValue = 0; - protected AtomicInteger counter = new AtomicInteger(0); - protected Map<?,?> constructorProperties; - protected Map<?,?> configureProperties; + protected int sequenceValue = 0; + protected AtomicInteger counter = new AtomicInteger(0); + protected Map<?,?> constructorProperties; + protected Map<?,?> configureProperties; protected List<String> callHistory = Collections.synchronizedList(Lists.<String>newArrayList()); public TestEntityImpl() { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/util/internal/FlagUtilsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/util/internal/FlagUtilsTest.java b/core/src/test/java/brooklyn/util/internal/FlagUtilsTest.java index 293bd5e..2510eda 100644 --- a/core/src/test/java/brooklyn/util/internal/FlagUtilsTest.java +++ b/core/src/test/java/brooklyn/util/internal/FlagUtilsTest.java @@ -49,39 +49,39 @@ import com.google.common.collect.Iterables; public class FlagUtilsTest { - public static final Logger log = LoggerFactory.getLogger(FlagUtilsTest.class); - - @Test - public void testGetAllFields() { - log.info("types {}", FlagUtils.getAllAssignableTypes(Baz.class)); - assertEquals(FlagUtils.getAllAssignableTypes(Baz.class), ImmutableList.of(Baz.class, Foo.class, Bar.class)); - List<Field> fs = FlagUtils.getAllFields(Baz.class); - for (Field f : fs) { - log.info("field {} {}", f.getName(), f); - } - List<String> fsn = ImmutableList.copyOf(Iterables.transform(fs, new Function<Field, String>() { + public static final Logger log = LoggerFactory.getLogger(FlagUtilsTest.class); + + @Test + public void testGetAllFields() { + log.info("types {}", FlagUtils.getAllAssignableTypes(Baz.class)); + assertEquals(FlagUtils.getAllAssignableTypes(Baz.class), ImmutableList.of(Baz.class, Foo.class, Bar.class)); + List<Field> fs = FlagUtils.getAllFields(Baz.class); + for (Field f : fs) { + log.info("field {} {}", f.getName(), f); + } + List<String> fsn = ImmutableList.copyOf(Iterables.transform(fs, new Function<Field, String>() { @Override public String apply(Field f) { return f.getName(); }})); - assertTrue(fsn.indexOf("A") >= 0); - assertTrue(fsn.indexOf("w") > fsn.indexOf("A")); - assertTrue(fsn.indexOf("x") > fsn.indexOf("A") ); - assertTrue(fsn.indexOf("yNotY") > fsn.indexOf("A")); - assertTrue(fsn.indexOf("Z") > fsn.indexOf("yNotY") ); - } - + assertTrue(fsn.indexOf("A") >= 0); + assertTrue(fsn.indexOf("w") > fsn.indexOf("A")); + assertTrue(fsn.indexOf("x") > fsn.indexOf("A") ); + assertTrue(fsn.indexOf("yNotY") > fsn.indexOf("A")); + assertTrue(fsn.indexOf("Z") > fsn.indexOf("yNotY") ); + } + @Test public void testSetFieldsFromFlags() { Foo f = new Foo(); - Map<?,?> m = MutableMap.of("w", 3, "x", 1, "y", 7, "z", 9); + Map<?,?> m = MutableMap.of("w", 3, "x", 1, "y", 7, "z", 9); Map<?, ?> unused = FlagUtils.setFieldsFromFlags(m, f); - assertEquals(f.w, 3); + assertEquals(f.w, 3); assertEquals(f.x, 1); assertEquals(f.yNotY, 7); assertEquals(unused, ImmutableMap.of("z", 9)); - Map<?,?> m2 = FlagUtils.getFieldsWithValues(f); - m.remove("z"); - assertEquals(m2, m); + Map<?,?> m2 = FlagUtils.getFieldsWithValues(f); + m.remove("z"); + assertEquals(m2, m); } @Test @@ -220,22 +220,22 @@ public class FlagUtilsTest { } public static class Foo { - @SetFromFlag - int w; - - @SetFromFlag(immutable=true) - private int x; - - @SetFromFlag("y") - public int yNotY; + @SetFromFlag + int w; + + @SetFromFlag(immutable=true) + private int x; + + @SetFromFlag("y") + public int yNotY; } public static interface Bar { - static final String Z = "myzval"; + static final String Z = "myzval"; } public static class Baz extends Foo implements Bar { - @SuppressWarnings("unused") //inspected by reflection + @SuppressWarnings("unused") //inspected by reflection private static int A; } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/core/src/test/java/brooklyn/util/task/ScheduledExecutionTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/util/task/ScheduledExecutionTest.java b/core/src/test/java/brooklyn/util/task/ScheduledExecutionTest.java index 31dd5e0..65fe748 100644 --- a/core/src/test/java/brooklyn/util/task/ScheduledExecutionTest.java +++ b/core/src/test/java/brooklyn/util/task/ScheduledExecutionTest.java @@ -48,64 +48,64 @@ import com.google.common.collect.Lists; public class ScheduledExecutionTest { - public static final Logger log = LoggerFactory.getLogger(ScheduledExecutionTest.class); - - @Test - public void testScheduledTask() throws Exception { - int PERIOD = 20; - BasicExecutionManager m = new BasicExecutionManager("mycontextid"); - final AtomicInteger i = new AtomicInteger(0); - ScheduledTask t = new ScheduledTask(MutableMap.of("delay", 2*PERIOD, "period", PERIOD, "maxIterations", 5), new Callable<Task<?>>() { + public static final Logger log = LoggerFactory.getLogger(ScheduledExecutionTest.class); + + @Test + public void testScheduledTask() throws Exception { + int PERIOD = 20; + BasicExecutionManager m = new BasicExecutionManager("mycontextid"); + final AtomicInteger i = new AtomicInteger(0); + ScheduledTask t = new ScheduledTask(MutableMap.of("delay", 2*PERIOD, "period", PERIOD, "maxIterations", 5), new Callable<Task<?>>() { public Task<?> call() throws Exception { return new BasicTask<Integer>(new Callable<Integer>() { public Integer call() { - log.debug("task running: "+Tasks.current()+" "+Tasks.current().getStatusDetail(false)); - return i.incrementAndGet(); + log.debug("task running: "+Tasks.current()+" "+Tasks.current().getStatusDetail(false)); + return i.incrementAndGet(); }}); }}); - - log.info("submitting {} {}", t, t.getStatusDetail(false)); - m.submit(t); - log.info("submitted {} {}", t, t.getStatusDetail(false)); - Integer interimResult = (Integer) t.get(); - log.info("done one ({}) {} {}", new Object[] {interimResult, t, t.getStatusDetail(false)}); - assertTrue(i.get() > 0, "i="+i); - t.blockUntilEnded(); - Integer finalResult = (Integer) t.get(); - log.info("ended ({}) {} {}", new Object[] {finalResult, t, t.getStatusDetail(false)}); - assertEquals(finalResult, (Integer)5); - assertEquals(i.get(), 5); - } + + log.info("submitting {} {}", t, t.getStatusDetail(false)); + m.submit(t); + log.info("submitted {} {}", t, t.getStatusDetail(false)); + Integer interimResult = (Integer) t.get(); + log.info("done one ({}) {} {}", new Object[] {interimResult, t, t.getStatusDetail(false)}); + assertTrue(i.get() > 0, "i="+i); + t.blockUntilEnded(); + Integer finalResult = (Integer) t.get(); + log.info("ended ({}) {} {}", new Object[] {finalResult, t, t.getStatusDetail(false)}); + assertEquals(finalResult, (Integer)5); + assertEquals(i.get(), 5); + } - /** like testScheduledTask but the loop is terminated by the task itself adjusting the period */ - @Test - public void testScheduledTaskSelfEnding() throws Exception { - int PERIOD = 20; - BasicExecutionManager m = new BasicExecutionManager("mycontextid"); - final AtomicInteger i = new AtomicInteger(0); - ScheduledTask t = new ScheduledTask(MutableMap.of("delay", 2*PERIOD, "period", PERIOD), new Callable<Task<?>>() { - public Task<?> call() throws Exception { - return new BasicTask<Integer>(new Callable<Integer>() { - public Integer call() { - ScheduledTask submitter = (ScheduledTask) ((BasicTask)Tasks.current()).getSubmittedByTask(); - if (i.get() >= 4) submitter.period = null; - log.info("task running ("+i+"): "+Tasks.current()+" "+Tasks.current().getStatusDetail(false)); - return i.incrementAndGet(); - }}); - }}); - - log.info("submitting {} {}", t, t.getStatusDetail(false)); - m.submit(t); - log.info("submitted {} {}", t, t.getStatusDetail(false)); - Integer interimResult = (Integer) t.get(); - log.info("done one ({}) {} {}", new Object[] {interimResult, t, t.getStatusDetail(false)}); - assertTrue(i.get() > 0); - t.blockUntilEnded(); - Integer finalResult = (Integer) t.get(); - log.info("ended ({}) {} {}", new Object[] {finalResult, t, t.getStatusDetail(false)}); - assertEquals(finalResult, (Integer)5); - assertEquals(i.get(), 5); - } + /** like testScheduledTask but the loop is terminated by the task itself adjusting the period */ + @Test + public void testScheduledTaskSelfEnding() throws Exception { + int PERIOD = 20; + BasicExecutionManager m = new BasicExecutionManager("mycontextid"); + final AtomicInteger i = new AtomicInteger(0); + ScheduledTask t = new ScheduledTask(MutableMap.of("delay", 2*PERIOD, "period", PERIOD), new Callable<Task<?>>() { + public Task<?> call() throws Exception { + return new BasicTask<Integer>(new Callable<Integer>() { + public Integer call() { + ScheduledTask submitter = (ScheduledTask) ((BasicTask)Tasks.current()).getSubmittedByTask(); + if (i.get() >= 4) submitter.period = null; + log.info("task running ("+i+"): "+Tasks.current()+" "+Tasks.current().getStatusDetail(false)); + return i.incrementAndGet(); + }}); + }}); + + log.info("submitting {} {}", t, t.getStatusDetail(false)); + m.submit(t); + log.info("submitted {} {}", t, t.getStatusDetail(false)); + Integer interimResult = (Integer) t.get(); + log.info("done one ({}) {} {}", new Object[] {interimResult, t, t.getStatusDetail(false)}); + assertTrue(i.get() > 0); + t.blockUntilEnded(); + Integer finalResult = (Integer) t.get(); + log.info("ended ({}) {} {}", new Object[] {finalResult, t, t.getStatusDetail(false)}); + assertEquals(finalResult, (Integer)5); + assertEquals(i.get(), 5); + } @Test public void testScheduledTaskCancelEnding() throws Exception { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/Publish.java ---------------------------------------------------------------------- diff --git a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/Publish.java b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/Publish.java index 1aef6b6..22c0a60 100644 --- a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/Publish.java +++ b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/Publish.java @@ -50,16 +50,16 @@ public class Publish { try { // Create a producer for the queue - Queue destination = session.createQueue(QUEUE); - MessageProducer messageProducer = session.createProducer(destination); + Queue destination = session.createQueue(QUEUE); + MessageProducer messageProducer = session.createProducer(destination); - // Send 100 messages - for (int n = 0; n < 100; n++) { - String body = String.format("test message %03d", n+1); - TextMessage message = session.createTextMessage(body); - messageProducer.send(message); - System.out.printf("Sent message %s\n", body); - } + // Send 100 messages + for (int n = 0; n < 100; n++) { + String body = String.format("test message %03d", n+1); + TextMessage message = session.createTextMessage(body); + messageProducer.send(message); + System.out.printf("Sent message %s\n", body); + } } catch (Exception e) { System.err.printf("Error while sending - %s\n", e.getMessage()); System.err.printf("Cause: %s\n", Throwables.getStackTraceAsString(e)); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java ---------------------------------------------------------------------- diff --git a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java index 57400e3..82071ce 100644 --- a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java +++ b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java @@ -45,16 +45,16 @@ public class StandaloneQpidBrokerExample extends AbstractApplication { @Override public void initApp() { // Configure the Qpid broker entity - QpidBroker broker = addChild(EntitySpec.create(QpidBroker.class) - .configure("amqpPort", 5672) - .configure("amqpVersion", AmqpServer.AMQP_0_10) - .configure("runtimeFiles", ImmutableMap.builder() - .put(QpidBroker.CONFIG_XML, CUSTOM_CONFIG_PATH) - .put(QpidBroker.PASSWD, PASSWD_PATH) - .put("lib/opt/qpid-bdbstore-0.14.jar", QPID_BDBSTORE_JAR_PATH) - .put("lib/opt/je-5.0.34.jar", BDBSTORE_JAR_PATH) - .build()) - .configure("queue", "testQueue")); + QpidBroker broker = addChild(EntitySpec.create(QpidBroker.class) + .configure("amqpPort", 5672) + .configure("amqpVersion", AmqpServer.AMQP_0_10) + .configure("runtimeFiles", ImmutableMap.builder() + .put(QpidBroker.CONFIG_XML, CUSTOM_CONFIG_PATH) + .put(QpidBroker.PASSWD, PASSWD_PATH) + .put("lib/opt/qpid-bdbstore-0.14.jar", QPID_BDBSTORE_JAR_PATH) + .put("lib/opt/je-5.0.34.jar", BDBSTORE_JAR_PATH) + .build()) + .configure("queue", "testQueue")); } public static void main(String[] argv) { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java ---------------------------------------------------------------------- diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java index 325502f..7c441ee 100644 --- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java +++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java @@ -46,13 +46,13 @@ import com.google.common.collect.Lists; public class WideAreaCassandraCluster extends AbstractApplication { public static final String DEFAULT_LOCATION_SPEC = "aws-ec2:us-east-1,rackspace-cloudservers-uk"; - - @CatalogConfig(label="Initial Cluster Size (per location)", priority=2) + + @CatalogConfig(label="Initial Cluster Size (per location)", priority=2) public static final ConfigKey<Integer> CASSANDRA_CLUSTER_SIZE = ConfigKeys.newConfigKey( "cassandra.cluster.initialSize", "Initial size of the Cassandra clusterss", 2); - + @Override public void initApp() { addChild(EntitySpec.create(CassandraFabric.class) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java ---------------------------------------------------------------------- diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java index 706445f..44efa0c 100644 --- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java +++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java @@ -70,9 +70,9 @@ import com.google.common.collect.Lists; **/ @Catalog(name="Elastic Java Web + DB", description="Deploys a WAR to a load-balanced elastic Java AppServer cluster, " + - "with an auto-scaling policy, " + - "wired to a database initialized with the provided SQL; " + - "defaults to a 'Hello World' chatroom app.", + "with an auto-scaling policy, " + + "wired to a database initialized with the provided SQL; " + + "defaults to a 'Hello World' chatroom app.", iconUrl="classpath://brooklyn/demo/glossy-3d-blue-web-icon.png") public class WebClusterDatabaseExampleApp extends AbstractApplication implements StartableApplication { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/policy/src/main/java/brooklyn/policy/followthesun/WeightedObject.java ---------------------------------------------------------------------- diff --git a/policy/src/main/java/brooklyn/policy/followthesun/WeightedObject.java b/policy/src/main/java/brooklyn/policy/followthesun/WeightedObject.java index 6e9fd13..b1d506d 100644 --- a/policy/src/main/java/brooklyn/policy/followthesun/WeightedObject.java +++ b/policy/src/main/java/brooklyn/policy/followthesun/WeightedObject.java @@ -19,53 +19,53 @@ package brooklyn.policy.followthesun; public class WeightedObject<T> implements Comparable<WeightedObject<T>>{ - - final T object; - final double weight; - - public WeightedObject(T obj, double weight) { - this.object = obj; - this.weight = weight; - } - - public T getObject() { - return object; - } - - public double getWeight() { - return weight; - } + + final T object; + final double weight; + + public WeightedObject(T obj, double weight) { + this.object = obj; + this.weight = weight; + } + + public T getObject() { + return object; + } + + public double getWeight() { + return weight; + } - /** - * Note that equals and compareTo are not consistent: x.compareTo(y)==0 iff x.equals(y) is - * highly recommended in Java, but is not required. This can make TreeSet etc behave poorly... - */ - public int compareTo(WeightedObject<T> o) { - double diff = o.getWeight() - weight; - if (diff>0.0000000000000001) return -1; - if (diff<-0.0000000000000001) return 1; - return 0; - } + /** + * Note that equals and compareTo are not consistent: x.compareTo(y)==0 iff x.equals(y) is + * highly recommended in Java, but is not required. This can make TreeSet etc behave poorly... + */ + public int compareTo(WeightedObject<T> o) { + double diff = o.getWeight() - weight; + if (diff>0.0000000000000001) return -1; + if (diff<-0.0000000000000001) return 1; + return 0; + } - @Override - /** true irrespective of weight */ - public boolean equals(Object obj) { - if (!(obj instanceof WeightedObject<?>)) return false; - if (getObject()==null) { - return ((WeightedObject<?>)obj).getObject() == null; - } else { - return getObject().equals( ((WeightedObject<?>)obj).getObject() ); - } - } - - @Override - public int hashCode() { - if (getObject()==null) return 234519078; - return getObject().hashCode(); - } - - @Override - public String toString() { - return ""+getObject()+"["+getWeight()+"]"; - } + @Override + /** true irrespective of weight */ + public boolean equals(Object obj) { + if (!(obj instanceof WeightedObject<?>)) return false; + if (getObject()==null) { + return ((WeightedObject<?>)obj).getObject() == null; + } else { + return getObject().equals( ((WeightedObject<?>)obj).getObject() ); + } + } + + @Override + public int hashCode() { + if (getObject()==null) return 234519078; + return getObject().hashCode(); + } + + @Override + public String toString() { + return ""+getObject()+"["+getWeight()+"]"; + } } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/policy/src/main/java/brooklyn/policy/loadbalancing/DefaultBalanceablePoolModel.java ---------------------------------------------------------------------- diff --git a/policy/src/main/java/brooklyn/policy/loadbalancing/DefaultBalanceablePoolModel.java b/policy/src/main/java/brooklyn/policy/loadbalancing/DefaultBalanceablePoolModel.java index 2961a61..9722f78 100644 --- a/policy/src/main/java/brooklyn/policy/loadbalancing/DefaultBalanceablePoolModel.java +++ b/policy/src/main/java/brooklyn/policy/loadbalancing/DefaultBalanceablePoolModel.java @@ -159,7 +159,7 @@ public class DefaultBalanceablePoolModel<ContainerType, ItemType> implements Bal // Item may have been deleted; order of events received from different sources // (i.e. item itself and for itemGroup membership) is non-deterministic. LOG.info("Balanceable pool model ignoring onItemMoved for unknown item {} to container {}; " + - "if onItemAdded subsequently received will get new container then", item, newNode); + "if onItemAdded subsequently received will get new container then", item, newNode); return; } ContainerType newNodeNonNull = toNonNullContainer(newNode); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/sandbox/database/src/main/java/brooklyn/entity/database/derby/DerbyDatabase.java ---------------------------------------------------------------------- diff --git a/sandbox/database/src/main/java/brooklyn/entity/database/derby/DerbyDatabase.java b/sandbox/database/src/main/java/brooklyn/entity/database/derby/DerbyDatabase.java index 5143e36..aad881f 100644 --- a/sandbox/database/src/main/java/brooklyn/entity/database/derby/DerbyDatabase.java +++ b/sandbox/database/src/main/java/brooklyn/entity/database/derby/DerbyDatabase.java @@ -123,7 +123,7 @@ public class DerbyDatabase extends SoftwareProcessImpl implements Database, Uses @Override public void preStop() { - super.preStop(); + super.preStop(); for (DerbySchema schema : schemas.values()) { schema.destroy(); } @@ -148,7 +148,7 @@ public class DerbyDatabase extends SoftwareProcessImpl implements Database, Uses public void addSchema(Schema schema) { schemas.put(schema.getName(), (DerbySchema) schema); - } + } public void removeSchema(String schemaName) { schemas.remove(schemaName); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/sandbox/nosql/src/main/java/brooklyn/entity/nosql/infinispan/Infinispan5Server.java ---------------------------------------------------------------------- diff --git a/sandbox/nosql/src/main/java/brooklyn/entity/nosql/infinispan/Infinispan5Server.java b/sandbox/nosql/src/main/java/brooklyn/entity/nosql/infinispan/Infinispan5Server.java index eaaee45..e029cf1 100644 --- a/sandbox/nosql/src/main/java/brooklyn/entity/nosql/infinispan/Infinispan5Server.java +++ b/sandbox/nosql/src/main/java/brooklyn/entity/nosql/infinispan/Infinispan5Server.java @@ -76,8 +76,8 @@ public class Infinispan5Server extends SoftwareProcessImpl implements UsesJmx { @Override protected void connectSensors() { - super.connectSensors(); - super.connectServiceUpIsRunning(); + super.connectSensors(); + super.connectServiceUpIsRunning(); } @Override http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java index 99401c1..1c38d42 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java +++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java @@ -104,7 +104,7 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP getRunDir(); } - /** returns location (tighten type, since we know it is an ssh machine location here) */ + /** returns location (tighten type, since we know it is an ssh machine location here) */ public SshMachineLocation getLocation() { return (SshMachineLocation) super.getLocation(); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java index e264dab..df20ee2 100644 --- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java +++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcessImpl.java @@ -69,9 +69,9 @@ import com.google.common.collect.Iterables; * It exposes sensors for service state (Lifecycle) and status (String), and for host info, log file location. */ public abstract class SoftwareProcessImpl extends AbstractEntity implements SoftwareProcess, DriverDependentEntity { - private static final Logger log = LoggerFactory.getLogger(SoftwareProcessImpl.class); + private static final Logger log = LoggerFactory.getLogger(SoftwareProcessImpl.class); - private transient SoftwareProcessDriver driver; + private transient SoftwareProcessDriver driver; /** @see #connectServiceUpIsRunning() */ private volatile FunctionFeed serviceProcessIsRunning; @@ -90,9 +90,9 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft public SoftwareProcessImpl(Map properties) { this(properties, null); } - public SoftwareProcessImpl(Map properties, Entity parent) { - super(properties, parent); - } + public SoftwareProcessImpl(Map properties, Entity parent) { + super(properties, parent); + } protected void setProvisioningLocation(MachineProvisioningLocation val) { if (getAttribute(PROVISIONING_LOCATION) != null) throw new IllegalStateException("Cannot change provisioning location: existing="+getAttribute(PROVISIONING_LOCATION)+"; new="+val); @@ -103,11 +103,11 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft return getAttribute(PROVISIONING_LOCATION); } - public SoftwareProcessDriver getDriver() { - return driver; - } + public SoftwareProcessDriver getDriver() { + return driver; + } - protected SoftwareProcessDriver newDriver(MachineLocation loc){ + protected SoftwareProcessDriver newDriver(MachineLocation loc){ EntityDriverManager entityDriverManager = getManagementContext().getEntityDriverManager(); return (SoftwareProcessDriver)entityDriverManager.build(this, loc); } @@ -125,9 +125,9 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft .build()); } - /** - * Called before driver.start; guarantees the driver will exist, and locations will have been set. - */ + /** + * Called before driver.start; guarantees the driver will exist, and locations will have been set. + */ protected void preStart() { } @@ -254,9 +254,9 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft ServiceStateLogic.setExpectedState(this, Lifecycle.CREATED); // force actual to be created because this is expected subsequently setAttribute(SERVICE_STATE_ACTUAL, Lifecycle.CREATED); - } + } } - + @Override public void onManagementStarted() { super.onManagementStarted(); @@ -323,8 +323,8 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft protected final void startInLocation(Location location) {} /** @deprecated since 0.6.0 use/override method in {@link SoftwareProcessDriverLifecycleEffectorTasks} */ - protected final void startInLocation(final MachineProvisioningLocation<?> location) {} - + protected final void startInLocation(final MachineProvisioningLocation<?> location) {} + /** @deprecated since 0.6.0 use/override method in {@link SoftwareProcessDriverLifecycleEffectorTasks} */ protected final void startInLocation(MachineLocation machine) {} @@ -360,7 +360,7 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft /** @deprecated since 0.6.0 use {@link Machines#findSubnetHostname(Entity)} */ @Deprecated public String getLocalHostname() { return Machines.findSubnetHostname(this).get(); - } + } protected void initDriver(MachineLocation machine) { SoftwareProcessDriver newDriver = doInitDriver(machine); @@ -387,7 +387,7 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft } } - // TODO Find a better way to detect early death of process. + // TODO Find a better way to detect early death of process. public void waitForEntityStart() { if (log.isDebugEnabled()) log.debug("waiting to ensure {} doesn't abort prematurely", this); Duration startTimeout = getConfig(START_TIMEOUT); @@ -435,14 +435,14 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft * If custom behaviour is required by sub-classes, consider overriding {@link #doStop()}. */ @Override - public final void stop() { - // TODO There is a race where we set SERVICE_UP=false while sensor-adapter threads may still be polling. + public final void stop() { + // TODO There is a race where we set SERVICE_UP=false while sensor-adapter threads may still be polling. // The other thread might reset SERVICE_UP to true immediately after we set it to false here. // Deactivating adapters before setting SERVICE_UP reduces the race, and it is reduced further by setting // SERVICE_UP to false at the end of stop as well. - - // Perhaps we should wait until all feeds have completed here, - // or do a SERVICE_STATE check before setting SERVICE_UP to true in a feed (?). + + // Perhaps we should wait until all feeds have completed here, + // or do a SERVICE_STATE check before setting SERVICE_UP to true in a feed (?). if (DynamicTasks.getTaskQueuingContext() != null) { doStop(); @@ -450,7 +450,7 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft Task<?> task = Tasks.builder().name("stop").body(new Runnable() { public void run() { doStop(); } }).build(); Entities.submit(this, task).getUnchecked(); } - } + } /** * If custom behaviour is required by sub-classes, consider overriding {@link #doRestart()}. @@ -480,7 +480,7 @@ public abstract class SoftwareProcessImpl extends AbstractEntity implements Soft protected void doStop() { LIFECYCLE_TASKS.stop(); } - + /** * To be overridden instead of {@link #restart()}; sub-classes should call {@code super.doRestart()} and should * add do additional work via tasks, executed using {@link DynamicTasks#queue(String, Callable)}. http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/main/java/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java b/software/base/src/main/java/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java index f257989..8f7ee31 100644 --- a/software/base/src/main/java/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java +++ b/software/base/src/main/java/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java @@ -103,7 +103,7 @@ public class ChefLifecycleEffectorTasks extends MachineLifecycleEffectorTasks im if (getPidFile()==null && getServiceName()==null && getClass().equals(ChefLifecycleEffectorTasks.class)) { // warn on incorrect usage log.warn("Uses of "+getClass()+" must define a PID file or a service name (or subclass and override {start,stop} methods as per javadoc) " + - "in order for check-running and stop to work"); + "in order for check-running and stop to work"); } super.attachLifecycleEffectors(entity); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/main/java/brooklyn/entity/java/UsesJava.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/entity/java/UsesJava.java b/software/base/src/main/java/brooklyn/entity/java/UsesJava.java index 44becf9..a0d97f8 100644 --- a/software/base/src/main/java/brooklyn/entity/java/UsesJava.java +++ b/software/base/src/main/java/brooklyn/entity/java/UsesJava.java @@ -59,6 +59,6 @@ public interface UsesJava { public static final ConfigKey<Boolean> CHECK_JAVA_HOSTNAME_BUG = ConfigKeys.newBooleanConfigKey( "java.check.hostname.bug", "Check whether hostname is too long and will likely crash Java" + - "due to bug 7089443", true); + "due to bug 7089443", true); } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java b/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java index 6ea4933..24d95b5 100644 --- a/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java +++ b/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java @@ -90,9 +90,9 @@ import com.google.common.reflect.TypeToken; */ public class JmxFeed extends AbstractFeed { - public static final Logger log = LoggerFactory.getLogger(JmxFeed.class); + public static final Logger log = LoggerFactory.getLogger(JmxFeed.class); - public static final long JMX_CONNECTION_TIMEOUT_MS = 120*1000; + public static final long JMX_CONNECTION_TIMEOUT_MS = 120*1000; public static final ConfigKey<JmxHelper> HELPER = ConfigKeys.newConfigKey(JmxHelper.class, "helper"); public static final ConfigKey<Boolean> OWN_HELPER = ConfigKeys.newBooleanConfigKey("ownHelper"); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/test/java/brooklyn/entity/java/EntityPollingTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/brooklyn/entity/java/EntityPollingTest.java b/software/base/src/test/java/brooklyn/entity/java/EntityPollingTest.java index 4aeeef5..4b6f1fb 100644 --- a/software/base/src/test/java/brooklyn/entity/java/EntityPollingTest.java +++ b/software/base/src/test/java/brooklyn/entity/java/EntityPollingTest.java @@ -140,7 +140,7 @@ public class EntityPollingTest { if (jmxService != null) jmxService.shutdown(); } - // Tests that the happy path works + // Tests that the happy path works @Test(groups="Integration") public void testSimpleConnection() throws Exception { jmxService = new JmxService("localhost", 40123); @@ -152,10 +152,10 @@ public class EntityPollingTest { EntityTestUtils.assertAttributeEqualsEventually(entity, stringAttribute, "myval"); } - // Test that connect will keep retrying (e.g. start script returns before the JMX server is up) + // Test that connect will keep retrying (e.g. start script returns before the JMX server is up) @Test(groups="Integration") public void testEntityWithDelayedJmxStartupWillKeepRetrying() { - // In 2 seconds time, we'll start the JMX server + // In 2 seconds time, we'll start the JMX server Thread t = new Thread(new Runnable() { public void run() { try { @@ -192,7 +192,7 @@ public class EntityPollingTest { jmxService.shutdown(); // TODO Want a better way of determining that the entity is down; ideally should have - // sensor for entity-down that's wired up to a JMX attribute? + // sensor for entity-down that's wired up to a JMX attribute? Thread.sleep(5000); // Restart MBeanServer, and set attribute to different value; expect it to be polled again http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/base/src/test/java/brooklyn/entity/java/JmxSupportTest.java ---------------------------------------------------------------------- diff --git a/software/base/src/test/java/brooklyn/entity/java/JmxSupportTest.java b/software/base/src/test/java/brooklyn/entity/java/JmxSupportTest.java index 8bd3547..9828ff6 100644 --- a/software/base/src/test/java/brooklyn/entity/java/JmxSupportTest.java +++ b/software/base/src/test/java/brooklyn/entity/java/JmxSupportTest.java @@ -123,7 +123,7 @@ public class JmxSupportTest { log.info("read "+bytes.length+" bytes from "+url+" for "+JavaClassNames.callerNiceClassAndMethod(1)); } catch (Exception e) { log.warn("Unable to read URL "+url+" for " +JavaClassNames.callerNiceClassAndMethod(1)+ - "; this test may require hosted (sonatype/mavencentral) repo to be populated"); + "; this test may require hosted (sonatype/mavencentral) repo to be populated"); Assert.fail("Unable to read URL "+url+"; this test may require hosted (sonatype/mavencentral) repo to be populated"); throw Exceptions.propagate(e); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java index 474561c..24090a1 100644 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java +++ b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBroker.java @@ -57,7 +57,7 @@ public interface ActiveMQBroker extends SoftwareProcess, MessageBroker, UsesJmx, "http://www.mirrorservice.org/sites/ftp.apache.org/activemq/apache-activemq"); @SetFromFlag("openWirePort") - public static final PortAttributeSensorAndConfigKey OPEN_WIRE_PORT = new PortAttributeSensorAndConfigKey("openwire.port", "OpenWire port", "61616+"); + public static final PortAttributeSensorAndConfigKey OPEN_WIRE_PORT = new PortAttributeSensorAndConfigKey("openwire.port", "OpenWire port", "61616+"); @SetFromFlag("jettyPort") public static final PortAttributeSensorAndConfigKey AMQ_JETTY_PORT = new PortAttributeSensorAndConfigKey("activemq.jetty.port", "jetty port", "8161+"); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java index 5ca3867..8219daa 100644 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java +++ b/software/messaging/src/main/java/brooklyn/entity/messaging/activemq/ActiveMQBrokerImpl.java @@ -38,7 +38,7 @@ import com.google.common.base.Predicates; * An {@link brooklyn.entity.Entity} that represents a single ActiveMQ broker instance. */ public class ActiveMQBrokerImpl extends JMSBrokerImpl<ActiveMQQueue, ActiveMQTopic> implements ActiveMQBroker { - private static final Logger log = LoggerFactory.getLogger(ActiveMQBrokerImpl.class); + private static final Logger log = LoggerFactory.getLogger(ActiveMQBrokerImpl.class); private volatile JmxFeed jmxFeed; @@ -52,10 +52,10 @@ public class ActiveMQBrokerImpl extends JMSBrokerImpl<ActiveMQQueue, ActiveMQTop Entities.getRequiredUrlConfig(this, TEMPLATE_CONFIGURATION_URL); } - public void setBrokerUrl() { - setAttribute(BROKER_URL, String.format("tcp://%s:%d", getAttribute(HOSTNAME), getAttribute(OPEN_WIRE_PORT))); - } - + public void setBrokerUrl() { + setAttribute(BROKER_URL, String.format("tcp://%s:%d", getAttribute(HOSTNAME), getAttribute(OPEN_WIRE_PORT))); + } + public Integer getJmxPort() { return !isJmxEnabled() ? Integer.valueOf(-1) : getAttribute(UsesJmx.JMX_PORT); } @@ -69,20 +69,20 @@ public class ActiveMQBrokerImpl extends JMSBrokerImpl<ActiveMQQueue, ActiveMQTop } @Override - public ActiveMQQueue createQueue(Map properties) { - ActiveMQQueue result = addChild(EntitySpec.create(ActiveMQQueue.class).configure(properties)); + public ActiveMQQueue createQueue(Map properties) { + ActiveMQQueue result = addChild(EntitySpec.create(ActiveMQQueue.class).configure(properties)); Entities.manage(result); result.create(); return result; - } + } @Override - public ActiveMQTopic createTopic(Map properties) { - ActiveMQTopic result = addChild(EntitySpec.create(ActiveMQTopic.class).configure(properties)); + public ActiveMQTopic createTopic(Map properties) { + ActiveMQTopic result = addChild(EntitySpec.create(ActiveMQTopic.class).configure(properties)); Entities.manage(result); result.create(); return result; - } + } @Override protected void connectSensors() { @@ -107,7 +107,7 @@ public class ActiveMQBrokerImpl extends JMSBrokerImpl<ActiveMQQueue, ActiveMQTop if (jmxFeed != null) jmxFeed.stop(); } - @Override + @Override protected ToStringHelper toStringHelper() { return super.toStringHelper().add("openWirePort", getAttribute(OPEN_WIRE_PORT)); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java index fa69522..43f13ba 100644 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java +++ b/software/messaging/src/main/java/brooklyn/entity/messaging/jms/JMSBrokerImpl.java @@ -90,10 +90,10 @@ public abstract class JMSBrokerImpl<Q extends JMSDestination & Queue, T extends // should be called after sensor-polling is activated etc @Override protected void postStart() { - super.postStart(); - // stupid to do this here, but there appears to be a race where sometimes the - // broker throws a BrokerStopped exception, even though the sensor indicates it is up - Time.sleep(Duration.FIVE_SECONDS); + super.postStart(); + // stupid to do this here, but there appears to be a race where sometimes the + // broker throws a BrokerStopped exception, even though the sensor indicates it is up + Time.sleep(Duration.FIVE_SECONDS); for (String name : queueNames) { addQueue(name); } @@ -101,7 +101,7 @@ public abstract class JMSBrokerImpl<Q extends JMSDestination & Queue, T extends addTopic(name); } } - + @Override public abstract void setBrokerUrl(); @@ -127,7 +127,7 @@ public abstract class JMSBrokerImpl<Q extends JMSDestination & Queue, T extends super.preStop(); } - + @Override public void addQueue(String name) { addQueue(name, MutableMap.of()); @@ -143,7 +143,7 @@ public abstract class JMSBrokerImpl<Q extends JMSDestination & Queue, T extends @Override public void addQueue(String name, Map properties) { - checkStartingOrRunning(); + checkStartingOrRunning(); properties.put("name", name); queues.put(name, createQueue(properties)); } @@ -158,7 +158,7 @@ public abstract class JMSBrokerImpl<Q extends JMSDestination & Queue, T extends @Override public void addTopic(String name, Map properties) { - checkStartingOrRunning(); + checkStartingOrRunning(); properties.put("name", name); topics.put(name, createTopic(properties)); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/messaging/src/main/java/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/main/java/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java b/software/messaging/src/main/java/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java index 51cba1c..91b6d06 100644 --- a/software/messaging/src/main/java/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java +++ b/software/messaging/src/main/java/brooklyn/entity/messaging/rabbit/RabbitBrokerImpl.java @@ -65,7 +65,7 @@ public class RabbitBrokerImpl extends SoftwareProcessImpl implements RabbitBroke getDriver().configure(); // TODO implement this using AMQP connection, no external mechanism available - // queueNames.each { String name -> addQueue(name) } + // queueNames.each { String name -> addQueue(name) } } public void setBrokerUrl() { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/messaging/src/test/java/brooklyn/entity/messaging/rabbit/RabbitIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/messaging/src/test/java/brooklyn/entity/messaging/rabbit/RabbitIntegrationTest.java b/software/messaging/src/test/java/brooklyn/entity/messaging/rabbit/RabbitIntegrationTest.java index 9afabe8..0d5c2d4 100644 --- a/software/messaging/src/test/java/brooklyn/entity/messaging/rabbit/RabbitIntegrationTest.java +++ b/software/messaging/src/test/java/brooklyn/entity/messaging/rabbit/RabbitIntegrationTest.java @@ -107,12 +107,12 @@ public class RabbitIntegrationTest { Channel producer = null; Channel consumer = null; try { - producer = getAmqpChannel(rabbit); - consumer = getAmqpChannel(rabbit); + producer = getAmqpChannel(rabbit); + consumer = getAmqpChannel(rabbit); - producer.queueDeclare(queue, true, false, false, ImmutableMap.<String,Object>of()); - producer.queueBind(queue, AmqpExchange.DIRECT, queue); - producer.basicPublish(AmqpExchange.DIRECT, queue, null, content); + producer.queueDeclare(queue, true, false, false, ImmutableMap.<String,Object>of()); + producer.queueBind(queue, AmqpExchange.DIRECT, queue); + producer.basicPublish(AmqpExchange.DIRECT, queue, null, content); QueueingConsumer queueConsumer = new QueueingConsumer(consumer); consumer.basicConsume(queue, true, queueConsumer); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/monitoring/src/test/java/brooklyn/entity/monitoring/monit/MonitIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/monitoring/src/test/java/brooklyn/entity/monitoring/monit/MonitIntegrationTest.java b/software/monitoring/src/test/java/brooklyn/entity/monitoring/monit/MonitIntegrationTest.java index 0c9a1e6..aaf246a 100644 --- a/software/monitoring/src/test/java/brooklyn/entity/monitoring/monit/MonitIntegrationTest.java +++ b/software/monitoring/src/test/java/brooklyn/entity/monitoring/monit/MonitIntegrationTest.java @@ -177,10 +177,10 @@ public class MonitIntegrationTest { LOG.debug("MonitNode target status: {}", targetStatus); assertEquals(elvis(targetStatus, ""), "Running"); try { - initialPid[0] = Files.readFirstLine(new File(mySqlNode.getAttribute(SoftwareProcess.PID_FILE)), Charset.defaultCharset()); - LOG.debug("Initial PID: {}", initialPid[0]); + initialPid[0] = Files.readFirstLine(new File(mySqlNode.getAttribute(SoftwareProcess.PID_FILE)), Charset.defaultCharset()); + LOG.debug("Initial PID: {}", initialPid[0]); } catch (IOException e) { - Asserts.fail("Could not read PID file: " + e); + Asserts.fail("Could not read PID file: " + e); } } }); @@ -197,14 +197,14 @@ public class MonitIntegrationTest { Asserts.succeedsEventually(new Runnable() { @Override public void run() { - try { - String pidFileLocation = mySqlNode.getAttribute(SoftwareProcess.PID_FILE); - String newPid = Files.readFirstLine(new File(pidFileLocation), Charset.defaultCharset()); - LOG.debug("Old PID: {}, New PID: {} read from PID file: {}", new String[] {initialPid[0], newPid, pidFileLocation}); - assertNotEquals(initialPid[0], newPid, "Process PID has not changed"); - } catch (IOException e) { - Asserts.fail("Could not read PID file: " + e); - } + try { + String pidFileLocation = mySqlNode.getAttribute(SoftwareProcess.PID_FILE); + String newPid = Files.readFirstLine(new File(pidFileLocation), Charset.defaultCharset()); + LOG.debug("Old PID: {}, New PID: {} read from PID file: {}", new String[] {initialPid[0], newPid, pidFileLocation}); + assertNotEquals(initialPid[0], newPid, "Process PID has not changed"); + } catch (IOException e) { + Asserts.fail("Could not read PID file: " + e); + } String targetStatus = monitNode.getAttribute(MonitNode.MONIT_TARGET_PROCESS_STATUS); LOG.debug("MonitNode target status: {}", targetStatus); assertEquals(elvis(targetStatus, ""), "Running"); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java ---------------------------------------------------------------------- diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java index e3c17e1..98ab1d3 100644 --- a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java +++ b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/ReplicaSetConfig.java @@ -38,13 +38,13 @@ import com.google.common.net.HostAndPort; * A configuration object is structured like this: * <pre> * { - * "_id" : "replica-set-name", - * "version" : 3, - * "members" : [ - * { "_id" : 0, "host" : "Sams.local:27017" }, - * { "_id" : 1, "host" : "Sams.local:27018" }, - * { "_id" : 2, "host" : "Sams.local:27019" } - * ] + * "_id" : "replica-set-name", + * "version" : 3, + * "members" : [ + * { "_id" : 0, "host" : "Sams.local:27017" }, + * { "_id" : 1, "host" : "Sams.local:27018" }, + * { "_id" : 2, "host" : "Sams.local:27019" } + * ] * } * </pre> * To add or remove servers to a replica set you must redefine this configuration @@ -199,12 +199,12 @@ public class ReplicaSetConfig { * <pre> * WARN emptying DBPortPool to sams.home/192.168.1.64:27019 b/c of error * java.io.EOFException: null - * at org.bson.io.Bits.readFully(Bits.java:48) ~[mongo-java-driver-2.11.3.jar:na] + * at org.bson.io.Bits.readFully(Bits.java:48) ~[mongo-java-driver-2.11.3.jar:na] * WARN Command { "replSetReconfig" : ... } on sams.home/192.168.1.64:27019 failed * com.mongodb.MongoException$Network: Read operation to server sams.home/192.168.1.64:27019 failed on database admin - * at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:253) ~[mongo-java-driver-2.11.3.jar:na] + * at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:253) ~[mongo-java-driver-2.11.3.jar:na] * Caused by: java.io.EOFException: null - * at org.bson.io.Bits.readFully(Bits.java:48) ~[mongo-java-driver-2.11.3.jar:na] + * at org.bson.io.Bits.readFully(Bits.java:48) ~[mongo-java-driver-2.11.3.jar:na] * </pre> * * The MongoDB documentation on <a href=http://docs.mongodb.org/manual/tutorial/configure-a-non-voting-replica-set-member/"> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBIntegrationTest.java b/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBIntegrationTest.java index 36c4568..5884122 100644 --- a/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBIntegrationTest.java +++ b/software/nosql/src/test/java/brooklyn/entity/nosql/mongodb/MongoDBIntegrationTest.java @@ -43,7 +43,7 @@ public class MongoDBIntegrationTest { @BeforeMethod(alwaysRun=true) public void setUp() throws Exception { - localhostProvisioningLocation = new LocalhostMachineProvisioningLocation(); + localhostProvisioningLocation = new LocalhostMachineProvisioningLocation(); app = ApplicationBuilder.newManagedApp(TestApplication.class); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java index f4eb091..48fda9b 100644 --- a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java +++ b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsService.java @@ -51,7 +51,7 @@ public interface GeoscalingDnsService extends AbstractGeoDnsService { public static final AttributeSensor<String> ROOT_URL = WebAppServiceConstants.ROOT_URL; public static final AttributeSensor<String> MANAGED_DOMAIN = new BasicAttributeSensor<String>( String.class, "geoscaling.managed.domain", "Fully qualified domain name that will be geo-redirected; " + - "this will be the same as "+ROOT_URL.getName()+" but the latter will only be set when the domain has active targets"); + "this will be the same as "+ROOT_URL.getName()+" but the latter will only be set when the domain has active targets"); public void applyConfig(); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java index 7e470ca..d22d4c7 100644 --- a/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java +++ b/software/webapp/src/main/java/brooklyn/entity/dns/geoscaling/GeoscalingDnsServiceImpl.java @@ -77,9 +77,9 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl implemen super.onManagementBecomingMaster(); } - boolean isConfigured = false; - - public synchronized void applyConfig() { + boolean isConfigured = false; + + public synchronized void applyConfig() { randomizeSmartSubdomainName = getConfig(RANDOMIZE_SUBDOMAIN_NAME); username = getConfig(GEOSCALING_USERNAME); password = getConfig(GEOSCALING_PASSWORD); @@ -140,8 +140,8 @@ public class GeoscalingDnsServiceImpl extends AbstractGeoDnsServiceImpl implemen } super.destroy(); - - isConfigured = false; + + isConfigured = false; } protected void reconfigureService(Collection<HostGeoInfo> targetHosts) { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/main/java/brooklyn/entity/webapp/DynamicWebAppFabricImpl.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/DynamicWebAppFabricImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/DynamicWebAppFabricImpl.java index 4023748..3a8d0be 100644 --- a/software/webapp/src/main/java/brooklyn/entity/webapp/DynamicWebAppFabricImpl.java +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/DynamicWebAppFabricImpl.java @@ -36,11 +36,11 @@ public class DynamicWebAppFabricImpl extends DynamicFabricImpl implements Dynami // Enricher attribute setup. A way of automatically discovering these (but avoiding // averaging things like HTTP port and response codes) would be neat. List<? extends List<? extends AttributeSensor<? extends Number>>> summingEnricherSetup = ImmutableList.of( - ImmutableList.of(REQUEST_COUNT, REQUEST_COUNT), - ImmutableList.of(ERROR_COUNT, ERROR_COUNT), - ImmutableList.of(REQUESTS_PER_SECOND_LAST, REQUESTS_PER_SECOND_LAST), - ImmutableList.of(REQUESTS_PER_SECOND_IN_WINDOW, REQUESTS_PER_SECOND_IN_WINDOW), - ImmutableList.of(TOTAL_PROCESSING_TIME, TOTAL_PROCESSING_TIME) + ImmutableList.of(REQUEST_COUNT, REQUEST_COUNT), + ImmutableList.of(ERROR_COUNT, ERROR_COUNT), + ImmutableList.of(REQUESTS_PER_SECOND_LAST, REQUESTS_PER_SECOND_LAST), + ImmutableList.of(REQUESTS_PER_SECOND_IN_WINDOW, REQUESTS_PER_SECOND_IN_WINDOW), + ImmutableList.of(TOTAL_PROCESSING_TIME, TOTAL_PROCESSING_TIME) ); List<? extends List<? extends AttributeSensor<? extends Number>>> averagingEnricherSetup = ImmutableList.of( http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppService.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppService.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppService.java index 1317ef0..52b090d 100644 --- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppService.java +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppService.java @@ -35,14 +35,14 @@ import brooklyn.util.flags.SetFromFlag; public interface JavaWebAppService extends WebAppService, UsesJava { - @SetFromFlag("war") - public static final ConfigKey<String> ROOT_WAR = new BasicConfigKey<String>( - String.class, "wars.root", "WAR file to deploy as the ROOT, as URL (supporting file: and classpath: prefixes)"); + @SetFromFlag("war") + public static final ConfigKey<String> ROOT_WAR = new BasicConfigKey<String>( + String.class, "wars.root", "WAR file to deploy as the ROOT, as URL (supporting file: and classpath: prefixes)"); @SuppressWarnings({ "unchecked", "rawtypes" }) @SetFromFlag("wars") - public static final ConfigKey<List<String>> NAMED_WARS = new BasicConfigKey( - List.class, "wars.named", "Archive files to deploy, as URL strings (supporting file: and classpath: prefixes); context (path in user-facing URL) will be inferred by name"); + public static final ConfigKey<List<String>> NAMED_WARS = new BasicConfigKey( + List.class, "wars.named", "Archive files to deploy, as URL strings (supporting file: and classpath: prefixes); context (path in user-facing URL) will be inferred by name"); @SuppressWarnings({ "unchecked", "rawtypes" }) @SetFromFlag("warsByContext") http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java index 9ab0038..76491ce 100644 --- a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java @@ -42,7 +42,7 @@ import com.google.common.net.HostAndPort; public class JBoss7ServerImpl extends JavaWebAppSoftwareProcessImpl implements JBoss7Server { - public static final Logger log = LoggerFactory.getLogger(JBoss7ServerImpl.class); + public static final Logger log = LoggerFactory.getLogger(JBoss7ServerImpl.class); private volatile HttpFeed httpFeed; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java index f731eca..b704b58 100644 --- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java @@ -68,41 +68,41 @@ public class NginxRebindIntegrationTest extends RebindTestFixtureWithApp { private URL warUrl; private LocalhostMachineProvisioningLocation localhostProvisioningLocation; private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>(); - private ExecutorService executor; + private ExecutorService executor; + + @Override + protected boolean useLiveManagementContext() { + // For Aled, the test failed without own ~/.brooklyn/brooklyn.properties. + // Suspect that was caused by local environment, with custom brooklyn.ssh.config.scriptHeader + // to set things like correct Java on path. + return true; + } - @Override - protected boolean useLiveManagementContext() { - // For Aled, the test failed without own ~/.brooklyn/brooklyn.properties. - // Suspect that was caused by local environment, with custom brooklyn.ssh.config.scriptHeader - // to set things like correct Java on path. - return true; - } - @BeforeMethod(groups = "Integration") public void setUp() throws Exception { super.setUp(); warUrl = getClass().getClassLoader().getResource("hello-world.war"); - localhostProvisioningLocation = origManagementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)); + localhostProvisioningLocation = origManagementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)); executor = Executors.newCachedThreadPool(); } @AfterMethod(groups = "Integration", alwaysRun=true) public void tearDown() throws Exception { for (WebAppMonitor monitor : webAppMonitors) { - monitor.terminate(); + monitor.terminate(); } if (executor != null) executor.shutdownNow(); super.tearDown(); } private WebAppMonitor newWebAppMonitor(String url, int expectedResponseCode) { - WebAppMonitor monitor = new WebAppMonitor(url) -// .delayMillis(0) FIXME Re-enable to fast polling - .expectedResponseCode(expectedResponseCode) - .logFailures(LOG); - webAppMonitors.add(monitor); - executor.execute(monitor); - return monitor; + WebAppMonitor monitor = new WebAppMonitor(url) +// .delayMillis(0) FIXME Re-enable to fast polling + .expectedResponseCode(expectedResponseCode) + .logFailures(LOG); + webAppMonitors.add(monitor); + executor.execute(monitor); + return monitor; } /** @@ -110,7 +110,7 @@ public class NginxRebindIntegrationTest extends RebindTestFixtureWithApp { */ @Test(groups = "Integration") public void testRebindsWithEmptyServerPool() throws Exception { - + // Set up nginx with a server pool DynamicCluster origServerPool = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class)) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java index ff78b13..12df430 100644 --- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxWebClusterEc2LiveTest.java @@ -108,6 +108,6 @@ public class NginxWebClusterEc2LiveTest { } }}); - nginx.stop(); + nginx.stop(); } } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java index 2767444..702e948 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java @@ -384,7 +384,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest { assertEquals(event.getSensor(), WebAppService.REQUESTS_PER_SECOND_IN_WINDOW); assertEquals(event.getValue(), 0.0d); if (eventTime > 0) assertTrue(event.getTimestamp()-eventTime < MAX_INTERVAL_BETWEEN_EVENTS, - "events at "+eventTime+" and "+event.getTimestamp()+" exceeded maximum allowable interval "+MAX_INTERVAL_BETWEEN_EVENTS); + "events at "+eventTime+" and "+event.getTimestamp()+" exceeded maximum allowable interval "+MAX_INTERVAL_BETWEEN_EVENTS); eventTime = event.getTimestamp(); } }}); @@ -422,7 +422,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest { */ @Test(groups = "Integration", dataProvider = "entitiesWithWarAndURL") public void initialRootWarDeployments(final SoftwareProcess entity, final String war, - final String urlSubPathToWebApp, final String urlSubPathToPageToQuery) { + final String urlSubPathToWebApp, final String urlSubPathToPageToQuery) { this.entity = entity; log.info("test=initialRootWarDeployments; entity="+entity+"; app="+entity.getApplication()); @@ -432,7 +432,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest { ((EntityLocal)entity).setConfig(JavaWebAppService.ROOT_WAR, resource.getPath()); Entities.start(entity.getApplication(), ImmutableList.of(loc)); - //tomcat may need a while to unpack everything + //tomcat may need a while to unpack everything Asserts.succeedsEventually(MutableMap.of("timeout", 60*1000), new Runnable() { public void run() { // TODO get this URL from a WAR file entity @@ -441,10 +441,10 @@ public abstract class AbstractWebAppFixtureIntegrationTest { assertEquals(entity.getAttribute(JavaWebAppSoftwareProcess.DEPLOYED_WARS), ImmutableSet.of("/")); }}); } - + @Test(groups = "Integration", dataProvider = "entitiesWithWarAndURL") public void initialNamedWarDeployments(final SoftwareProcess entity, final String war, - final String urlSubPathToWebApp, final String urlSubPathToPageToQuery) { + final String urlSubPathToWebApp, final String urlSubPathToPageToQuery) { this.entity = entity; log.info("test=initialNamedWarDeployments; entity="+entity+"; app="+entity.getApplication()); @@ -460,7 +460,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest { HttpTestUtils.assertHttpStatusCodeEquals(entity.getAttribute(WebAppService.ROOT_URL)+urlSubPathToWebApp+urlSubPathToPageToQuery, 200); }}); } - + @Test(groups = "Integration", dataProvider = "entitiesWithWarAndURL") public void testWarDeployAndUndeploy(final JavaWebAppSoftwareProcess entity, final String war, final String urlSubPathToWebApp, final String urlSubPathToPageToQuery) { @@ -490,7 +490,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest { assertEquals(entity.getAttribute(JavaWebAppSoftwareProcess.DEPLOYED_WARS), ImmutableSet.of()); }}); } - + private void sleep(long millis) { if (millis > 0) Time.sleep(millis); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppFabricTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppFabricTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppFabricTest.java index 623b5b2..ff3babb 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppFabricTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/DynamicWebAppFabricTest.java @@ -51,7 +51,7 @@ public class DynamicWebAppFabricTest { private static final long TIMEOUT_MS = 10*1000; private TestApplication app; - private SimulatedLocation loc1; + private SimulatedLocation loc1; private SimulatedLocation loc2; private List<SimulatedLocation> locs; @@ -84,18 +84,18 @@ public class DynamicWebAppFabricTest { app.start(locs); for (Entity member : fabric.getChildren()) { - ((TestJavaWebAppEntity)member).spoofRequest(); + ((TestJavaWebAppEntity)member).spoofRequest(); } EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", TIMEOUT_MS), fabric, DynamicWebAppFabric.REQUEST_COUNT, 2); // Note this is time-sensitive: need to do the next two sends before the previous one has dropped out // of the time-window. for (Entity member : fabric.getChildren()) { - for (int i = 0; i < 2; i++) { - ((TestJavaWebAppEntity)member).spoofRequest(); - } + for (int i = 0; i < 2; i++) { + ((TestJavaWebAppEntity)member).spoofRequest(); + } } - EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", TIMEOUT_MS), fabric, DynamicWebAppFabric.REQUEST_COUNT_PER_NODE, 3d); + EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", TIMEOUT_MS), fabric, DynamicWebAppFabric.REQUEST_COUNT_PER_NODE, 3d); } @Test http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a2da61d1/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java index c8c0be3..777742e 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/ControlledDynamicWebAppClusterRebindIntegrationTest.java @@ -66,7 +66,7 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest { private TestApplication origApp; private TestApplication newApp; private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>(); - private ExecutorService executor; + private ExecutorService executor; private ClassLoader classLoader = getClass().getClassLoader(); private LocalManagementContext origManagementContext; @@ -74,7 +74,7 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest { @BeforeMethod(alwaysRun=true) public void setUp() { - String warPath = "hello-world.war"; + String warPath = "hello-world.war"; warUrl = checkNotNull(getClass().getClassLoader().getResource(warPath), "warUrl"); executor = Executors.newCachedThreadPool(); @@ -82,14 +82,14 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest { LOG.info("Test persisting to "+mementoDir); origManagementContext = RebindTestUtils.newPersistingManagementContext(mementoDir, classLoader); - localhostProvisioningLocation = new LocalhostMachineProvisioningLocation(); + localhostProvisioningLocation = new LocalhostMachineProvisioningLocation(); origApp = ApplicationBuilder.newManagedApp(TestApplication.class, origManagementContext); } @AfterMethod(alwaysRun=true) public void tearDown() throws Exception { for (WebAppMonitor monitor : webAppMonitors) { - monitor.terminate(); + monitor.terminate(); } if (executor != null) executor.shutdownNow(); if (newApp != null) Entities.destroyAll(newApp.getManagementContext()); @@ -107,12 +107,12 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest { } private WebAppMonitor newWebAppMonitor(String url) { - WebAppMonitor monitor = new WebAppMonitor(url) -// .delayMillis(0) - .logFailures(LOG); - webAppMonitors.add(monitor); - executor.execute(monitor); - return monitor; + WebAppMonitor monitor = new WebAppMonitor(url) +// .delayMillis(0) + .logFailures(LOG); + webAppMonitors.add(monitor); + executor.execute(monitor); + return monitor; } @Test(groups = {"Integration"}) @@ -120,10 +120,10 @@ public class ControlledDynamicWebAppClusterRebindIntegrationTest { NginxController origNginx = origApp.createAndManageChild(EntitySpec.create(NginxController.class).configure("domain", "localhost")); origApp.createAndManageChild(EntitySpec.create(ControlledDynamicWebAppCluster.class) - .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString())) - .configure("initialSize", 1) - .configure("controller", origNginx)); - + .configure("memberSpec", EntitySpec.create(JBoss7Server.class).configure("war", warUrl.toString())) + .configure("initialSize", 1) + .configure("controller", origNginx)); + origApp.start(ImmutableList.of(localhostProvisioningLocation)); String rootUrl = origNginx.getAttribute(JBoss7Server.ROOT_URL);
