You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/11/05 01:21:33 UTC
[3/8] git commit: NodeJs: test tidy
NodeJs: test tidy
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/467b9f7a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/467b9f7a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/467b9f7a
Branch: refs/heads/master
Commit: 467b9f7a685335d6b7134dba1a07b55b6c2ece09
Parents: 00dd84c
Author: Aled Sage <al...@gmail.com>
Authored: Tue Nov 4 22:33:40 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Nov 4 22:33:40 2014 +0000
----------------------------------------------------------------------
.../NodeJsWebAppSimpleIntegrationTest.java | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/467b9f7a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSimpleIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSimpleIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSimpleIntegrationTest.java
index 010bea5..8f8aae9 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSimpleIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppSimpleIntegrationTest.java
@@ -25,17 +25,14 @@ import java.net.ServerSocket;
import java.util.Iterator;
import org.jclouds.util.Throwables2;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import brooklyn.entity.basic.Entities;
+import brooklyn.entity.BrooklynAppLiveTestSupport;
import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.LocationSpec;
import brooklyn.location.PortRange;
import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
import brooklyn.location.basic.PortRanges;
-import brooklyn.test.entity.TestApplication;
import brooklyn.util.net.Networking;
import com.google.common.collect.ImmutableList;
@@ -43,12 +40,10 @@ import com.google.common.collect.ImmutableList;
/**
* This tests the operation of the {@link NodeJsWebAppService} entity.
*/
-public class NodeJsWebAppSimpleIntegrationTest {
+public class NodeJsWebAppSimpleIntegrationTest extends BrooklynAppLiveTestSupport {
private static PortRange DEFAULT_PORT_RANGE = PortRanges.fromString("3000-3099");
- private TestApplication app;
- private NodeJsWebAppService nodejs;
private int httpPort;
@BeforeMethod(alwaysRun=true)
@@ -63,19 +58,13 @@ public class NodeJsWebAppSimpleIntegrationTest {
fail("someone is already listening on ports "+DEFAULT_PORT_RANGE+"; tests assume that port is free on localhost");
}
- @AfterMethod(alwaysRun=true)
- public void tearDown() throws Exception {
- if (app != null) Entities.destroyAll(app.getManagementContext());
- }
-
@Test(groups="Integration")
public void detectFailureIfNodeJsBindToPort() throws Exception {
ServerSocket listener = new ServerSocket(httpPort);
try {
- app = TestApplication.Factory.newManagedInstanceForTests();
- nodejs = app.createAndManageChild(EntitySpec.create(NodeJsWebAppService.class).configure("httpPort", httpPort));
+ LocalhostMachineProvisioningLocation loc = app.newLocalhostProvisioningLocation();
+ NodeJsWebAppService nodejs = app.createAndManageChild(EntitySpec.create(NodeJsWebAppService.class).configure("httpPort", httpPort));
try {
- LocalhostMachineProvisioningLocation loc = app.getManagementContext().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));
nodejs.start(ImmutableList.of(loc));
fail("Should have thrown start-exception");
} catch (Exception e) {