[4/4] brooklyn-server git commit: This closes #142

2016-05-19 Thread aledsage
This closes #142


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

Branch: refs/heads/master
Commit: dee1074475d4837997504265478afca08f3e1dd8
Parents: 6944ac5 4f98035
Author: Aled Sage 
Authored: Thu May 19 16:39:57 2016 +0100
Committer: Aled Sage 
Committed: Thu May 19 16:39:57 2016 +0100

--
 .../brooklyn/core/objs/BasicSpecParameter.java  |   4 +
 .../test/framework/TestEffectorImpl.java|   2 +-
 .../test/framework/TestEndpointReachable.java   | 103 
 .../framework/TestEndpointReachableImpl.java| 223 
 .../test/framework/TestHttpCallImpl.java|   2 +-
 .../brooklyn/test/framework/TestSensorImpl.java |   2 +-
 .../framework/TestEndpointReachableTest.java| 252 +++
 7 files changed, 585 insertions(+), 3 deletions(-)
--




[2/4] brooklyn-server git commit: Adds TestEndpointReachable (for yaml test-cases)

2016-05-19 Thread aledsage
Adds TestEndpointReachable (for yaml test-cases)

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

Branch: refs/heads/master
Commit: 9337ebff6ce5c071a9b9585708010ed1f8b3bc2a
Parents: 0aba4ff
Author: Aled Sage 
Authored: Tue May 17 11:14:36 2016 +0100
Committer: Aled Sage 
Committed: Tue May 17 17:27:06 2016 +0100

--
 .../test/framework/TestEndpointReachable.java   |  84 +++
 .../framework/TestEndpointReachableImpl.java| 180 +++
 .../framework/TestEndpointReachableTest.java| 222 +++
 3 files changed, 486 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9337ebff/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestEndpointReachable.java
--
diff --git 
a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestEndpointReachable.java
 
