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 2015/04/01 23:21:12 UTC

[1/4] incubator-brooklyn git commit: fix some js errors on startup due to fields not initialized properly

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 54bbe9bac -> 63c03b15e


fix some js errors on startup due to fields not initialized properly


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

Branch: refs/heads/master
Commit: 44b6b4a011bea0d0e8d2b9d2ea5ddda6018f96f4
Parents: 584edcb
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Mar 27 18:42:36 2015 -0500
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Mar 28 21:27:28 2015 -0500

----------------------------------------------------------------------
 usage/jsgui/src/main/webapp/assets/js/router.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/44b6b4a0/usage/jsgui/src/main/webapp/assets/js/router.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/router.js b/usage/jsgui/src/main/webapp/assets/js/router.js
index 3e38841..186dd72 100644
--- a/usage/jsgui/src/main/webapp/assets/js/router.js
+++ b/usage/jsgui/src/main/webapp/assets/js/router.js
@@ -88,14 +88,15 @@ define([
 
         homePage:function (trail) {
             var that = this;
+            var veryFirstViewLoad, homeView;
             // render the page after we fetch the collection -- no rendering on error
             function render() {
-                var homeView = new HomeView({
+                homeView = new HomeView({
                     collection:that.applications,
                     locations:that.locations,
                     appRouter:that
                 });
-                var veryFirstViewLoad = !that.currentView;
+                veryFirstViewLoad = !that.currentView;
                 that.showView("#application-content", homeView);
             }
             this.applications.fetch({success:function () {


[2/4] incubator-brooklyn git commit: minor geo-lookup fixes

Posted by al...@apache.org.
minor geo-lookup fixes

occasional NPE in utrace lookup, deprecate geobytes lookup whose api has changed, better messages in integration test


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

Branch: refs/heads/master
Commit: a08c72dd125f388852a5ea125c47135c4c793428
Parents: 44b6b4a
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Mar 27 18:43:31 2015 -0500
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Mar 28 21:27:36 2015 -0500

----------------------------------------------------------------------
 .../brooklyn/location/geo/GeoBytesHostGeoLookup.java | 11 +++++++----
 .../brooklyn/location/geo/UtraceHostGeoLookup.java   | 15 +++++++++++++--
 .../location/geo/HostGeoLookupIntegrationTest.java   | 13 ++++++++++---
 3 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a08c72dd/core/src/main/java/brooklyn/location/geo/GeoBytesHostGeoLookup.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/location/geo/GeoBytesHostGeoLookup.java b/core/src/main/java/brooklyn/location/geo/GeoBytesHostGeoLookup.java
index ce01828..1c68000 100644
--- a/core/src/main/java/brooklyn/location/geo/GeoBytesHostGeoLookup.java
+++ b/core/src/main/java/brooklyn/location/geo/GeoBytesHostGeoLookup.java
@@ -29,6 +29,8 @@ import org.slf4j.LoggerFactory;
 
 import brooklyn.util.net.Networking;
 
+/** @deprecated Mar 2015 - the API has changed; GetLocation now discouraged for free access, and valuepairs.txt not supported */
+@Deprecated
 public class GeoBytesHostGeoLookup implements HostGeoLookup {
 
     public static final Logger log = LoggerFactory.getLogger(GeoBytesHostGeoLookup.class);
@@ -84,7 +86,12 @@ public class GeoBytesHostGeoLookup implements HostGeoLookup {
         Properties props = new Properties();
         try {
             props.load( new URL(url).openStream() );
+            HostGeoInfo geo = new HostGeoInfo(address.getHostName(), props.getProperty("city")+" ("+props.getProperty("iso2")+")", 
+                Double.parseDouble(props.getProperty("latitude")), Double.parseDouble(props.getProperty("longitude")));
+            log.info("Geo info lookup for "+address+" returned: "+geo);
+            return geo;
         } catch (Exception e) {
+            // may be web not available, or gateway giving us funny crap
             if (log.isDebugEnabled())
                 log.debug("Geo info lookup for "+address+" failed: "+e);
             if (!LOGGED_GEO_LOOKUP_UNAVAILABLE) {
@@ -93,10 +100,6 @@ public class GeoBytesHostGeoLookup implements HostGeoLookup {
             }
             return null;
         }
-        HostGeoInfo geo = new HostGeoInfo(address.getHostName(), props.getProperty("city")+" ("+props.getProperty("iso2")+")", 
-                Double.parseDouble(props.getProperty("latitude")), Double.parseDouble(props.getProperty("longitude")));
-        log.info("Geo info lookup for "+address+" returned: "+geo);
-        return geo;
     }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a08c72dd/core/src/main/java/brooklyn/location/geo/UtraceHostGeoLookup.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/location/geo/UtraceHostGeoLookup.java b/core/src/main/java/brooklyn/location/geo/UtraceHostGeoLookup.java
index 2560b55..37ed9f7 100644
--- a/core/src/main/java/brooklyn/location/geo/UtraceHostGeoLookup.java
+++ b/core/src/main/java/brooklyn/location/geo/UtraceHostGeoLookup.java
@@ -27,6 +27,9 @@ import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.util.concurrent.atomic.AtomicReference;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -189,9 +192,17 @@ Beyond this you get blacklisted and requests may time out, or return none.
         }
     }
     
+    @Nullable
+    private static Node getFirstChild(Node xml, String field) {
+        if (xml==null) return null;
+        NodeList nl = (NodeList)xml.get(field);
+        if (nl==null || nl.isEmpty()) return null;
+        return (Node)nl.get(0);
+    }
+    @Nonnull
     private static String getXmlResultsField(Node xml, String field) {
-        Node r1 = ((Node)((NodeList)xml.get("result")).get(0));
-        Node f1 = ((Node)((NodeList)r1.get(field)).get(0));
+        Node f1 = getFirstChild(getFirstChild(xml, "result"), field);
+        if (f1==null) return "";
         return f1.text();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a08c72dd/core/src/test/java/brooklyn/location/geo/HostGeoLookupIntegrationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/location/geo/HostGeoLookupIntegrationTest.java b/core/src/test/java/brooklyn/location/geo/HostGeoLookupIntegrationTest.java
index 9b32442..85acb6d 100644
--- a/core/src/test/java/brooklyn/location/geo/HostGeoLookupIntegrationTest.java
+++ b/core/src/test/java/brooklyn/location/geo/HostGeoLookupIntegrationTest.java
@@ -36,16 +36,21 @@ public class HostGeoLookupIntegrationTest {
     
     @Test(groups = "Integration")
     public void testLocalhostGetsLocation() throws Exception {
-        SshMachineLocation l = new LocalhostMachineProvisioningLocation().obtain();
+        LocalhostMachineProvisioningLocation ll = new LocalhostMachineProvisioningLocation();
+        SshMachineLocation l = ll.obtain();
         HostGeoInfo geo = HostGeoInfo.fromLocation(l);
+        Assert.assertNotNull(geo, "host lookup unavailable - is the maxmind database installed? or else network unavailable or too slow?");
         log.info("localhost is in "+geo);
         Assert.assertNotNull(geo, "couldn't load data; must have a valid HostGeoLookup impl (e.g. MaxMind installed, or online and with Utrace credit)");
         Assert.assertTrue(-90 <= geo.latitude && geo.latitude <= 90); 
+        ll.close();
     }
 
-    @Test(groups = "Integration")
+    @Deprecated // see GeoBytesHostGeoLookup - their API changed
+    @Test(groups = "Integration", enabled=false)
     public void testGeobytesLookup() throws Exception {
         HostGeoInfo geo = new GeoBytesHostGeoLookup().getHostGeoInfo(InetAddress.getByName("geobytes.com"));
+        Assert.assertNotNull(geo, "host lookup unavailable");
         Assert.assertEquals(geo.displayName, "Baltimore (US)");
         Assert.assertEquals(geo.latitude, 39.2894, 0.1);
         Assert.assertEquals(geo.longitude, -76.6384, 0.1);
@@ -54,14 +59,16 @@ public class HostGeoLookupIntegrationTest {
     @Test(groups = "Integration")
     public void testUtraceLookup() throws Exception {
         HostGeoInfo geo = new UtraceHostGeoLookup().getHostGeoInfo(InetAddress.getByName("utrace.de"));
+        Assert.assertNotNull(geo, "host lookup unavailable - maybe network not available ");
         Assert.assertTrue(geo.displayName.contains("(DE)"));
         Assert.assertEquals(geo.latitude, 51, 2);
         Assert.assertEquals(geo.longitude, 9, 5);
     }
 
-    @Test(groups = "Integration")
+    @Test(groups = "Integration")  // only works if maxmind database is installed to ~/.brooklyn/
     public void testMaxmindLookup() throws Exception {
         HostGeoInfo geo = new MaxMind2HostGeoLookup().getHostGeoInfo(InetAddress.getByName("maxmind.com"));
+        Assert.assertNotNull(geo, "host lookup unavailable - is the maxmind database installed?");
         log.info("maxmind.com at "+geo);
         
         // used to be Washington; now Dallas - in case this changes again, we will accept either!


[4/4] incubator-brooklyn git commit: This closes #577

Posted by al...@apache.org.
This closes #577


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

Branch: refs/heads/master
Commit: 63c03b15ee63e73396063b4fa9948e2ff5e7d511
Parents: 54bbe9b 58229e5
Author: Aled Sage <al...@gmail.com>
Authored: Wed Apr 1 22:20:59 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Apr 1 22:20:59 2015 +0100

----------------------------------------------------------------------
 .../brooklyn/location/geo/GeoBytesHostGeoLookup.java | 11 +++++++----
 .../brooklyn/location/geo/UtraceHostGeoLookup.java   | 15 +++++++++++++--
 .../location/geo/HostGeoLookupIntegrationTest.java   | 13 ++++++++++---
 .../main/resources/brooklyn/demo/nodejs-todo.yaml    |  8 ++++----
 usage/jsgui/src/main/webapp/assets/js/router.js      |  5 +++--
 5 files changed, 37 insertions(+), 15 deletions(-)
----------------------------------------------------------------------



[3/4] incubator-brooklyn git commit: tidy-up of nodejs yaml

Posted by al...@apache.org.
tidy-up of nodejs yaml


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

Branch: refs/heads/master
Commit: 58229e5e1afb2bf7a9b9a7e37e31c234b2ec2c7c
Parents: a08c72d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Sat Mar 28 10:02:37 2015 -0500
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Sat Mar 28 21:27:46 2015 -0500

----------------------------------------------------------------------
 .../src/main/resources/brooklyn/demo/nodejs-todo.yaml        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/58229e5e/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml b/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
index 8bf3f7f..ea17556 100644
--- a/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
+++ b/examples/simple-web-cluster/src/main/resources/brooklyn/demo/nodejs-todo.yaml
@@ -21,10 +21,10 @@ origin: "https://github.com/amirrajan/nodejs-todo/"
 locations:
 - jclouds:softlayer:ams01
 services:
-- serviceType: brooklyn.entity.nosql.redis.RedisStore
+- type: brooklyn.entity.nosql.redis.RedisStore
   id: redis
   name: "Redis"
-- serviceType: brooklyn.entity.webapp.nodejs.NodeJsWebAppService
+- type: brooklyn.entity.webapp.nodejs.NodeJsWebAppService
   id: nodejs
   name: "Node.JS"
   brooklyn.config:
@@ -48,6 +48,6 @@ services:
     env:
       REDISTOGO_URL: >
         $brooklyn:formatString("redis://%s:%d/",
-        component("redis").attributeWhenReady("host.name"),
-        component("redis").attributeWhenReady("redis.port"))
+          component("redis").attributeWhenReady("host.subnet.hostname"),
+          component("redis").attributeWhenReady("redis.port"))
     launch.latch: $brooklyn:component("redis").attributeWhenReady("service.isUp")
\ No newline at end of file