brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grk...@apache.org
Subject [07/11] git commit: Updated test code with example Todo application
Date Thu, 21 Aug 2014 16:01:22 GMT
Updated test code with example Todo application


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/a97b7682
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/a97b7682
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/a97b7682

Branch: refs/heads/master
Commit: a97b7682cca2660ff66abc8f49c80666061ad3f1
Parents: a26970a
Author: Andrew Kennedy <grkvlt@apache.org>
Authored: Fri Aug 15 16:36:32 2014 +0100
Committer: Andrew Kennedy <grkvlt@apache.org>
Committed: Thu Aug 21 14:50:27 2014 +0100

----------------------------------------------------------------------
 software/webapp/pom.xml                         |   8 +-
 .../webapp/nodejs/NodeJsWebAppService.java      |   4 +
 .../webapp/src/main/resources/jetty-logo.svg    |  88 -------------------
 .../webapp/src/main/resources/nodejs-logo.png   | Bin 0 -> 9620 bytes
 .../webapp/nodejs/NodeJsTodoApplication.java    |  56 ++++++++++++
 .../webapp/nodejs/NodeJsWebAppEc2LiveTest.java  |   8 ++
 .../NodeJsWebAppFixtureIntegrationTest.java     |   4 -
 .../NodeJsWebAppSimpleIntegrationTest.java      |  22 ++---
 .../webapp/nodejs/nodejs-hello-world.yaml       |  31 +++++++
 9 files changed, 113 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/software/webapp/pom.xml b/software/webapp/pom.xml
index 43f95ac..a7aa180 100644
--- a/software/webapp/pom.xml
+++ b/software/webapp/pom.xml
@@ -111,7 +111,6 @@
         <dependency>
             <groupId>mx4j</groupId>
             <artifactId>mx4j-tools</artifactId>