b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestEndpointReachable.java
new file mode 100644
index 000..8fdcfd7
--- /dev/null
+++ 
b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestEndpointReachable.java
@@ -0,0 +1,84 @@
+/*
+ * 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 org.apache.brooklyn.test.framework;
+
+import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+
+/**
+ * Entity that checks if a TCP endpoint is reachable.
+ * 
+ * For example:
+ * 
+ * {@code
+ * services:
+ * - type: com.acme.MyEntityUnderTest
+ *   id: entity-under-test
+ * - type: org.apache.brooklyn.test.framework.TestCase
+ *   name: Tests
+ *   brooklyn.children:
+ *   - type: org.apache.brooklyn.test.framework.TestEndpointReachable
+ * name: Endpoint reachable
+ * brooklyn.config:
+ *   targetId: entity-under-test
+ *   timeout: 2m
+ *   endpointSensor: datastore.url
+ * }
+ * 
+ * 
+ * The sensor's value can be in a number of different formats: a string in the 
form of {@code ip:port}
+ * or URI format; or a {@link com.google.common.net.HostAndPort}; or a {@link 
java.net.URI}; or a 
+ * {@link java.net.URL} instance.
+ * 
+ * Alternatively an explicit endpoint can be used (e.g. constructed from other 
sensors of
+ * the target entity):
+ * 
+ * {@code
+ * services:
+ * - type: MyEntityUnderTest
+ *   id: entity-under-test
+ * - type: org.apache.brooklyn.test.framework.TestCase
+ *   name: Tests
+ *   brooklyn.children:
+ *   - type: org.apache.brooklyn.test.framework.TestEndpointReachable
+ * name: Endpoint reachable
+ * brooklyn.config:
+ *   targetId: entity-under-test
+ *   timeout: 2m
+ *   endpoint:
+ * $brooklyn:formatString:
+ * - %s:%s"
+ * - 
$brooklyn:entity("entity-under-test").attributeWhenReady("host.name")
+ * - 
$brooklyn:entity("entity-under-test").attributeWhenReady("https.port")
+ * }
+ * 
+ */
+@ImplementedBy(value = TestEndpointReachableImpl.class)
+public interface TestEndpointReachable extends BaseTest {
+
+ConfigKey ENDPOINT = ConfigKeys.newStringConfigKey(
+"endpoint", 
+"Endpoint (be it URL or host:port) to test, for tcp-reachability; 
mutually exclusive with 'endpointSensor'");
+
+ConfigKey ENDPOINT_SENSOR = ConfigKeys.newConfigKey(
+Object.class,
+"endpointSensor", 
+"Sensor (or name of sensor) on target that advertises the endpoint 
(to test for tcp-reachability); mutually exclusive with 'endpoint'");
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9337ebff/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestEndpointReachableImpl.java
--
diff --git 

[1/4] brooklyn-server git commit: YAML built-in types: include boolean etc

2016-05-19 Thread aledsage
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 6944ac5e1 -> dee107447


YAML built-in types: include boolean etc

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

Branch: refs/heads/master
Commit: 0aba4ffd1789b3591d70b0975e0a8088fa5d7129
Parents: f4a6bb8
Author: Aled Sage 
Authored: Tue May 17 10:53:11 2016 +0100
Committer: Aled Sage 
Committed: Tue May 17 10:53:11 2016 +0100

--
 .../java/org/apache/brooklyn/core/objs/BasicSpecParameter.java   | 4 
 1 file changed, 4 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0aba4ffd/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
--
diff --git 
a/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java 
b/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
index ea041b2..89b7cd0 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
@@ -186,6 +186,10 @@ public class BasicSpecParameter implements 
SpecParameter{
 private static final String DEFAULT_TYPE = "string";
 private static final Map BUILT_IN_TYPES = 
ImmutableMap.builder()
 .put(DEFAULT_TYPE, String.class)
+.put("boolean", Boolean.class)
+.put("byte", Byte.class)
+.put("char", Character.class)
+.put("short", Short.class)
 .put("integer", Integer.class)
 .put("long", Long.class)
 .put("float", Float.class)



[3/3] brooklyn-ui git commit: This closes #26

2016-05-19 Thread sjcorbett
This closes #26

Location wizard generates correct spec for Openstack


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

Branch: refs/heads/master
Commit: 6ecfb16d13ffc70b743ab7d1b674c9df3a63f489
Parents: 4006148 9e387e2
Author: Sam Corbett 
Authored: Thu May 19 16:17:51 2016 +0100
Committer: Sam Corbett 
Committed: Thu May 19 16:17:51 2016 +0100

--
 src/main/webapp/assets/js/view/location-wizard.js | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)
--




[2/3] brooklyn-ui git commit: Improve location wizard cloud names

2016-05-19 Thread sjcorbett
Improve location wizard cloud names


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

Branch: refs/heads/master
Commit: 9e387e21aefbe2c765b313b9e1e5a5a72f9e1e19
Parents: 2121fde
Author: Sam Corbett 
Authored: Thu May 19 15:34:40 2016 +0100
Committer: Sam Corbett 
Committed: Thu May 19 15:34:40 2016 +0100

--
 src/main/webapp/assets/js/view/location-wizard.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/9e387e21/src/main/webapp/assets/js/view/location-wizard.js
--
diff --git a/src/main/webapp/assets/js/view/location-wizard.js 
b/src/main/webapp/assets/js/view/location-wizard.js
index 14531bb..0a317b2 100644
--- a/src/main/webapp/assets/js/view/location-wizard.js
+++ b/src/main/webapp/assets/js/view/location-wizard.js
@@ -345,10 +345,10 @@ define([
 label: 'Cloud Provider',
 type: 'select',
 values: {
-'jclouds:aws-ec2': 'Amazon',
-'jclouds:google-compute-engine': 'Google',
-'jclouds:softlayer': 'Softlayer',
+'jclouds:aws-ec2': 'Amazon EC2',
+'jclouds:google-compute-engine': 'Google Compute 
Engine',
 'jclouds:openstack-nova': 'Openstack Nova',
+'jclouds:softlayer': 'SoftLayer',
 other: 'Other (supply location spec string)'
 }
 },



[2/2] brooklyn-server git commit: This closes #145

2016-05-19 Thread aledsage
This closes #145


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

Branch: refs/heads/master
Commit: 6944ac5e1d85ccb1ab1785b56ed20241032da5ee
Parents: 6efc98a 56735ee
Author: Aled Sage 
Authored: Thu May 19 12:04:14 2016 +0100
Committer: Aled Sage 
Committed: Thu May 19 12:04:14 2016 +0100

--
 .../base/VanillaWindowsProcessWinRmDriver.java  | 23 +---
 1 file changed, 20 insertions(+), 3 deletions(-)
--




[1/2] brooklyn-server git commit: Suppress exceptions in the isRunning check for Windows

2016-05-19 Thread aledsage
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 6efc98a6a -> 6944ac5e1


Suppress exceptions in the isRunning check for Windows

Some Windows Blueprints require restart.
That's why for the isRunning check,
I catched WinRM IO Exceptions which could happen because of the restart.


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

Branch: refs/heads/master
Commit: 56735ee313bffa14f170e26dbd2b74c8ad25978f
Parents: e5dcf40
Author: Valentin Aitken 
Authored: Wed May 18 23:44:14 2016 +0300
Committer: Valentin Aitken 
Committed: Thu May 19 12:08:08 2016 +0300

--
 .../base/VanillaWindowsProcessWinRmDriver.java  | 23 +---
 1 file changed, 20 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/56735ee3/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
--
diff --git 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
index 027c0c8..28971e4 100644
--- 
a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
+++ 
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaWindowsProcessWinRmDriver.java
@@ -22,11 +22,15 @@ import org.apache.brooklyn.api.entity.EntityLocal;
 import org.apache.brooklyn.core.entity.Attributes;
 import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
 import org.apache.brooklyn.util.core.internal.winrm.WinRmTool;
+import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.net.UserAndHostAndPort;
 import org.apache.brooklyn.util.text.Strings;
+import org.apache.cxf.interceptor.Fault;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.xml.ws.WebServiceException;
+
 public class VanillaWindowsProcessWinRmDriver extends 
AbstractSoftwareProcessWinRmDriver implements VanillaWindowsProcessDriver {
 private static final Logger LOG = 
LoggerFactory.getLogger(VanillaWindowsProcessWinRmDriver.class);
 
@@ -80,9 +84,22 @@ public class VanillaWindowsProcessWinRmDriver extends 
AbstractSoftwareProcessWin
 
 @Override
 public boolean isRunning() {
-int exitCode = executeCommandInTask(
-
getEntity().getConfig(VanillaWindowsProcess.CHECK_RUNNING_COMMAND),
-
getEntity().getConfig(VanillaWindowsProcess.CHECK_RUNNING_POWERSHELL_COMMAND), 
"is-running-command");
+int exitCode = 1;
+try {
+exitCode = executeCommandInTask(
+
getEntity().getConfig(VanillaWindowsProcess.CHECK_RUNNING_COMMAND),
+
getEntity().getConfig(VanillaWindowsProcess.CHECK_RUNNING_POWERSHELL_COMMAND), 
"is-running-command");
+} catch (Exception e) {
+// If machine is restarting, then will get WinRM IOExceptions - 
don't propagate such exceptions
+Throwable interestingCause = Exceptions.getFirstThrowableOfType(e, 
WebServiceException.class) != null ?
+Exceptions.getFirstThrowableOfType(e, 
WebServiceException.class/*Wraps Soap exceptions*/) : 
Exceptions.getFirstThrowableOfType(e, Fault.class/*Wraps IO exceptions*/);
+if (interestingCause != null) {
+LOG.warn(getEntity() + " isRunning check failed. Executing 
WinRM command failed.", e);
+return false;
+} else {
+throw e;
+}
+}
 if(exitCode != 0) {
 LOG.info(getEntity() + " isRunning check failed: exit code "  + 
exitCode);
 }