[GitHub] brooklyn-docs issue #93: Add to blueprinting-tips

2016-07-19 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-docs/pull/93
  
@aledsage Looks good. Duncan's comments worth addressing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


dev@brooklyn.apache.org

2016-07-28 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/97#discussion_r72660313
  
--- Diff: guide/start/policies.md ---
@@ -355,8 +355,8 @@ Tomcat on the vagrant VMs named "byon1" to "byon4":
 
 {% highlight bash %}
 $ for i in byon{1..4}; do
-$   vagrant ssh ${i} --command 'ps aux | grep -i tomcat |  grep -v grep | 
awk '\''{print $2}'\'' | xargs kill -9'
--- End diff --

I don't.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #281: Prevent VanillaSoftwareProcess commands from bei...

2016-07-29 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/281
  
+1 to this, it has caught me out in the past. It potentially breaks 
existing blueprints though so should be raised on the mailing list.

The test failures are valid: 
ConfigInheritanceYamlTest.testInheritsParentConfig and 
SpecParameterUnwrappingTest.testParameterDefaultsUsedInConfig.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #288: BROOKLYN-323: Simplify Logout api

2016-08-04 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/288
  
@bostko Can you describe why we should change `/logout` from `POST` to 
`GET`? For one it means that if I can find a way to inject HTML into the page I 
can log every user that loads it out. It also risks browsers pre-fetching the 
page and users being unexpectedly logged out (as described in 
http://stackoverflow.com/questions/3521290/logout-get-or-post).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #288: BROOKLYN-323: Simplify Logout api

2016-08-05 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/288
  
Test failure unrelated: 
SpecParameterUnwrappingTest.testParameterDefaultsUsedInConfig. Will check 
locally.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #288: BROOKLYN-323: Simplify Logout api

2016-08-05 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/288#discussion_r73668447
  
--- Diff: 
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/LogoutResource.java
 ---
@@ -37,32 +37,44 @@
 @Context UriInfo uri;
 
 @Override
+public Response redirectToLogout() {
+URI dest = uri.getBaseUriBuilder().path(LogoutApi.class).build();
+
+return Response.status(Status.OK)
+.entity(String.format("\n\n" +
+"\n" +
+"(function(c){var a=new window.XMLHttpRequest;" +
+// 
<a  rel="nofollow" href="https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open">https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/open</a>
+"a.open('POST','%1$s',0,'user',(new 
Date).getTime().toString());a.send(\"\");})();\n" +
+"window.location.href='/';", 
dest.toASCIIString()))
+.build();
+}
+
+@Override
 public Response logout() {
 WebEntitlementContext ctx = (WebEntitlementContext) 
Entitlements.getEntitlementContext();
-URI dest = 
uri.getBaseUriBuilder().path(LogoutApi.class).path(LogoutApi.class, 
"logoutUser").build(ctx.user());
 
-// When execution gets here we don't know whether this is the 
first fetch of logout() or a subsequent one
-// with a re-authenticated user. The only way to tell is compare 
if user names changed. So redirect to an URL
-// which contains the user name.
-return Response.status(Status.TEMPORARY_REDIRECT)
+if (ctx != null && ctx.user() != null) {
+doLogout();
+}
+
+URI dest = uri.getBaseUriBuilder().build();
+
+return Response.status(Status.UNAUTHORIZED)
+.header("WWW-Authenticate", "Basic realm=\"webconsole\"")
+// For Status 403, HTTP Location header may be omitted.
+// Location is best to be used for http status 302 
https://tools.ietf.org/html/rfc2616#section-10.3.3
 .header("Location", dest.toASCIIString())
+.entity("window.location.replace(\"/\");")
 .build();
 }
 
 @Override