-            <version>${mx4j.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -141,6 +140,13 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>io.brooklyn</groupId>
+            <artifactId>brooklyn-software-nosql</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
         <!-- bring in jclouds for testing -->
         <dependency>
             <groupId>io.brooklyn</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppService.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppService.java
b/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppService.java
index d4fe793..7e6b840 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppService.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppService.java
@@ -20,6 +20,7 @@ package brooklyn.entity.webapp.nodejs;
 
 import java.util.List;
 
+import brooklyn.catalog.Catalog;
 import brooklyn.config.ConfigKey;
 import brooklyn.entity.basic.Attributes;
 import brooklyn.entity.basic.ConfigKeys;
@@ -33,6 +34,9 @@ import brooklyn.util.flags.SetFromFlag;
 import com.google.common.collect.ImmutableList;
 import com.google.common.reflect.TypeToken;
 
+@Catalog(name="Node.JS Application",
+        description="Node.JS Web Application",
+        iconUrl="classpath:///nodejs-logo.png")
 @ImplementedBy(NodeJsWebAppServiceImpl.class)
 public interface NodeJsWebAppService extends SoftwareProcess, WebAppService {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/main/resources/jetty-logo.svg
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/jetty-logo.svg b/software/webapp/src/main/resources/jetty-logo.svg
deleted file mode 100644
index 5f8d6fd..0000000
--- a/software/webapp/src/main/resources/jetty-logo.svg
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="1400"
-   height="400"
-   id="svg2"
-   sodipodi:version="0.32"
-   inkscape:version="0.46"
-   version="1.0"
-   sodipodi:docname="jetty-logo.svg"
-   inkscape:output_extension="org.inkscape.output.svg.inkscape"
-   inkscape:export-filename="/home/joakim/documents/Webtide/jetty-logo.png"
-   inkscape:export-xdpi="90"
-   inkscape:export-ydpi="90">
-  <defs
-     id="defs4">
-    <inkscape:perspective
-       sodipodi:type="inkscape:persp3d"
-       inkscape:vp_x="0 : 526.18109 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_z="744.09448 : 526.18109 : 1"
-       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
-       id="perspective10" />
-    <inkscape:perspective
-       id="perspective2390"
-       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
-       inkscape:vp_z="744.09448 : 526.18109 : 1"
-       inkscape:vp_y="0 : 1000 : 0"
-       inkscape:vp_x="0 : 526.18109 : 1"
-       sodipodi:type="inkscape:persp3d" />
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     gridtolerance="10000"
-     guidetolerance="10"
-     objecttolerance="10"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="0.87428571"
-     inkscape:cx="700"
-     inkscape:cy="200"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer2"
-     showgrid="false"
-     inkscape:window-width="1679"
-     inkscape:window-height="1001"
-     inkscape:window-x="1"
-     inkscape:window-y="48"
-     showguides="true"
-     inkscape:guide-bbox="true"
-     showborder="true" />
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:groupmode="layer"
-     id="layer2"
-     inkscape:label="Jetty"
-     style="display:inline"
-     transform="translate(-1.845606,-221.31978)">
-    <path
-       id="path3193"
-       style="fill:#fc390e;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:25;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 468.5751,304.59386 L 460.4501,339.75011 L 430.85635,339.75011 L 423.54385,371.50011
L 453.1376,371.50011 L 435.6376,447.21886 C 431.11514,466.80783 434.69559,501.46886 475.60635,501.46886
L 574.3876,501.46886 L 582.3876,466.81261 C 513.82035,466.81262 513.81207,466.80768 518.8251,445.09386
L 535.8251,371.50011 L 598.2626,371.50011 L 604.3876,371.50011 L 627.85635,371.50011 L 610.35635,447.21886
C 605.83388,466.80782 609.41434,501.46886 650.3251,501.46886 L 749.10635,501.46886 L 757.10635,466.81261
C 688.53909,466.81261 688.53082,466.80768 693.54385,445.09386 L 710.54385,371.50011 L 779.10635,371.50011
L 786.4501,339.75011 L 717.85635,339.75011 L 725.98135,304.59386 L 643.29385,304.59386 L 635.16885,339.75011
L 611.73135,339.75011 L 605.5751,339.75011 L 543.1376,339.75011 L 551.2626,304.59386 L 468.5751,304.59386
z M 106.32205,339.73892 L 65.825288,515.14967 C 63.418773,522.20878 59.752966,521.8319 51.570815,522.15277
L 50.608209,562.10092 L 117.99063,561.86026 C 131.0660
 3,561.13831 139.21491,553.72589 144.58946,535.43638 L 189.76977,339.73892 L 106.32205,339.73892
z M 119.98951,280.53864 L 109.65558,325.29983 L 193.1033,325.29983 L 203.43723,280.53864 L
119.98951,280.53864 z M 239.29385,339.75011 C 224.85477,339.75012 208.26802,352.04925 204.6376,371.50011
L 188.6376,436.96886 C 179.27284,477.53211 184.20976,501.46886 214.48135,501.46886 L 385.3251,501.46886
L 393.3251,466.81261 L 265.29385,466.81261 L 272.16885,436.96886 L 400.2001,436.96886 C 402.2537,428.07372
410.80305,415.14706 415.3251,371.50011 C 416.6053,365.955 407.76262,339.75011 374.5126,339.75011
L 239.29385,339.75011 z M 307.98135,371.50011 C 325.75108,371.50011 330.91518,377.05789 325.2001,401.81261
L 280.29385,401.81261 C 285.80848,377.9261 293.45487,371.5001 307.98135,371.50011 z M 799.21238,339.73892
L 769.87735,466.80292 C 769.87735,466.80292 761.87689,501.45673 810.59962,501.45673 L 893.34691,501.45673
C 889.21672,519.34655 887.23544,527.9284 839.14197,527.9284 L 755.76542,527.92
 84 L 748.32055,560.1757 L 879.79056,560.1757 C 940.41876,560.1757 962.20636,560.1757 969.65123,527.9284
L 1013.0982,339.73892 L 930.6824,339.73892 L 901.34737,466.80292 L 853.2539,466.80292 L 882.58893,339.73892
L 799.21238,339.73892 z M 1045.4591,339.73892 L 1031.1249,401.82701 L 1114.8716,401.82701
L 1129.2058,339.73892 L 1045.4591,339.73892 z M 1022.4578,439.36864 L 1008.1236,501.45673
L 1091.8702,501.45673 L 1106.2044,439.36864 L 1022.4578,439.36864 z M 1217.5384,280.53864
L 1102.1787,527.9284 L 1144.3505,527.9284 L 1259.7102,280.53864 L 1217.5384,280.53864 z M
1310.9112,280.53864 L 1195.5515,527.9284 L 1237.7233,527.9284 L 1353.083,280.53864 L 1310.9112,280.53864
z" />
-    <path
-       d="M 468.5751,304.59386 L 460.4501,339.75011 L 430.85635,339.75011 L 423.54385,371.50011
L 453.1376,371.50011 L 435.6376,447.21886 C 431.11514,466.80783 434.69559,501.46886 475.60635,501.46886
L 574.3876,501.46886 L 582.3876,466.81261 C 513.82035,466.81262 513.81207,466.80768 518.8251,445.09386
L 535.8251,371.50011 L 598.2626,371.50011 L 604.3876,371.50011 L 627.85635,371.50011 L 610.35635,447.21886
C 605.83388,466.80782 609.41434,501.46886 650.3251,501.46886 L 749.10635,501.46886 L 757.10635,466.81261
C 688.53909,466.81261 688.53082,466.80768 693.54385,445.09386 L 710.54385,371.50011 L 779.10635,371.50011
L 786.4501,339.75011 L 717.85635,339.75011 L 725.98135,304.59386 L 643.29385,304.59386 L 635.16885,339.75011
L 611.73135,339.75011 L 605.5751,339.75011 L 543.1376,339.75011 L 551.2626,304.59386 L 468.5751,304.59386
z M 106.32205,339.73892 L 65.825288,515.14967 C 63.418773,522.20878 59.752966,521.8319 51.570815,522.15277
L 50.608209,562.10092 L 117.99063,561.86026 C 131.0660
 3,561.13831 139.21491,553.72589 144.58946,535.43638 L 189.76977,339.73892 L 106.32205,339.73892
z M 119.98951,280.53864 L 109.65558,325.29983 L 193.1033,325.29983 L 203.43723,280.53864 L
119.98951,280.53864 z M 239.29385,339.75011 C 224.85477,339.75012 208.26802,352.04925 204.6376,371.50011
L 188.6376,436.96886 C 179.27284,477.53211 184.20976,501.46886 214.48135,501.46886 L 385.3251,501.46886
L 393.3251,466.81261 L 265.29385,466.81261 L 272.16885,436.96886 L 400.2001,436.96886 C 402.2537,428.07372
410.80305,415.14706 415.3251,371.50011 C 416.6053,365.955 407.76262,339.75011 374.5126,339.75011
L 239.29385,339.75011 z M 307.98135,371.50011 C 325.75108,371.50011 330.91518,377.05789 325.2001,401.81261
L 280.29385,401.81261 C 285.80848,377.9261 293.45487,371.5001 307.98135,371.50011 z M 799.21238,339.73892
L 769.87735,466.80292 C 769.87735,466.80292 761.87689,501.45673 810.59962,501.45673 L 893.34691,501.45673
C 889.21672,519.34655 887.23544,527.9284 839.14197,527.9284 L 755.76542,527.92
 84 L 748.32055,560.1757 L 879.79056,560.1757 C 940.41876,560.1757 962.20636,560.1757 969.65123,527.9284
L 1013.0982,339.73892 L 930.6824,339.73892 L 901.34737,466.80292 L 853.2539,466.80292 L 882.58893,339.73892
L 799.21238,339.73892 z M 1045.4591,339.73892 L 1031.1249,401.82701 L 1114.8716,401.82701
L 1129.2058,339.73892 L 1045.4591,339.73892 z M 1022.4578,439.36864 L 1008.1236,501.45673
L 1091.8702,501.45673 L 1106.2044,439.36864 L 1022.4578,439.36864 z M 1217.5384,280.53864
L 1102.1787,527.9284 L 1144.3505,527.9284 L 1259.7102,280.53864 L 1217.5384,280.53864 z M
1310.9112,280.53864 L 1195.5515,527.9284 L 1237.7233,527.9284 L 1353.083,280.53864 L 1310.9112,280.53864
z"
-       style="fill:#fc390e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:30;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       id="path3316" />
-  </g>
-</svg>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/main/resources/nodejs-logo.png
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/nodejs-logo.png b/software/webapp/src/main/resources/nodejs-logo.png
new file mode 100644
index 0000000..c6c7b97
Binary files /dev/null and b/software/webapp/src/main/resources/nodejs-logo.png differ

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsTodoApplication.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsTodoApplication.java
b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsTodoApplication.java
new file mode 100644
index 0000000..32043d5
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsTodoApplication.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.entity.webapp.nodejs;
+
+import static brooklyn.event.basic.DependentConfiguration.attributeWhenReady;
+import brooklyn.catalog.Catalog;
+import brooklyn.entity.basic.AbstractApplication;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.basic.StartableApplication;
+import brooklyn.entity.nosql.redis.RedisStore;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.event.basic.DependentConfiguration;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Node.JS Todo Application
+ */
+@Catalog(name="NodeJS Todo",
+        description="Node.JS Todo Application.",
+        iconUrl="classpath://nodejs-logo.png")
+public class NodeJsTodoApplication extends AbstractApplication implements StartableApplication
{
+
+    @Override
+    public void init() {
+        RedisStore redis = addChild(EntitySpec.create(RedisStore.class));
+
+        addChild(EntitySpec.create(NodeJsWebAppService.class)
+                .configure(NodeJsWebAppService.APP_GIT_REPOSITORY_URL, "https://github.com/amirrajan/nodejs-todo/")
+                .configure(NodeJsWebAppService.APP_FILE, "server.js")
+                .configure(NodeJsWebAppService.APP_NAME, "nodejs-todo")
+                .configure(NodeJsWebAppService.NODE_PACKAGE_LIST, ImmutableList.of("express",
"ejs", "redis"))
+                .configure(SoftwareProcess.SHELL_ENVIRONMENT, ImmutableMap.<String, Object>of(
+                        "REDISTOGO_URL", DependentConfiguration.formatString("redis://%s:%d/",
+                                attributeWhenReady(redis, Attributes.HOSTNAME), attributeWhenReady(redis,
RedisStore.REDIS_PORT)))));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java
b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java
index d89c94e..ac8e32d 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppEc2LiveTest.java
@@ -21,6 +21,8 @@ package brooklyn.entity.webapp.nodejs;
 import static brooklyn.entity.webapp.nodejs.NodeJsWebAppFixtureIntegrationTest.*;
 import static org.testng.Assert.assertNotNull;
 
+import org.testng.annotations.Test;
+
 import brooklyn.entity.AbstractEc2LiveTest;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.location.Location;
@@ -56,4 +58,10 @@ public class NodeJsWebAppEc2LiveTest extends AbstractEc2LiveTest {
             }});
     }
 
+    @Test(groups = {"Live", "Live-sanity"})
+    @Override
+    public void test_Ubuntu_12_0() throws Exception {
+        super.test_Ubuntu_12_0();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
index 3b24c14..fa56a34 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
@@ -18,8 +18,6 @@
  */
 package brooklyn.entity.webapp.nodejs;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.testng.annotations.DataProvider;
 
 import brooklyn.entity.basic.SoftwareProcess;
@@ -31,8 +29,6 @@ import brooklyn.test.entity.TestApplication;
 
 public class NodeJsWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest
{
 
-    private static final Logger LOG = LoggerFactory.getLogger(NodeJsWebAppFixtureIntegrationTest.class);
-
     public static final String GIT_REPO_URL = "https://github.com/grkvlt/node-hello-world.git";
     public static final String APP_FILE = "app.js";
     public static final String APP_NAME = "node-hello-world";

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/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 34ebb3a..54e6c7f 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,15 +25,13 @@ import java.net.ServerSocket;
 import java.util.Iterator;
 
 import org.jclouds.util.Throwables2;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.basic.Entities;
 import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.LocationSpec;
 import brooklyn.location.PortRange;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.location.basic.PortRanges;
@@ -44,15 +42,10 @@ import com.google.common.collect.ImmutableList;
 
 /**
  * This tests the operation of the {@link NodeJsWebAppService} entity.
- *
- * FIXME this test is largely superseded by WebApp*IntegrationTest which tests inter alia
Tomcat
  */
 public class NodeJsWebAppSimpleIntegrationTest {
-    @SuppressWarnings("unused")
-    private static final Logger LOG = LoggerFactory.getLogger(NodeJsWebAppSimpleIntegrationTest.class);
 
-    /** don't use 8080 since that is commonly used by testing software; use different from
other tests. */
-    static PortRange DEFAULT_HTTP_PORT_RANGE = PortRanges.fromString("7880-7980");
+    private static PortRange DEFAULT_PORT_RANGE = PortRanges.fromString("3000-3099");
 
     private TestApplication app;
     private NodeJsWebAppService nodejs;
@@ -60,14 +53,14 @@ public class NodeJsWebAppSimpleIntegrationTest {
 
     @BeforeMethod(alwaysRun=true)
     public void pickFreePort() {
-        for (Iterator<Integer> iter = DEFAULT_HTTP_PORT_RANGE.iterator(); iter.hasNext();)
{
+        for (Iterator<Integer> iter = DEFAULT_PORT_RANGE.iterator(); iter.hasNext();)
{
             Integer port = iter.next();
             if (Networking.isPortAvailable(port)) {
                 httpPort = port;
                 return;
             }
         }
-        fail("someone is already listening on ports "+DEFAULT_HTTP_PORT_RANGE+"; tests assume
that port is free on localhost");
+        fail("someone is already listening on ports "+DEFAULT_PORT_RANGE+"; tests assume
that port is free on localhost");
     }
 
     @AfterMethod(alwaysRun=true)
@@ -76,14 +69,13 @@ public class NodeJsWebAppSimpleIntegrationTest {
     }
 
     @Test(groups="Integration")
-    public void detectFailureIfTomcanodejsantBindToPort() throws Exception {
+    public void detectFailureIfNodeJsBindToPort() throws Exception {
         ServerSocket listener = new ServerSocket(httpPort);
         try {
-            app = ApplicationBuilder.newManagedApp(TestApplication.class);
+            app = TestApplication.Factory.newManagedInstanceForTests();
             nodejs = app.createAndManageChild(EntitySpec.create(NodeJsWebAppService.class).configure("httpPort",
httpPort));
-
             try {
-                nodejs.start(ImmutableList.of(app.getManagementContext().getLocationManager().manage(new
LocalhostMachineProvisioningLocation())));
+                nodejs.start(ImmutableList.of(app.getManagementContext().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class))));
                 fail("Should have thrown start-exception");
             } catch (Exception e) {
                 // LocalhostMachineProvisioningLocation does NetworkUtils.isPortAvailable,
so get -1

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a97b7682/software/webapp/src/test/resources/brooklyn/entity/webapp/nodejs/nodejs-hello-world.yaml
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/resources/brooklyn/entity/webapp/nodejs/nodejs-hello-world.yaml
b/software/webapp/src/test/resources/brooklyn/entity/webapp/nodejs/nodejs-hello-world.yaml
new file mode 100644
index 0000000..0ac274e
--- /dev/null
+++ b/software/webapp/src/test/resources/brooklyn/entity/webapp/nodejs/nodejs-hello-world.yaml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+id: nodejs-hello-world-application
+name: "Node.JS Hello World Application"
+origin: "https://github.com/grkvlt/node-hello-world.git/"
+locations:
+- jclouds:softlayer:ams01
+services:
+- serviceType: brooklyn.entity.webapp.nodejs.NodeJsWebAppService
+  id: nodejs
+  name: "Node.JS"
+  brooklyn.config:
+    gitRepoUrl:
+      "https://github.com/grkvlt/node-hello-world.git"
+    appFileName: app.js
+    appName: node-hello-world
\ No newline at end of file


Mime
View raw message