+@Deprecated
 public Response logoutUser(String user) {
-// Will work when switching users, but will keep re-authenticating 
if user types in same user name.
-// Could improve by keeping state in cookies to decide whether to 
request auth or declare successfull re-auth.
-WebEntitlementContext ctx = (WebEntitlementContext) 
Entitlements.getEntitlementContext();
-if (user.equals(ctx.user())) {
-doLogout();
-
-return Response.status(Status.UNAUTHORIZED)
-.header("WWW-Authenticate", "Basic 
realm=\"webconsole\"")
-.build();
-} else {
-return 
Response.temporaryRedirect(uri.getAbsolutePathBuilder().replacePath("/").build()).build();
-}
+return Response.status(Status.FOUND)
+.header("Location", 
uri.getBaseUriBuilder().path(LogoutApi.class).path(LogoutApi.class, 
"logout").build())
--- End diff --

Are both calls of `path` required?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #288: BROOKLYN-323: Simplify Logout api

2016-08-05 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/288#discussion_r73669172
  
--- Diff: 
rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/LogoutResource.java
 ---
@@ -37,32 +37,44 @@
 @Context UriInfo uri;
 
 @Override
+public Response redirectToLogout() {
+URI dest = uri.getBaseUriBuilder().path(LogoutApi.class).build();
+
+return Response.status(Status.OK)
+.entity(String.format("\n\n" +
+"

[GitHub] brooklyn-server issue #288: BROOKLYN-323: Simplify Logout api

2016-08-05 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/288
  
Couple of questions / suggestions to answers then should be good to merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library pull request #57: add user sensor to MySqlNode

2016-08-05 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-library/pull/57#discussion_r73696688
  
--- Diff: 
software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlNode.java
 ---
@@ -89,6 +92,12 @@
 
 AttributeSensor QUERIES_PER_SECOND_FROM_MYSQL = 
Sensors.newDoubleSensor("mysql.queries.perSec.fromMysql");
 
+/** This comes from mysql.cnf
+ * See http://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html 
and http://dev.mysql.com/doc/refman/5.7/en/mysql-install-db.html
+ * for more details.
+ * */
+String DEFAULT_USERNAME = "root";
--- End diff --

What's your reasoning for putting this on the interface vs. the 
implementation?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #299: fix extra ssh key data

2016-08-15 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/299#discussion_r74765479
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
 ---
@@ -1013,10 +1013,22 @@ protected MachineLocation obtainOnce(ConfigBag 
setup) throws NoMachinesAvailable
 }
 executeCommandThrowingOnError(
 (SshMachineLocation)machineLocation,
-"Authorizing ssh keys",
+"Authorizing ssh keys from URLs",
 ImmutableList.of(new 
AuthorizeRSAPublicKeys(extraKeyDataToAuth).render(org.jclouds.scriptbuilder.domain.OsFamily.UNIX)));
 }
 }
+
+String extraKeyDataToAuth = 
setup.get(EXTRA_PUBLIC_KEY_DATA_TO_AUTH);
+if (extraKeyDataToAuth!=null && 
!extraKeyDataToAuth.isEmpty()) {
+if (windows) {
+LOG.warn("Ignoring flag 
EXTRA_PUBLIC_KEY_DATA_TO_AUTH on Windows location", machineLocation);
--- End diff --

It would be great if there were some way to communicate these messages to 
the user/tool doing the deployment. Or even to raise it before deployment.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #304: Adds a target configuration to the SSH co...

2016-08-19 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/304#discussion_r75483563
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/entity/group/SshCommandMembershipTrackingPolicy.java
 ---
@@ -25,7 +25,9 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import 
com.google.api.client.repackaged.com.google.common.base.Preconditions;
--- End diff --

We have a checkstyle rule to forbid this package.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #317: Changed jackson version to 2.7.5

2016-09-01 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/317
  
Can you test that `brooklyn-tosca` works with this change please?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #318: Delete most deprecated methods from PortF...

2016-09-02 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/318

Delete most deprecated methods from PortForwardManager

They've been deprecated since 0.7.0.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server pfm-deprecated

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/318.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #318


commit fc7708da163aefa28da2ced5990e63aa0cd9050e
Author: Sam Corbett 
Date:   2016-09-02T15:01:21Z

Delete most deprecated methods from PortForwardManager

They've been deprecated since 0.7.0.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #317: Changed jackson version to 2.7.5

2016-09-07 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/317
  
@grkvlt @Graeme-Miller I am not happy for this to be merged before you have 
confirmed or we have at least discussed what happens to the `brooklyn-tosca` 
dist.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #317: Changed jackson version to 2.7.5

2016-09-07 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/317
  
@geomacy did you use the dist tgz that brooklyn-tosca builds? I will also 
test shortly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #317: Changed jackson version to 2.7.5

2016-09-07 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/317
  
@ahgittin another downstream project has a dependency on 
https://github.com/fabric8io/kubernetes-client which requires the later version.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #317: Changed jackson version to 2.7.5

2016-09-07 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/317
  
I've tested Brooklyn 0.10.0-SNAPSHOT master + this PR against 
brooklyn-tosca master. The standard Tomcat/MySQL blueprint deployed fine from 
Alien4Cloud. The brooklyn-tosca dist includes these jars in its lib directory:
```
jackson-annotations-2.7.5.jar
jackson-core-2.7.5.jar
jackson-databind-2.7.5.jar
jackson-dataformat-xml-2.4.5.jar
jackson-dataformat-yaml-2.4.5.jar
jackson-datatype-joda-2.4.5.jar
jackson-jaxrs-base-2.7.5.jar
jackson-jaxrs-json-provider-2.7.5.jar
jackson-module-jaxb-annotations-2.7.5.jar
```
By the look of it the 2.4.5 dependencies have come from 
`io.swagger:swagger-core` and `swagger-jaxrs` via 
`brooklyn-utils-rest-swagger`. 

So sounds like we're good to go but keeping this at the back of our minds. 
@ahgittin do you think we need to maintain `brooklyn-tosca-dist` any more?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #318: Delete most deprecated methods from PortF...

2016-09-08 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/318#discussion_r78008532
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/core/location/access/PortForwardManagerImpl.java
 ---
@@ -83,9 +83,6 @@
 
 private final Map> associationListeners = new 
ConcurrentHashMap>();
 
-@Deprecated
-protected final Map publicIpIdToHostname = new 
LinkedHashMap();
--- End diff --

Is there a strategy for removing deprecated fields short of making them 
private and leaving them forever? Not sure we can do anything sensible to 
transform its data during rebind. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #106: Advise running ntpd on Brooklyn server

2016-09-09 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/106#discussion_r78152257
  
--- Diff: guide/ops/troubleshooting/deployment.md ---
@@ -40,9 +40,12 @@ means there was some problem obtaining or connecting to 
the machine.
 An error like `... Not authorized to access cloud ...` usually means the 
wrong identity/credential was used.
 
 AWS requires a X-Amz-Date header which contains the date of the Apache 
Brooklyn AWS client.
-If the date on the server is wrong, for example several minutes behind you 
will get Authorization Exception.
-Please be sure that the machine which is running Apache Brooklyn set its 
clock correctly.
-To set the time on Linux we advice to use the ntp client: `sudo ntpdate 
pool.ntp.org`.
+If the date on the server is wrong, for example several minutes behind you 
will get Authorization 
+Exception. This is prevent replay attacks. Please be sure that the machine 
which is running  
+Apache Brooklyn set its clock correctly. To set the time on Linux you can 
use the ntp client 
+(e.g. `sudo ntpdate pool.ntp.org`). We advice running the 
--- End diff --

typo: advice


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #327: Update geoip to latest version

2016-09-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/327
  
Looks good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #326: OSGi Features cleanup

2016-09-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/326
  
Merging


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #342: Load usage listeners from bundles

2016-09-22 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/342

Load usage listeners from bundles

And JcloudsLocation's image choosers.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server 
usage-listener-classloader

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/342.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #342


commit 136dd111e681ee50f13adc7435df84f635337cf2
Author: Sam Corbett 
Date:   2016-09-22T10:31:38Z

Move usage listener tests to core from software-base

commit 0af6740927894f73e693e2f623e51a85eae66472
Author: Sam Corbett 
Date:   2016-09-22T14:45:32Z

UsageListener loads class from ClassLoaderUtils

Rather than using LocalUsageManager's class loader

commit 507a364b436e177486307e290c431a6a709fa9c7
Author: Sam Corbett 
Date:   2016-09-22T15:02:59Z

JcloudsLocation loads image chooser class with ClassLoaderUtils




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #342: Load usage listeners from bundles

2016-09-22 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/342#discussion_r80077697
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManagerTest.java
 ---
@@ -16,67 +16,77 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.brooklyn.entity.software.base.test.core.mgmt.usage;
+
+package org.apache.brooklyn.core.mgmt.internal;
 
 import static org.testng.Assert.assertTrue;
 
 import java.util.List;
 
-import org.apache.brooklyn.test.Asserts;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
 import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
+import org.apache.brooklyn.core.mgmt.usage.RecordingUsageListener;
 import org.apache.brooklyn.core.mgmt.usage.UsageListener;
 import org.apache.brooklyn.core.mgmt.usage.UsageManager;
+import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
 import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.core.test.entity.TestApplication;
+import org.apache.brooklyn.test.Asserts;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 
-public class UsageListenerTest {
+public class LocalUsageManagerTest extends BrooklynAppUnitTestSupport {
 
 // Also see {Application|Location}UsageTrackingTest for listener 
functionality
-
-private static final Logger LOG = 
LoggerFactory.getLogger(ApplicationUsageTrackingTest.class);
-
-protected TestApplication app;
-protected ManagementContextInternal mgmt;
 
+@Override
 protected boolean shouldSkipOnBoxBaseDirResolution() {
 return true;
 }
 
+@Override
 @BeforeMethod(alwaysRun=true)
 public void setUp() throws Exception {
 RecordingStaticUsageListener.clearInstances();
+super.setUp();
 }
 
+@Override
 @AfterMethod(alwaysRun=true)
 public void tearDown() throws Exception {
-try {
-if (mgmt != null) Entities.destroyAll(mgmt);
-} catch (Throwable t) {
-LOG.error("Caught exception in tearDown method", t);
-} finally {
-mgmt = null;
-RecordingStaticUsageListener.clearInstances();
-}
+super.tearDown();
+RecordingStaticUsageListener.clearInstances();
+}
+
+@Test
+public void testAddUsageListenerInstance() throws Exception {
+BrooklynProperties brooklynProperties = 
BrooklynProperties.Factory.newEmpty();
+brooklynProperties.put(UsageManager.USAGE_LISTENERS, 
ImmutableList.of(new RecordingStaticUsageListener()));
+mgmt = 
LocalManagementContextForTests.newInstance(brooklynProperties);
+assertUsageListenerCalledWhenApplicationStarted();
 }
 
 @Test
 public void testAddUsageListenerViaProperties() throws Exception {
 BrooklynProperties brooklynProperties = 
BrooklynProperties.Factory.newEmpty();
 brooklynProperties.put(UsageManager.USAGE_LISTENERS, 
RecordingStaticUsageListener.class.getName());
 mgmt = 
LocalManagementContextForTests.newInstance(brooklynProperties);
-
+assertUsageListenerCalledWhenApplicationStarted();
+}
+
+@Test(expectedExceptions = ClassCastException   .class)
--- End diff --

Accidental tab. Why doesn't GitHub show I've fixed this any more?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #369: DynamicGroup filters entities in its app,...

2016-10-05 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/369

DynamicGroup filters entities in its app, not the management context

I think this would be the expected behaviour.

The current behaviour would cause entities like 
[brooklyn-dns-etc-hosts-generator](https://github.com/brooklyncentral/brooklyn-dns/blob/9898438dd2c8ddbe258ab93b1b66b42818b8121a/brooklyn-dns-etc-hosts-generator.bom#L43-L49)
 to be overenthusiastic at best and a security hole at worst.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server dynamic-group-target

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/369.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #369


commit 9cfca1021f566c30509922522e64e220c82a1a69
Author: Sam Corbett 
Date:   2016-10-05T10:48:28Z

DynamicGroup filters entities in its app, not the management context




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #369: DynamicGroup filters entities in its app, not th...

2016-10-05 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/369
  
The build timed out building the Camp API:
```
[INFO] Brooklyn CAMP REST API . FAILURE [33:24 
min]
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #370: ProxyEffector

2016-10-05 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/370

ProxyEffector

Forwards effector invocations from one entity to another.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server proxy-effector

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/370.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #370


commit 2db5d08b924e60144b2c1a5cbe99675596b225ec
Author: Sam Corbett 
Date:   2016-10-05T17:29:29Z

ProxyEffector

Forwards effector invocations from one entity to another.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #375: Tidy tests to always terminate ManagementContext

2016-10-10 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/375
  
Looks good to me. Are there any new guidelines test writers should follow? 
If yes it would be helpful to record them in documentation or on the mailing 
list.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #370: ProxyEffector

2016-10-10 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/370#discussion_r82679003
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/core/effector/ProxyEffectorTest.java ---
@@ -0,0 +1,88 @@
+/*
+ * 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.core.effector;
+
+import static org.testng.Assert.assertEquals;
+
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.entity.EntityInternal;
+import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.entity.stock.BasicEntity;
+import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.time.Duration;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+public class ProxyEffectorTest extends BrooklynAppUnitTestSupport {
+
+@Test
+public void testHappyPath() {
+TestEntity a = 
app.createAndManageChild(EntitySpec.create(TestEntity.class));
+ProxyEffector proxyEffector = new ProxyEffector(ImmutableMap.of(
+AddEffector.EFFECTOR_NAME, "proxy-effector",
+ProxyEffector.TARGET_ENTITY, a,
+ProxyEffector.TARGET_EFFECTOR_NAME, "identityEffector"));
+// BasicEntity doesn't have an identityEffector.
+EntityInternal b = 
Entities.deproxy(app.createAndManageChild(EntitySpec.create(BasicEntity.class)
+.addInitializer(proxyEffector)));
+Object output = b.invoke(b.getEffector("proxy-effector"), 
ImmutableMap.of("arg", "value"))
+.getUnchecked(Duration.ONE_MINUTE);
+assertEquals(output, "value");
+}
+
+@Test
+public void testThrowsIfTargetEffectorDoesntExist() {
+TestEntity a = 
app.createAndManageChild(EntitySpec.create(TestEntity.class));
+ProxyEffector proxyEffector = new ProxyEffector(ImmutableMap.of(
+AddEffector.EFFECTOR_NAME, "proxy-effector",
+ProxyEffector.TARGET_ENTITY, a,
+ProxyEffector.TARGET_EFFECTOR_NAME, "kajnfksjdnfkjsdnf"));
+EntityInternal b = 
Entities.deproxy(app.createAndManageChild(EntitySpec.create(BasicEntity.class)
+.addInitializer(proxyEffector)));
+try {
+b.invoke(b.getEffector("proxy-effector"), 
ImmutableMap.of("arg", "value"))
+.getUnchecked(Duration.ONE_MINUTE);
+Asserts.shouldHaveFailedPreviously("expected exception when 
invoking effector that does not exist");
+} catch (Exception e) {
+// expected.
+}
+}
+
+@Test(expectedExceptions = NullPointerException.class)
--- End diff --

What's the benefit?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #370: ProxyEffector

2016-10-10 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/370
  
@geomacy thanks for your comments. I've resolved the comments that I didn't 
reply to. Is there anything you'd like to follow up on?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #369: DynamicGroup filters entities in its app, not th...

2016-10-10 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/369
  
@geomacy thanks. Merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #382: InvokeEffectorOnSetChange

2016-10-13 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/382

InvokeEffectorOnSetChange

Tracks a collection and invokes effectors when elements are added and 
removed.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server invoke-set-change

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/382.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #382


commit 8bbf68a07f86b06900fcd84cf9b6f71669f97bc5
Author: Sam Corbett 
Date:   2016-10-13T10:24:15Z

getEffectorByName returns absent rather than throwing NPE when arg null.

commit 2797e0c23d53ae4e0e3900f8b92e117d1da92783
Author: Sam Corbett 
Date:   2016-10-13T10:24:35Z

Add Sensors.newSensor(TypeToken, name)

commit f3017f6a3e129ebf026da89d98113657aa649c61
Author: Sam Corbett 
Date:   2016-10-13T10:32:43Z

InvokeEffectorOnSetChange

Tracks a collection and invokes effectors when elements are added and
removed.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #370: ProxyEffector

2016-10-13 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/370
  
@geomacy thanks for the thorough review. I've fixed that typo. I'll merge 
now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #382: InvokeEffectorOnSetChange

2016-10-13 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/382#discussion_r83260337
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/policy/InvokeEffectorOnSetChange.java ---
@@ -0,0 +1,203 @@
+/*
+ * 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.policy;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Sets;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Subscribes to events on a collection {@link AttributeSensor} and 
invokes the named
+ * effectors for each element that was added and removed.
+ * 
+ * The policy only detects replacements of the collection; it 
does not act on
+ * modifications. If the sensor has value A and an element is 
added –
+ * value A' – the on-added effector is not invoked. If 
the sensor is
+ * later set to B the delta is made between A 
and B,
+ * not A' and B.
+ * 
+ * To simplify the detection of additions and removals the collection is 
converted to a
+ * {@link Set}. This means that only a single event will fire for 
duplicate elements in
+ * the collection.
+ * 
+ * The effectors are provided the elements that changed in their parameter 
map. If the
+ * sensor is a collection of maps the elements are provided with their 
keys coerced to
+ * strings and their values unchanged. Otherwise the elements are provided 
in a
+ * single-entry map keyed by the value for {@link #PARAMETER_NAME}.
+ */
+public class InvokeEffectorOnSetChange extends AbstractPolicy implements 
SensorEventListener> {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(InvokeEffectorOnSetChange.class);
+
+public static final ConfigKey>> TRIGGER_SENSOR = ConfigKeys.newConfigKey(
+new TypeToken>>() {},
+"sensor",
+"Sensor to be monitored.");
+
+public static final ConfigKey PREVIOUS_SENSOR_NAME = 
ConfigKeys.newStringConfigKey(
+"previousSensorName",
+"The name under which the previous value for the trigger 
sensor should be published. " +
+"If unset \".previous\" will be appended to the name 
of the trigger sensor.");
+
+public static final ConfigKey ON_ADDED_EFFECTOR_NAME = 
ConfigKeys.newStringConfigKey(
+"onAdded",
+"Name of the effector to invoke when entries are added to the 
collection.");
+
+public static final ConfigKey ON_REMOVED_EFFECTOR_NAME = 
ConfigKeys.newStringConfigKey(
+"onRemoved",
+"Name of the effector to invoke when entries are removed from 
the collection.");
+
+public static final ConfigKey PARAMETE

[GitHub] brooklyn-server pull request #382: InvokeEffectorOnSetChange

2016-10-13 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/382#discussion_r83262396
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/policy/InvokeEffectorOnSetChange.java ---
@@ -0,0 +1,203 @@
+/*
+ * 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.policy;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Sets;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Subscribes to events on a collection {@link AttributeSensor} and 
invokes the named
+ * effectors for each element that was added and removed.
+ * 
+ * The policy only detects replacements of the collection; it 
does not act on
+ * modifications. If the sensor has value A and an element is 
added –
+ * value A' – the on-added effector is not invoked. If 
the sensor is
+ * later set to B the delta is made between A 
and B,
+ * not A' and B.
+ * 
+ * To simplify the detection of additions and removals the collection is 
converted to a
+ * {@link Set}. This means that only a single event will fire for 
duplicate elements in
+ * the collection.
+ * 
+ * The effectors are provided the elements that changed in their parameter 
map. If the
+ * sensor is a collection of maps the elements are provided with their 
keys coerced to
+ * strings and their values unchanged. Otherwise the elements are provided 
in a
+ * single-entry map keyed by the value for {@link #PARAMETER_NAME}.
+ */
+public class InvokeEffectorOnSetChange extends AbstractPolicy implements 
SensorEventListener> {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(InvokeEffectorOnSetChange.class);
+
+public static final ConfigKey>> TRIGGER_SENSOR = ConfigKeys.newConfigKey(
+new TypeToken>>() {},
+"sensor",
+"Sensor to be monitored.");
+
+public static final ConfigKey PREVIOUS_SENSOR_NAME = 
ConfigKeys.newStringConfigKey(
+"previousSensorName",
+"The name under which the previous value for the trigger 
sensor should be published. " +
+"If unset \".previous\" will be appended to the name 
of the trigger sensor.");
+
+public static final ConfigKey ON_ADDED_EFFECTOR_NAME = 
ConfigKeys.newStringConfigKey(
+"onAdded",
+"Name of the effector to invoke when entries are added to the 
collection.");
+
+public static final ConfigKey ON_REMOVED_EFFECTOR_NAME = 
ConfigKeys.newStringConfigKey(
+"onRemoved",
+"Name of the effector to invoke when entries are removed from 
the collection.");
+
+public static final ConfigKey PARAMETE

[GitHub] brooklyn-server issue #382: InvokeEffectorOnSetChange

2016-10-13 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/382
  
@neykov thank you for your comments. I've addressed everything I didn't 
comment on. I've also renamed the policy to 
`InvokeEffectorOnCollectionSensorChange` to be consistent with the existing 
`InvokeEffectorOnSensorChange`, but no strong feelings there really.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #382: InvokeEffectorOnCollectionSensorChange

2016-10-13 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/382#discussion_r83282121
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/policy/InvokeEffectorOnSetChange.java ---
@@ -0,0 +1,203 @@
+/*
+ * 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.policy;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.api.sensor.Sensor;
+import org.apache.brooklyn.api.sensor.SensorEvent;
+import org.apache.brooklyn.api.sensor.SensorEventListener;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
+import org.apache.brooklyn.util.collections.MutableMap;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Sets;
+import com.google.common.reflect.TypeToken;
+
+/**
+ * Subscribes to events on a collection {@link AttributeSensor} and 
invokes the named
+ * effectors for each element that was added and removed.
+ * 
+ * The policy only detects replacements of the collection; it 
does not act on
+ * modifications. If the sensor has value A and an element is 
added –
+ * value A' – the on-added effector is not invoked. If 
the sensor is
+ * later set to B the delta is made between A 
and B,
+ * not A' and B.
+ * 
+ * To simplify the detection of additions and removals the collection is 
converted to a
+ * {@link Set}. This means that only a single event will fire for 
duplicate elements in
+ * the collection.
+ * 
+ * The effectors are provided the elements that changed in their parameter 
map. If the
+ * sensor is a collection of maps the elements are provided with their 
keys coerced to
+ * strings and their values unchanged. Otherwise the elements are provided 
in a
+ * single-entry map keyed by the value for {@link #PARAMETER_NAME}.
+ */
+public class InvokeEffectorOnSetChange extends AbstractPolicy implements 
SensorEventListener> {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(InvokeEffectorOnSetChange.class);
+
+public static final ConfigKey>> TRIGGER_SENSOR = ConfigKeys.newConfigKey(
+new TypeToken>>() {},
+"sensor",
+"Sensor to be monitored.");
+
+public static final ConfigKey PREVIOUS_SENSOR_NAME = 
ConfigKeys.newStringConfigKey(
+"previousSensorName",
+"The name under which the previous value for the trigger 
sensor should be published. " +
+"If unset \".previous\" will be appended to the name 
of the trigger sensor.");
+
+public static final ConfigKey ON_ADDED_EFFECTOR_NAME = 
ConfigKeys.newStringConfigKey(
+"onAdded",
+"Name of the effector to invoke when entries are added to the 
collection.");
+
+public static final ConfigKey ON_REMOVED_EFFECTOR_NAME = 
ConfigKeys.newStringConfigKey(
+"onRemoved",
+"Name of the effector to invoke when entries are removed from 
the collection.");
+
+public static final ConfigKey PARAMETE

[GitHub] brooklyn-server issue #382: InvokeEffectorOnCollectionSensorChange

2016-10-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/382
  
I will merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #335: Update geoip to latest version

2016-10-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/335
  
Looks good. Will merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #384: Fix calculation of currently used memory by the ...

2016-10-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/384
  
Looks good. Will merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #386: Add AbstractInvokeEffectorPolicy

2016-10-18 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/386

Add AbstractInvokeEffectorPolicy

Supports tracking the number of effector tasks that are ongoing and 
publishing that as an "is busy" sensor on the entity the policy is attached to. 
Tracking is enabled by providing a value for `isBusySensor` when configuring 
the policy. 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server 
invoke-effector-is-busy

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/386.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #386


commit 499c3489d283df3f292fdea55293ccfd95bb0ebb
Author: Sam Corbett 
Date:   2016-10-17T16:29:07Z

Add AbstractInvokeEffectorPolicy

Supports tracking the number of effector tasks that are ongoing and
publishing that as an "is busy" sensor on the entity the policy is
attached to.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #319: Clean up duplicated code in JcloudsLocati...

2016-10-18 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/319#discussion_r83863239
  
--- Diff: 
utils/common/src/main/java/org/apache/brooklyn/util/net/Networking.java ---
@@ -241,7 +241,12 @@ public static void checkPortsValid(Map ports) {
 public static RangeSet portRulesToRanges(Collection 
portRules) {
 RangeSet result = TreeRangeSet.create();
 for (String portRule : portRules) {
-if (portRule.contains("-")) {
+if (portRule.isEmpty()) {
+throw new IllegalArgumentException("portRule shouldn't be 
empty");
+}
+if (portRule.equals("-1")) {
+result.add(Range.closed(Integer.parseInt("-1"), 
Integer.parseInt("-1")));
--- End diff --

Is this necessary? Strikes me as surprising and I can't see where it's 
required in these changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #319: Clean up duplicated code in JcloudsLocati...

2016-10-18 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/319#discussion_r83867577
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/SharedLocationSecurityGroupCustomizer.java
 ---
@@ -76,6 +79,14 @@
 private RangeSet udpPortRanges;
 
 /**
+ * Tested only on AWS only.
+ * It depends on the cloud provider and jclouds driver whether 
security group allows opening ICMP.
+ */
+private Boolean openIcmp;
+
+private Collection updatedSecurityGroups;
--- End diff --

Delete this and `getUpdatedSecurityGroups` and add a new method to the 
class (not sure of the best name for it, maybe simply `doCustomize`?) that 
performs the customisation and returns the new security groups. 
`customize(JcloudsLocation, ComputeService, JcloudsMachineLocation)` should 
call this new method and discard the result.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #319: Clean up duplicated code in JcloudsLocationCusto...

2016-10-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/319
  
LGTM. Will wait for Jenkins to complete before merging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #319: Clean up duplicated code in JcloudsLocationCusto...

2016-10-19 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/319
  
@bostko there are four test failures:
```

org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizerTest.testInboundIcmpAddedToPermissions

org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizerTest.testInboundPortsAddedToPermissions

org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizerTest.testPermissionsSetFromPortRanges

org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizerTest.testUdpPermissionsSetFromPortRanges
```
The exception is the same in each one:
```
java.lang.NullPointerException: null
at 
org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizer.applySecurityGroupCustomizations(SharedLocationSecurityGroupCustomizer.java:192)
at 
org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizer.customize(SharedLocationSecurityGroupCustomizer.java:152)
at 
org.apache.brooklyn.location.jclouds.networking.SharedLocationSecurityGroupCustomizerTest.testUdpPermissionsSetFromPortRanges(SharedLocationSecurityGroupCustomizerTest.java:109)
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #116: Correct typo

2016-10-19 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-docs/pull/116

Correct typo



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-docs typo

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-docs/pull/116.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #116


commit 525631aa5f1693e313c74a5d7396cc06b6a2b510
Author: Sam Corbett 
Date:   2016-10-19T09:20:53Z

Correct typo




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library issue #67: Set proper datastore.url in ElasticSearch

2016-10-20 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-library/pull/67
  
@bostko @ygy thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library pull request #68: BindDns improvements for CentOS

2016-10-20 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-library/pull/68

BindDns improvements for CentOS

On CentOS bind is run by `named`, on Debian it is `bind`. Previously we 
used the latter in both cases.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-library bind

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-library/pull/68.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #68


commit f0828cdedde517533acf3784feb740308629fea7
Author: Sam Corbett 
Date:   2016-10-20T12:40:14Z

BindDnsServerImpl checks that ADDRESS_SENSOR was set.

commit fe1de31edf537d14d42e1a80bb28967d4212977c
Author: Sam Corbett 
Date:   2016-10-20T13:24:36Z

Correct working directory on RHEL

Previously it would use .../data/data

commit 24cb3810a86f9c872042827f340ca1e02f72d29c
Author: Sam Corbett 
Date:   2016-10-20T13:25:17Z

BindDns entity sets user running service per operating system

Use "named" on RHEL and "bind" on Ubuntu




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #393: Lifecycle fixes

2016-10-24 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/393

Lifecycle fixes

Fixes a handful of surprising behaviours in AbstractApplication, 
DynamicGroup and BasicStartable.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server fixes

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/393.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #393


commit 15aa6ff8b572da0142a905679714fbddc9a8ff58
Author: Sam Corbett 
Date:   2016-10-20T14:56:01Z

DynamicGroup wraps entity filters in a same-app check

commit 48c98abf36cadfa3a5837ab16a37709783e20826
Author: Sam Corbett 
Date:   2016-10-20T15:40:48Z

BasicStartable is on fire if any of its children are on fire

And follow the same pattern as DynamicCluster for setting expected
state when starting and stopping.

commit 6e1a31872efbb3f9a991fcce83a875b3d89aa85f
Author: Sam Corbett 
Date:   2016-10-20T15:42:02Z

AbstractApplication recovers from failure of children

Previously if a problem with child start up was fixed the application
would only recover if its start method was re-run.

commit eedf276e8c75bf7a5e53580e3c4b2ed0c742da4e
Author: Sam Corbett 
Date:   2016-10-24T10:43:15Z

Handle pre/post/launch errors in AbstractSoftwareProcessDriver restart

Previously if any phase errored (e.g. a post-launch comment exited with a
non-zero code) the entity would be stuck in the 'starting' state.

Fixes https://issues.apache.org/jira/browse/BROOKLYN-371

commit 1ed02b28a285d83050049973df559a34f04e9a79
Author: Sam Corbett 
Date:   2016-10-24T10:43:34Z

Asserts.expectedFailureOfType requires at least one type




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #386: Add AbstractInvokeEffectorPolicy

2016-10-24 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/386
  
@aledsage thanks for your comments. I've replaced `TASK_COUNTER` with a 
field and have added a test for the sensor to 
`InvokeEffectorOnCollectionSensorChangeTest`. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #393: Lifecycle fixes

2016-10-24 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/393
  
One possibly surprising new behaviour from 1e44522 involves the status of a 
`BasicStartable` when its children restart. I'll use this blueprint as an 
example:
```yaml
location: localhost
services:
- type: org.apache.brooklyn.entity.stock.BasicStartableImpl
  brooklyn.children:
  - type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess
brooklyn.config:
  postLaunchCommand: "exit 1"
  startTimeout: 2s
```
Previously, once the ESP entity has failed once the `BasicStartable` is 
_always_ on fire, even if `postLaunchCommand` were modified to something 
sensible. With the changes in this pull request when the ESP restarts the 
BasicStartable's state transitions to RUNNING, then back to `ON_FIRE` when the 
post-launch command fails for the second time. I discussed this with 
@justin.thompson. We felt that though the new behaviour isn't entirely 
satisfactory it is less wrong than before. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-client pull request #30: br app only outputs location details when ...

2016-10-24 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-client/pull/30

br app only outputs location details when the app has a location

Fixes https://issues.apache.org/jira/browse/BROOKLYN-230.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-client brooklyn-230

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-client/pull/30.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #30


commit bcc1360690cefb4b677a9556117e6d3400dac71d
Author: Sam Corbett 
Date:   2016-10-24T16:40:53Z

Only output location details when the app has a location

Fixes https://issues.apache.org/jira/browse/BROOKLYN-230




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #393: Lifecycle fixes

2016-10-25 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/393#discussion_r84863480
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/entity/stock/BasicStartableImpl.java ---
@@ -51,6 +53,7 @@
 public void start(Collection locations) {
 try {
 ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING);
+ServiceProblemsLogic.clearProblemsIndicator(this, START);
--- End diff --

It made sense when the `catch` block set the expected state to `ON_FIRE` 
but isn't necessary now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #386: Add AbstractInvokeEffectorPolicy

2016-10-25 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/386#discussion_r84946013
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/policy/AbstractInvokeEffectorPolicy.java 
---
@@ -0,0 +1,110 @@
+/*
+ * 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.policy;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.annotation.Nonnull;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.MoreExecutors;
+
+public abstract class AbstractInvokeEffectorPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractInvokeEffectorPolicy.class);
+
+public static final ConfigKey IS_BUSY_SENSOR_NAME = 
ConfigKeys.newStringConfigKey(
+"isBusySensor",
+"Name of the sensor to publish on the entity that indicates 
that this policy has incomplete effectors. " +
+"If unset running tasks will not be tracked.");
+
+private final AtomicInteger taskCounter = new AtomicInteger();
+
+@Override
+public void setEntity(EntityLocal entity) {
+super.setEntity(entity);
+if (isBusySensorEnabled()) {
+// Republishes when the entity rebinds.
+publishIsBusy();
--- End diff --

It relies on `taskCounter` _not_ being persisted. When Brooklyn rebinds 
`taskCounter` is a fresh instance whose count is zero so `isBusy` will be 
`false`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #386: Add AbstractInvokeEffectorPolicy

2016-10-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/386
  
@neykov I've pushed some updates that extend the 'more updates coming' 
notion to `InvokeEffectorOnSensorChange`. I'd appreciate you casting your eye 
over `AbstractInvokeEffectorPolicy` once more.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #393: Lifecycle fixes

2016-10-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/393
  
@neykov I've updated per your comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #386: Add AbstractInvokeEffectorPolicy

2016-10-31 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/386#discussion_r85716905
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/policy/AbstractInvokeEffectorPolicy.java 
---
@@ -0,0 +1,145 @@
+/*
+ * 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.policy;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+import javax.annotation.Nonnull;
+
+import org.apache.brooklyn.api.effector.Effector;
+import org.apache.brooklyn.api.entity.EntityLocal;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.policy.AbstractPolicy;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.util.guava.Maybe;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Objects;
+import com.google.common.util.concurrent.MoreExecutors;
+
+public abstract class AbstractInvokeEffectorPolicy extends AbstractPolicy {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(AbstractInvokeEffectorPolicy.class);
+
+public static final ConfigKey IS_BUSY_SENSOR_NAME = 
ConfigKeys.newStringConfigKey(
+"isBusySensor",
+"Name of the sensor to publish on the entity that indicates 
that this policy has incomplete effectors. " +
+"If unset running tasks will not be tracked.");
+
+private final AtomicInteger taskCounter = new AtomicInteger();
+
+/**
+ * Indicates that onEvent was notified of an value of is not the 
latest sensor value.
+ */
+private boolean moreUpdatesComing;
+/**
+ * The timestamp of the event that informed moreUpdatesComing. 
Subsequent notifications
+ * of earlier events will not cause updates of moreUpdatesComing.
+ */
+private long mostRecentUpdate = 0;
+/**
+ * Guards {@link #moreUpdatesComing} and {@link #mostRecentUpdate}.
+ */
+private final Object[] moreUpdatesLock = new Object[0];
+
+@Override
+public void setEntity(EntityLocal entity) {
+super.setEntity(entity);
+if (isBusySensorEnabled()) {
+// Republishes when the entity rebinds.
+publishIsBusy();
+}
+}
+
+/**
+ * Invoke effector with parameters on the entity that the policy is 
attached to.
+ */
+protected  Task invoke(Effector effector, Map 
parameters) {
+if (isBusySensorEnabled()) {
+getTaskCounter().incrementAndGet();
+publishIsBusy();
+}
+Task task = entity.invoke(effector, parameters);
+if (isBusySensorEnabled()) {
+task.addListener(new EffectorListener(), 
MoreExecutors.sameThreadExecutor());
+}
+return task;
+}
+
+protected boolean isBusy() {
+synchronized (moreUpdatesLock) {
--- End diff --

I included the synchronisation to make sure that `moreUpdatesComing` is 
visible to whatever thread invokes the effector's completion listener (which 
calls `publishIsBusy` which calls `isBusy`). At a minimum the field should be 
volatile then. Is it a big one for you? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #409: bump sshj to same jclouds version

2016-11-07 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/409
  
I also have integration test failures on this branch:
```
  SshjToolIntegrationTest.testAsyncExecAbortsIfProcessFails:273 expected 
[false] but found [true]
  SshjToolIntegrationTest.testAsyncExecTimesOut:234 exec took 301 seconds 
expected [true] but found [false]
```
In both cases the behaviour actually being tested works as expected but it 
fails to clean up temporary files afterwards, blocking on this line of 
`SshjTool`:
```
int execDeleteResult = asInt(acquire(new 
ShellAction(deleteTemporaryFilesCommand(), out, err, pollTimeout)), -1)
```
The tests block waiting for the channel to close:
```
"main" #1 prio=5 os_prio=31 tid=0x7fd9fc80 nid=0x1703 waiting on 
condition [0x70217000]
   java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x0007b9ff5468> (a 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at 
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2163)
at net.schmizz.concurrent.Promise.tryRetrieve(Promise.java:170)
at net.schmizz.concurrent.Promise.retrieve(Promise.java:137)
at net.schmizz.concurrent.Event.await(Event.java:103)
at 
net.schmizz.sshj.connection.channel.AbstractChannel.join(AbstractChannel.java:259)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$ShellAction.create(SshjTool.java:1007)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$ShellAction.create(SshjTool.java:924)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.acquire(SshjTool.java:625)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.acquire(SshjTool.java:611)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool$2.run(SshjTool.java:433)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.execScriptAsyncAndPoll(SshjTool.java:544)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjTool.execScript(SshjTool.java:316)
at 
org.apache.brooklyn.util.core.internal.ssh.sshj.SshjToolIntegrationTest.testAsyncExecTimesOut(SshjToolIntegrationTest.java:221)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
```
If you enable sshj's debug log you'll see lots of messages like:
```
DEBUG net.schmizz.concurrent.Promise [main]: Awaiting <>
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #422: SshCommandEffector + shell.env

2016-11-09 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/422

SshCommandEffector + shell.env

SshCommandEffector resolves shell.env against the target entity rather than 
always resolving it against the entity the effector is attached to. This also 
fixes the resolution of the execution directory.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server ssh-eff-shell-env

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/422.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #422


commit 5b9af64cb9278fd8581c88d317145b66efbc5176
Author: Sam Corbett 
Date:   2016-11-07T18:26:36Z

Typos

commit 02bc3123fdf805cddcacfa5cd06a5926ebd65671
Author: Sam Corbett 
Date:   2016-11-07T18:28:04Z

XmlSerialiserTest logs at debug

\u001b in testIllegalXmlCharacter breaks tmux when it's printed

commit ad17113f2cd35c511154fe299050ef6409f3010d
Author: Sam Corbett 
Date:   2016-11-08T17:54:39Z

Delete duplicate dependency on jackson-datatype-guava

commit 14349d1972811162b49a2db1515c7405a1bc29ac
Author: Sam Corbett 
Date:   2016-11-08T19:22:26Z

Fix Debian 7 live test

ami-5586a43c is not unavailable.

commit fc3394c2705ec7e945172c3170c0a37e4401c5f6
Author: Sam Corbett 
Date:   2016-11-09T15:26:18Z

SshCommandEffector resolves shell.env against the target entity

Rather than always resolving it against the entity the effector is
attached to. This also fixes the resolution of the execution directory.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #422: SshCommandEffector + shell.env

2016-11-09 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/422
  
Resolution of shell environments is badly affected by the problem #385 
fixes. For example when you invoke the effector created in this bluerint:

```yaml
location: localhost
services:
- type: brooklyn.entity.group.DynamicCluster
  id: cluster
  brooklyn.config:
initialSize: 3
memberSpec:
  $brooklyn:entitySpec:
type: org.apache.brooklyn.entity.software.base.EmptySoftwareProcess
brooklyn.config:
  shell.env:
MEMBER_CFG: $brooklyn:config("cluster.member.id")
MEMBER_ID: $brooklyn:attributeWhenReady("entity.id")

  - type: brooklyn.entity.software.ssh.SshCommandEffector
brooklyn.config:
  name: test-effector
  shell.env:
CLUSTER_ID: $brooklyn:attributeWhenReady("entity.id")
  command: 'echo "cluster=${CLUSTER_ID}, memberId=${MEMBER_ID}, 
member=${MEMBER_CFG}" >> /tmp/echo'
  executionTarget: members
```
You generally observe output like:
```
cluster=hgnwhpehtq, memberId=h0ea5qzz4k, member=1
cluster=hgnwhpehtq, memberId=hgnwhpehtq, member=
cluster=hgnwhpehtq, memberId=hgnwhpehtq, member=
```
In two of the three cases the entries in the member's `shell.env` were 
resolved against the cluster, not the member.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #422: SshCommandEffector + shell.env

2016-11-10 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/422
  
Thanks @geomacy and @aledsage. I'll write a test for the new behaviour. Is 
there any way to inject a mock SSH tool? Would be neat if the test could be a 
unit test rather than an integration test.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #429: BasicJcloudsLocationCustomizer is an Enti...

2016-11-11 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/429

BasicJcloudsLocationCustomizer is an EntityInitializer

Repeats https://github.com/apache/brooklyn-server/pull/168 but puts the 
location customizers into the entity's provisioning properties rather than 
setting it on the entity directly. It required moving 
`SoftwareProcess.PROVISIONING_PROPERTIES` to `BrooklynConfigKeys` so that it 
could be referenced from `brooklyn-locations-jclouds`.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server 
initialiser-add-customiser

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/429.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #429


commit fe0ad8ca7c163fdae17b6b561ca9a35ccddf4270
Author: Sam Corbett 
Date:   2016-11-11T11:58:28Z

Make BasicJcloudsLocationCustomizer an EntityInitializer

commit 8fd8688d8805ec8b0d2a97280378ebd680eb28dc
Author: Sam Corbett 
Date:   2016-11-11T12:14:22Z

Make BailOutJcloudsLocation logic a bit simpler




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #439: Add Suppliers.incrementingSupplier

2016-11-15 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/439

Add Suppliers.incrementingSupplier

A simple useful class. I have a pull request coming for brooklyn-library 
that makes proper use of this.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server 
incrementing-supplier

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/439.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #439


commit a14b7c31f5ea62d4690c877dc960be23cd7df4c9
Author: Sam Corbett 
Date:   2016-11-15T10:34:27Z

Add Suppliers.incrementingSupplier




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-dist issue #59: Set default JVM memory settings for the build

2016-11-15 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-dist/pull/59
  
I think this has triggered the rat plugin:
```
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.11:check 
(default) on project brooklyn-dist-root: Too many files with unapproved 
license: 1 See RAT report in: 
/home/jenkins/jenkins-slave/workspace/brooklyn-dist-pull-requests/target/rat.txt
 -> [Help 1]
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library issue #74: Set default JVM memory settings for the build

2016-11-15 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-library/pull/74
  
Rat again: [ERROR] Failed to execute goal 
org.apache.rat:apache-rat-plugin:0.11:check (default) on project 
brooklyn-library: Too many files with unapproved license: 1 See RAT report in: 
/home/jenkins/jenkins-slave/workspace/brooklyn-library-pull-requests/target/rat.txt
 -> [Help 1]



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library pull request #75: ZooKeeper ensemble fixes

2016-11-15 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-library/pull/75

ZooKeeper ensemble fixes

* Fixes ZooKeeper ensembles by ensuring that each node has a different id. 
* Improves live tests to test that data can be written and read back.
* ZooKeeperNodes publish their host and port on main.uri
* ZooKeeperEnsemble aggregates its member's main.uris into a list and 
combines them into a comma-separated string at `zookeeper.endpoints`.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-library zookeeper-ensemble

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-library/pull/75.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #75


commit 0a26e56d680a940155737ef6bddfa04b0566179c
Author: Sam Corbett 
Date:   2016-11-08T18:59:20Z

Add javax.ws.rs-api dependency to software/messaging in test scope

commit 1d6738a6fe64cfd9db3c91de40cba24fde1d756c
Author: Sam Corbett 
Date:   2016-11-14T18:35:54Z

ZooKeeper tests: assert data can be written and read back

commit 570683039e2f7188ea96eb7f5f284372db37230d
Author: Sam Corbett 
Date:   2016-11-15T10:40:38Z

ZooKeeperNode ID is config rather than a sensor

Defaults to 1. ZooKeeperEnsemble increments it on each member. This fixes
communication between nodes.

commit bd9bbca7ed743871cb88ae6c185f48fec1658429
Author: Sam Corbett 
Date:   2016-11-15T13:06:34Z

ZooKeeper nodes publish main.uri and ensembles aggregate to list

commit 287c7ab3d73e08424b358588c34ec48851403b3b
Author: Sam Corbett 
Date:   2016-11-15T13:07:00Z

Exclude log4j-over-slf4j from storm dependency




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library issue #75: ZooKeeper ensemble fixes

2016-11-15 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-library/pull/75
  
These changes depend on https://github.com/apache/brooklyn-server/pull/439.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library issue #75: ZooKeeper ensemble fixes

2016-11-15 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-library/pull/75
  
The build failed because it's missing the dependencies mentioned in 
brooklyn-server.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #429: BasicJcloudsLocationCustomizer is an Enti...

2016-11-16 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/429#discussion_r88222541
  
--- Diff: 
locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/BasicJcloudsLocationCustomizerTest.java
 ---
@@ -0,0 +1,81 @@
+/*
+ * 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.location.jclouds;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Collection;
+
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.core.entity.BrooklynConfigKeys;
+import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+public class BasicJcloudsLocationCustomizerTest extends 
BrooklynAppUnitTestSupport {
+
+private BasicJcloudsLocationCustomizer testCustomizer;
+
+@BeforeMethod
+@Override
+public void setUp() throws Exception {
+super.setUp();
+testCustomizer = new BasicJcloudsLocationCustomizer();
+}
+
+@SuppressWarnings("unchecked")
+@Test
+public void testCustomiserIncluded() {
+
+TestEntity entity = 
app.createAndManageChild(EntitySpec.create(TestEntity.class)
+.addInitializer(testCustomizer));
+Object object = 
entity.config().get(BrooklynConfigKeys.PROVISIONING_PROPERTIES.subKey(
+
JcloudsLocationConfig.JCLOUDS_LOCATION_CUSTOMIZERS.getName()));
+assertNotNull(object, "expected value for customizers in " + 
entity.config().get(BrooklynConfigKeys.PROVISIONING_PROPERTIES));
+assertTrue(object instanceof Collection, "expected collection, got 
" + object.getClass());
+Collection customizers = 
(Collection) object;
+assertEquals(customizers.size(), 1, "expected single customizer in 
" + Iterables.toString(customizers));
+assertTrue(customizers.contains(testCustomizer), "expected to find 
testCustomizer in " + Iterables.toString(customizers));
+}
+
+@SuppressWarnings("unchecked")
+@Test
+public void testCustomizersMerged() {
+TestEntity entity = 
app.createAndManageChild(EntitySpec.create(TestEntity.class)
+.addInitializer(testCustomizer)
+.configure(
+
BrooklynConfigKeys.PROVISIONING_PROPERTIES.subKey(JcloudsLocationConfig.JCLOUDS_LOCATION_CUSTOMIZERS.getName()),
+ImmutableList.of(new 
BasicJcloudsLocationCustomizer(;
+Object object = 
entity.config().get(BrooklynConfigKeys.PROVISIONING_PROPERTIES.subKey(
+
JcloudsLocationConfig.JCLOUDS_LOCATION_CUSTOMIZERS.getName()));
+assertNotNull(object, "expected value for customizers in " + 
entity.config().get(BrooklynConfigKeys.PROVISIONING_PROPERTIES));
+assertTrue(object instanceof Collection, "expected collection, got 
" + object.getClass());
+Collection customizers = 
(Collection) object;
+assertEquals(customizers.size(), 2, "expected two customizers in " 
+ Iterables.toString(customizers));
+assertTrue(customizers.contains(testCustomizer), "expected to find 
testCustomizer in " + Iterables.toString(customizers));
+}
+
--- End diff --

How can you add initialisers to already managed entities? Either I'm 
missing something obvious or it's not possible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not h

[GitHub] brooklyn-server issue #429: BasicJcloudsLocationCustomizer is an EntityIniti...

2016-11-16 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/429
  
@neykov thanks for your comments. I've removed `params` and added a test 
that confirms that the initialiser is applied to cluster members. Can you 
clarify what you meant when you said that it would be useful to test 
`addInitializer`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #436: Set default JVM memory settings for the build

2016-11-16 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/436
  
Looks good. Will merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #424: BROOKLYN-383: fix json serialisation of tasks

2016-11-16 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/424
  
Looks good to me, happy to merge as-is.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #443: Adds maxConcurrentChildCommands paramter ...

2016-11-18 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-server/pull/443

Adds maxConcurrentChildCommands paramter to DynamicCluster



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-server throttle-task

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/443.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #443


commit 5b9f89653ee5979665bff445d38750e1d0f234ae
Author: Sam Corbett 
Date:   2016-11-16T15:36:45Z

Readability

commit e5a0fe5ee6b71ca6e250b8c64bac48adf4813372
Author: Sam Corbett 
Date:   2016-11-18T15:31:07Z

Adds maxConcurrentChildCommands paramter to DynamicCluster

The option configures the maximum number of simultaneous Startable
effector invocations that will be made on members of the group.

commit faeffbe18dfec7fde0d18c818592c46b0a333d7e
Author: Sam Corbett 
Date:   2016-11-18T15:31:31Z

BROOKLYN-396: Add failing test to demonstrate problem




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #444: BROOKLYN-396: test and fix

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/444
  
@aledsage the fix looks good. The blueprint I gave in 396 resizes correctly 
after rebind. 

In the comments on the issue you wrote that "I presume the solution will be 
to improve what we store in the `origConfigs` (e.g. so that the sub-machines 
don't inherit it)." Is `origConfigs` doing the right thing? Or have we 
side-stepped it?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #443: Adds maxConcurrentChildCommands paramter ...

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/443#discussion_r88712272
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/entity/group/DynamicCluster.java ---
@@ -183,6 +183,14 @@
 ConfigKey CLUSTER_MEMBER_ID = ConfigKeys.newIntegerConfigKey(
 "cluster.member.id", "The unique ID number (sequential) of a 
member of a cluster");
 
+@SetFromFlag("maxConcurrentChildCommands")
+ConfigKey MAX_CONCURRENT_CHILD_COMMANDS = 
ConfigKeys.builder(Integer.class)
+.name("cluster.maxConcurrentChildCommands")
--- End diff --

Agree. However, it's consistent with the other config and sensors in the 
class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #443: Adds maxConcurrentChildCommands paramter ...

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/443#discussion_r88712700
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterRebindTest.java
 ---
@@ -0,0 +1,54 @@
+/*
+ * 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.entity.group;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.core.entity.Attributes;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
+import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
+import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+public class DynamicClusterRebindTest extends RebindTestFixtureWithApp {
+
+@Test
+public void testThrottleAppliesAfterRebind() throws Exception {
+DynamicCluster cluster = 
origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
--- End diff --

Probably. I'll add it in.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #443: Adds maxConcurrentChildCommands paramter ...

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/443#discussion_r88720447
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterRebindTest.java
 ---
@@ -0,0 +1,54 @@
+/*
+ * 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.entity.group;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.core.entity.Attributes;
+import org.apache.brooklyn.core.entity.Entities;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.entity.lifecycle.Lifecycle;
+import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
+import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+public class DynamicClusterRebindTest extends RebindTestFixtureWithApp {
+
+@Test
+public void testThrottleAppliesAfterRebind() throws Exception {
+DynamicCluster cluster = 
origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
--- End diff --

I added this to `DynamicClusterTest`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #443: Adds maxConcurrentChildCommands parameter to Dyn...

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/443
  
Build failure external:
```
[WARNING] Failed to notify spy hudson.maven.Maven3Builder$JenkinsEventSpy: 
Invalid object ID 9 iota=46
[WARNING] Failed to notify spy hudson.maven.Maven3Builder$JenkinsEventSpy: 
Invalid object ID 9 iota=46
[WARNING] Failed to notify spy hudson.maven.Maven3Builder$JenkinsEventSpy: 
Invalid object ID 25 iota=46
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #443: Adds maxConcurrentChildCommands parameter to Dyn...

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/443
  
Actually I wonder if that's true. The build timed out testing 
DynamicCluster. I'll double-check locally.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #443: Adds maxConcurrentChildCommands parameter to Dyn...

2016-11-18 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/443
  
Jenkins did its job. I had forgotten to `submit` a task so 
`stopAndRemoveNode` blocked forever.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #443: Adds maxConcurrentChildCommands parameter to Dyn...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/443
  
@geomacy I agree in principle but think it's outwith this pull request. 
Completing a resize before beginning another is currently part of 
`DynamicCluster's` contract. Your comment about stopping two-at-a-time is 
interesting and I'll look into it more. My preference is to merge this pull 
request now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #467: Update LICENSE with changes in project dependenc...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/467
  
Looks good.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #458: BROOKLYN-399: aws-ec2 only looks up images in sp...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/458
  
Looks good. Will check the live tests and merge.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #464: Avoid uncaught exceptions in testOnDoneCa...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/464#discussion_r89765709
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java
 ---
@@ -68,6 +68,7 @@
 import com.google.common.util.concurrent.Callables;
 
 /** Includes many tests for {@link BrooklynGarbageCollector} */
+@Test
--- End diff --

All the tests are annotated - does this have any effect?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #464: Avoid uncaught exceptions in testOnDoneCa...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/464#discussion_r89767445
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java
 ---
@@ -82,18 +83,33 @@ public void testOnDoneCallback() throws 
InterruptedException {
 @Override
 public void onTaskDone(Task task) {
 Assert.assertTrue(task.isDone());
-Assert.assertEquals(task.getUnchecked(), "foo");
-completedTasks.put(task, 
Duration.sinceUtc(task.getEndTimeUtc()));
-sema4.release();
+Object result = task.getUnchecked();
+if(result != null && result.equals("foo")) {
--- End diff --

Nitpick: add a space between the `if` and the bracket.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #464: Avoid uncaught exceptions in testOnDoneCallback

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/464
  
Looks good. Couple of minor comments but happy for this to be merged with 
or without the changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #443: Adds maxConcurrentChildCommands parameter...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/443#discussion_r89785111
  
--- Diff: 
core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java ---
@@ -1225,4 +1235,93 @@ private void 
assertFirstAndNonFirstCounts(Collection members, int expect
 assertEquals(found.size(), expectedNonFirstCount);
 }
 
+@DataProvider
+public Object[][] maxConcurrentCommandsTestProvider() {
+return new Object[][]{{1}, {2}, {3}};
+}
+
+@Test(dataProvider = "maxConcurrentCommandsTestProvider")
+public void 
testEntitiesStartAndStopSequentiallyWhenMaxConcurrentCommandsIsOne(int 
maxConcurrentCommands) {
--- End diff --

It always fails for me when I remove 
`.configure(DynamicCluster.MAX_CONCURRENT_CHILD_COMMANDS, 
maxConcurrentCommands)` from a few lines below.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #443: Adds maxConcurrentChildCommands parameter...

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/443#discussion_r89813930
  
--- Diff: 
core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java ---
@@ -1040,14 +1077,81 @@ protected void discardNode(Entity entity) {
 
 protected void stopAndRemoveNode(Entity member) {
 removeMember(member);
-
 try {
 if (member instanceof Startable) {
-Task task = member.invoke(Startable.STOP, 
Collections.emptyMap());
+Task task = newThrottledEffectorTask(member, 
Startable.STOP, Collections.emptyMap());
+DynamicTasks.queueIfPossible(task).orSubmitAsync();
 task.getUnchecked();
 }
 } finally {
 Entities.unmanage(member);
 }
 }
+
+protected  Task newThrottledEffectorTask(Entity target, 
Effector effector, Map arguments) {
+return newThrottledEffectorTask(target, effector, arguments, 
false);
+}
+
+protected  Task newThrottledEffectorTask(Entity target, 
Effector effector, Map arguments, boolean isPrivileged) {
+final Semaphore permit = childTaskSemaphore;
+final Task toSubmit;
+final Task effectorTask = Effectors.invocation(target, 
effector, arguments).asTask();
+if (permit != null) {
+// Acquire the permit now for the privileged task and just 
queue the effector invocation.
+// If it's unprivileged then queue a task to obtain a permit 
first.
+final String description = "Waiting for permit to run " + 
effector.getName() + " on " + target;
+final Runnable obtain = new ObtainPermit(permit, description);
+if (isPrivileged) {
+obtain.run();
+toSubmit = effectorTask;
+} else {
+// acquire semaphore here if privileged?
+Task obtainMutex = Tasks.builder()
+.description(description)
+.body(new ObtainPermit(permit, description))
+.build();
+toSubmit = Tasks.sequential(obtainMutex, effectorTask);
+}
+toSubmit.addListener(new ReleasePermit(permit), 
MoreExecutors.sameThreadExecutor());
--- End diff --

Do you think it's better to queue the release as another task?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library pull request #79: Publish ZooKeeperNode host+port at ZOOKEE...

2016-11-28 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-library/pull/79

Publish ZooKeeperNode host+port at ZOOKEEPER_ENDPOINT

Fixes `ZooKeeperEnsemble.ZOOKEEPER_ENDPOINTS` and by extension 
`ZooKeeperEnsembleLiveTest` after the changes in 
https://github.com/apache/brooklyn-library/pull/78.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-library fix-zookeeper

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-library/pull/79.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #79


commit 76d2ec59388adde3230038c588578bfc6f7a
Author: Sam Corbett 
Date:   2016-11-28T18:00:10Z

Publish ZooKeeperNode host+port at ZOOKEEPER_ENDPOINT

Fixes ZooKeeperEnsemble.ZOOKEEPER_ENDPOINTS and by extension
ZooKeeperEnsembleLiveTest after the changes in
https://github.com/apache/brooklyn-library/pull/78.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-library issue #78: Zookeeper node main URI must contain a protocol

2016-11-28 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-library/pull/78
  
https://github.com/apache/brooklyn-library/pull/79 is a follow up to this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #443: Adds maxConcurrentChildCommands parameter to Dyn...

2016-11-29 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/443
  
@aledsage regarding the obtain and release of permits, I've pushed an 
update and test case that checks how permits are handled when tasks are 
cancelled. See 
https://github.com/apache/brooklyn-server/pull/443/files#diff-a0b8d0880424918e737424abac6a9694R1123
 for the implementation and 
https://github.com/apache/brooklyn-server/pull/443/files#diff-f27a4972ae513473372a4703cb4526caR1301
 for the test. Could you re-review this? Thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #471: add location details as sensors

2016-12-01 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/471
  
Another interim option would be to write an enricher that does the 
publication so its inclusion is up to the user.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #128: 0.10.0 release notes

2016-12-01 Thread sjcorbett
GitHub user sjcorbett opened a pull request:

https://github.com/apache/brooklyn-docs/pull/128

0.10.0 release notes

Phew!

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sjcorbett/brooklyn-docs release-notes

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-docs/pull/128.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #128


commit 824f1958a8723a719203036170b0d5513694e957
Author: Sam Corbett 
Date:   2016-12-01T11:32:27Z

0.10.0 release notes




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs issue #128: 0.10.0 release notes

2016-12-01 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-docs/pull/128
  
P.S. I put together a really quick script for retrieving the PRs that were 
merged into brooklyn-server that may be useful the next time someone wants to 
write release notes: 
https://gist.github.com/sjcorbett/72ed944b06ce3a138fbe516e8d36f624. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #128: 0.10.0 release notes

2016-12-01 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/128#discussion_r90431884
  
--- Diff: guide/misc/release-notes.md ---
@@ -14,15 +14,121 @@ to Brooklyn's commercial users for funding much of 
this development.
 
 ### New Features
 
+ Improved Blueprints
+
+Significant work has gone into making YAML blueprints more powerful.
+The DSL is more expressive and a variety of new general-purpose entities,
+enrichers and policies have been written.
+
+New general-purpose constructs:
+
+* The `InvokeEffectorOnSensorChange` and 
`InvokeEffectorOnCollectionSensorChange`
+  policies execute effectors on entities whenever a target sensor changes.
+* `ProxyEffector` forwards effector invocations from one entity to another.
+* `ConditionalEntity` creates an entity based on the truth of a config key
+  (e.g. `$brooklyn:scopeRoot().config("enable.loadBalancer")`).
+* `OnPublicNetworkEnricher` grants finer control of mapping public
+  and private network addresses to sensors.
+* `PercentageEnricher` publishes the ratio of two sensors.
+
+New blueprint DSL features:
+
+* `$brooklyn:entity` supports nested function calls,
+* `$brookln:getImmediately` resolves values immediately and throws if it 
cannot,
+* `$brooklyn:object` supports parameterised constructors and static 
factory methods, hugely increasing the range of objects that can be injected 
into entities,
+* `$brooklyn:entityId` returns the target entity's ID, and
+* `$brooklyn:self` accesses the resolving task's context entity.
+
+
+ Bundled entities
+
+There have been many updates to the entities bundled with Brooklyn. In 
particular:
+
+* `DynamicCluster` allows configuration of member removal strategies.
+* The `Transformer` enricher can be triggered by events on multiple 
sensors.
+* `ZooKeeperNode` publishes main.uri and `ZooKeeperEnsemble` aggregates
+  hosts and ports into comma-separated list under `zookeeper.endpoints`.
+* `BindDnsServer` listens on all interfaces and supports Centos and RHEL.
+* `NginxController` supports proxying with TLS client certificates.
+* `RiakNode` optionally configures security groups for intra-node 
communication
+  when supported by the target cloud.
+* `PostgreSqlNode` can be configured to grant [user 
roles](https://www.postgresql.org/docs/9.3/static/role-membership.html).
+* `SharedLocationSecurityGroupCustomizer` enables security group 
+  configuration in yaml blueprints.
+* Feeds no longer poll if their entity is unmanaged.
+
+Several new test-case entities are introduced:
+
+* `TestHttpCall` 
[supports](https://github.com/apache/brooklyn-server/pull/414) a greatly 
expanded range of options.
+* `TestEndpointReachable` tests that a TCP endpoint can be reached.
+* `TestWinrmCommand` tests the success of commands in Windows instances.
+* `RelativeEntityTestCase` lets you write test cases that resolve their 
target from another entity.
+
+Additionally, location customisers can now be attached to entities as
+initialisers, rather than having to dig into their `templateOptions`.
+
+
+ Brooklyn server
+
+* The REST API requires CSRF headers for non-GET and HEAD requests when
+  sessions are in effect.
+  See 
[CsrfTokenFilter](https://brooklyn.apache.org/v/0.10.0/misc/javadoc/org/apache/brooklyn/rest/filter/CsrfTokenFilter.html)
+  for details.
+
+* The catalogue scanner can be configured with whitelists and blacklists
+  of bundle IDs to control which bundles may present applications in the 
catalogue.
+
+* The Karaf distribution includes equivalents of the
+  [cloud explorer 
commands](https://brooklyn.apache.org/v/0.10.0/ops/server-cli-reference.html#cloud-explorer).
--- End diff --

I'm assuming this URL will exist too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #443: Adds maxConcurrentChildCommands parameter to Dyn...

2016-12-01 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/443
  
I'm going to merge this now. Happy to address any further comments 
separately.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #130: Update release notes for release 0.10.0

2016-12-05 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/130#discussion_r90869319
  
--- Diff: website/developers/committers/release-process/index.md ---
@@ -14,14 +14,15 @@ children:
 - { path: publish.md }
 - { path: announce.md }
 ---
-1. [Prerequisites](prerequisites.html) - steps that a new release manager 
must do (but which only need to be done once)
-2. [Set environment variables](environment-variables.html) - many example 
snippets here use environment variables to
+1. [Preparing for a release](prepar-for-release.html) - How to prepare the 
project for a release
--- End diff --

Typo? `prepar-for-release.html`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs issue #128: 0.10.0 release notes

2016-12-05 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-docs/pull/128
  
@neykov thanks for checking. I've removed the reference to `getImmediately`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #128: 0.10.0 release notes

2016-12-05 Thread sjcorbett
Github user sjcorbett commented on a diff in the pull request:

https://github.com/apache/brooklyn-docs/pull/128#discussion_r90912906
  
--- Diff: guide/misc/release-notes.md ---
@@ -14,15 +14,121 @@ to Brooklyn's commercial users for funding much of 
this development.
 
 ### New Features
 
+ Improved Blueprints
+
+Significant work has gone into making YAML blueprints more powerful.
+The DSL is more expressive and a variety of new general-purpose entities,
+enrichers and policies have been written.
+
+New general-purpose constructs:
+
+* The `InvokeEffectorOnSensorChange` and 
`InvokeEffectorOnCollectionSensorChange`
+  policies execute effectors on entities whenever a target sensor changes.
+* `ProxyEffector` forwards effector invocations from one entity to another.
+* `ConditionalEntity` creates an entity based on the truth of a config key
+  (e.g. `$brooklyn:scopeRoot().config("enable.loadBalancer")`).
+* `OnPublicNetworkEnricher` grants finer control of mapping public
+  and private network addresses to sensors.
+* `PercentageEnricher` publishes the ratio of two sensors.
+
+New blueprint DSL features:
+
+* `$brooklyn:entity` supports nested function calls,
+* `$brookln:getImmediately` resolves values immediately and throws if it 
cannot,
+* `$brooklyn:object` supports parameterised constructors and static 
factory methods, hugely increasing the range of objects that can be injected 
into entities,
+* `$brooklyn:entityId` returns the target entity's ID, and
+* `$brooklyn:self` accesses the resolving task's context entity.
+
+
+ Bundled entities
+
+There have been many updates to the entities bundled with Brooklyn. In 
particular:
+
+* `DynamicCluster` allows configuration of member removal strategies.
+* The `Transformer` enricher can be triggered by events on multiple 
sensors.
+* `ZooKeeperNode` publishes main.uri and `ZooKeeperEnsemble` aggregates
+  hosts and ports into comma-separated list under `zookeeper.endpoints`.
+* `BindDnsServer` listens on all interfaces and supports Centos and RHEL.
+* `NginxController` supports proxying with TLS client certificates.
+* `RiakNode` optionally configures security groups for intra-node 
communication
+  when supported by the target cloud.
+* `PostgreSqlNode` can be configured to grant [user 
roles](https://www.postgresql.org/docs/9.3/static/role-membership.html).
+* `SharedLocationSecurityGroupCustomizer` enables security group 
+  configuration in yaml blueprints.
+* Feeds no longer poll if their entity is unmanaged.
+
+Several new test-case entities are introduced:
+
+* `TestHttpCall` 
[supports](https://github.com/apache/brooklyn-server/pull/414) a greatly 
expanded range of options.
+* `TestEndpointReachable` tests that a TCP endpoint can be reached.
+* `TestWinrmCommand` tests the success of commands in Windows instances.
+* `RelativeEntityTestCase` lets you write test cases that resolve their 
target from another entity.
+
+Additionally, location customisers can now be attached to entities as
+initialisers, rather than having to dig into their `templateOptions`.
+
+
+ Brooklyn server
+
+* The REST API requires CSRF headers for non-GET and HEAD requests when
+  sessions are in effect.
+  See 
[CsrfTokenFilter](https://brooklyn.apache.org/v/0.10.0/misc/javadoc/org/apache/brooklyn/rest/filter/CsrfTokenFilter.html)
+  for details.
+
+* The catalogue scanner can be configured with whitelists and blacklists
+  of bundle IDs to control which bundles may present applications in the 
catalogue.
+
+* The Karaf distribution includes equivalents of the
+  [cloud explorer 
commands](https://brooklyn.apache.org/v/0.10.0/ops/server-cli-reference.html#cloud-explorer).
--- End diff --

Got you.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-docs pull request #128: 0.10.0 release notes

2016-12-06 Thread sjcorbett
Github user sjcorbett closed the pull request at:

https://github.com/apache/brooklyn-docs/pull/128


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server issue #479: Upgrade karaf-maven-plugin to avoid double User-...

2016-12-09 Thread sjcorbett
Github user sjcorbett commented on the issue:

https://github.com/apache/brooklyn-server/pull/479
  
Looks good. Will merge this and the library/dist PRs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


  1   2   3   4   >