[2/2] brooklyn-docs git commit: This closes #236
This closes #236 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/6c4d98ed Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/6c4d98ed Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/6c4d98ed Branch: refs/heads/master Commit: 6c4d98ed1797e2ad7eb3d13b56cee3f119096190 Parents: 62cf36a c3001b5 Author: Aled SageAuthored: Tue Nov 14 12:34:04 2017 + Committer: Aled Sage Committed: Tue Nov 14 12:34:04 2017 + -- guide/blueprints/entity-configuration.md | 8 1 file changed, 4 insertions(+), 4 deletions(-) --
[1/2] brooklyn-docs git commit: Refer to inheritance.runtime instead of deprecated inheritance.runtime
Repository: brooklyn-docs Updated Branches: refs/heads/master 62cf36a7d -> 6c4d98ed1 Refer to inheritance.runtime instead of deprecated inheritance.runtime Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/c3001b5a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/c3001b5a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/c3001b5a Branch: refs/heads/master Commit: c3001b5a1f025d74da4a175490870afc7de87aa0 Parents: 40c59c6 Author: Valentin AitkenAuthored: Tue Nov 14 10:09:39 2017 +0200 Committer: Valentin Aitken Committed: Tue Nov 14 10:09:39 2017 +0200 -- guide/blueprints/entity-configuration.md | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/c3001b5a/guide/blueprints/entity-configuration.md -- diff --git a/guide/blueprints/entity-configuration.md b/guide/blueprints/entity-configuration.md index c2d5794..9b5dd2a 100644 --- a/guide/blueprints/entity-configuration.md +++ b/guide/blueprints/entity-configuration.md @@ -456,7 +456,7 @@ documented below will be enhanced in a future version of Brooklyn, to better sup above._ In a YAML blueprint, within the `brooklyn.parameters` section for declaring new config keys, one can -set the mode for `inheritance.type` and `inheritance.parent` (i.e. for inheritance from the super-type, and +set the mode for `inheritance.type` and `inheritance.runtime` (i.e. for inheritance from the super-type, and inheritance in the runtime management hierarchy). The possible values are: * `deep_merge`: the inherited and the given value should be merged; maps within the map will also be merged @@ -480,7 +480,7 @@ brooklyn.catalog: - name: example.map type: java.util.Map inheritance.type: deep_merge -inheritance.parent: none +inheritance.runtime: none default: MESSAGE_IN_DEFAULT: InDefault brooklyn.config: @@ -492,7 +492,7 @@ The blueprints below demonstrate the various permutations for setting configurat config `example.map`. This can be inspected by looking at the entity's config. The config we see for app1 is the inherited `{MESSAGE: "Hello"}`; in app2 we define additional configuration, which will be merged to give `{MESSAGE: "Hello", MESSAGE_IN_CHILD: "InChild"}`; in app3, the -config from the parent is not inherited because there is an explicit inheritance.parent of "none", +config from the parent is not inherited because there is an explicit inheritance.runtime of "none", so it just has the value `{MESSAGE: "Hello"}`; in app4 again the parent's config is ignored, with the super-type and entity's config being merged to give `{MESSAGE: "Hello", MESSAGE_IN_CHILD: "InChild"}`. @@ -532,7 +532,7 @@ services: MESSAGE_IN_CHILD: InChild ``` -A limitations of `inheritance.parent` is when inheriting values from parent and grandparent +A limitations of `inheritance.runtime` is when inheriting values from parent and grandparent entities: a value specified on the parent will override (rather than be merged with) the value on the grandparent.
[4/4] brooklyn-server git commit: This closes #895
This closes #895 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/410ec8c2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/410ec8c2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/410ec8c2 Branch: refs/heads/master Commit: 410ec8c2cb0750cd16fc9a7187ce30fa9da573ac Parents: ce453ca f57e28e Author: Aled SageAuthored: Tue Nov 14 10:45:24 2017 + Committer: Aled Sage Committed: Tue Nov 14 10:45:24 2017 + -- .../src/main/resources/OSGI-INF/blueprint/service.xml| 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) --
[2/4] brooklyn-server git commit: Add more missing REST endpoints
Add more missing REST endpoints Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9efbc4d8 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9efbc4d8 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9efbc4d8 Branch: refs/heads/master Commit: 9efbc4d8e36162d47f66c36769c00c44b2524c93 Parents: c772063 Author: Thomas BouronAuthored: Tue Nov 14 10:41:03 2017 + Committer: Thomas Bouron Committed: Tue Nov 14 10:41:03 2017 + -- .../src/main/resources/OSGI-INF/blueprint/service.xml | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9efbc4d8/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml -- diff --git a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml index d03ac87..db27015 100644 --- a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml +++ b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml @@ -74,19 +74,20 @@ limitations under the License. - + + + - @@ -95,19 +96,20 @@ limitations under the License. - + + + -
[3/4] brooklyn-server git commit: Update bean name for bundles resources
Update bean name for bundles resources Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f57e28ea Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f57e28ea Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f57e28ea Branch: refs/heads/master Commit: f57e28ea3789986b43d10437a539bb3b2eb1ffda Parents: 9efbc4d Author: Thomas BouronAuthored: Tue Nov 14 10:44:39 2017 + Committer: Thomas Bouron Committed: Tue Nov 14 10:44:39 2017 + -- .../src/main/resources/OSGI-INF/blueprint/service.xml| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f57e28ea/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml -- diff --git a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml index db27015..9d7e5e7 100644 --- a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml +++ b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml @@ -74,7 +74,7 @@ limitations under the License. - + @@ -96,7 +96,7 @@ limitations under the License. - +
[1/4] brooklyn-server git commit: Add missing /v1/catalog/bundles REST endpoint for karaf distribution
Repository: brooklyn-server Updated Branches: refs/heads/master ce453ca1d -> 410ec8c2c Add missing /v1/catalog/bundles REST endpoint for karaf distribution Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c772063d Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c772063d Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c772063d Branch: refs/heads/master Commit: c772063d596f5aa2d5496ce19614b4d9f5cad64f Parents: c68cbaf Author: Thomas BouronAuthored: Tue Nov 14 10:34:59 2017 + Committer: Thomas Bouron Committed: Tue Nov 14 10:34:59 2017 + -- .../src/main/resources/OSGI-INF/blueprint/service.xml | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c772063d/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml -- diff --git a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml index af55572..d03ac87 100644 --- a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml +++ b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml @@ -75,6 +75,7 @@ limitations under the License. + @@ -95,6 +96,7 @@ limitations under the License. +
[1/2] brooklyn-docs git commit: release notes updated with recent code changes
Repository: brooklyn-docs Updated Branches: refs/heads/master 40c59c6c1 -> 23b26ca65 release notes updated with recent code changes Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/f97f34df Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/f97f34df Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/f97f34df Branch: refs/heads/master Commit: f97f34dfbc53f55a75304a425bcc467fd4229f02 Parents: ba27cf1 Author: Alex HeneveldAuthored: Thu Nov 2 10:22:36 2017 + Committer: Alex Heneveld Committed: Thu Nov 2 11:04:50 2017 + -- guide/misc/release-notes.md | 25 + package-lock.json | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/f97f34df/guide/misc/release-notes.md -- diff --git a/guide/misc/release-notes.md b/guide/misc/release-notes.md index 7dd5009..afa6355 100644 --- a/guide/misc/release-notes.md +++ b/guide/misc/release-notes.md @@ -18,5 +18,30 @@ to Brooklyn's commercial users for funding much of this development. Changes since {{ book.brooklyn_version_stable }}: +1. BOM files that do not declare a version now give the version of the bundle to their entities, + rather than the default `0.0.0-SNAPSHOT` version. + When loading types, the version can now be specified as any Brooklyn-valid version string + equivalent to the OSGi version (e.g. `1-SNAPSHOT` or `1.0.0.SNAPSHOT`). + +1. Some catalog methods may return the same type multiple times, if contained in multiple bundles. + Previously only one of the bundle's definition of the type was returned. + Except for anonymous bundles it is no longer allowed to have give items with the same name and version. + (This is required to prevent Brooklyn from getting in to a state where it cannot rebind.) + +1. Value resolution is now supported for config default values. Previously these would be coerced but + not resolved beyond that -- i.e. TaskFactory values would not have tasks evaluated, and Map and + Collection values would not be deeply resolved with their internals coerced or evaluated. + This makes the semantics of default values consistent with explicit config values. + +1. Deep config resolution of nested items has changed to be consistent with when deep config applies. + Deep config applies to maps and collections, but previously any Iterable contained therein + would have a recursive deep config evaluation. Now this is limited to nested Collection types + (Lists, Sets, etc) and Maps; nested Iterable instances that are not also Collections are + no longer traversed and resolved recursively. This makes their nested resolution consistent + with when such instances are non-nested config value, as deep resolution was not applied there. + This mainly affects PortRange, where previously if set directly on a config key it would return + the PortRange value but if accessed in a map such as `shell.env` any non-default value would + be expanded as a list `[1, 2]` (but default values would not be expanded, as per previous point, + but now they are). For changes in prior versions, please refer to the release notes for those versions by selecting the one you are interested in on the left menu. http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/f97f34df/package-lock.json -- diff --git a/package-lock.json b/package-lock.json index c6663e0..7823ee4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "brooklyn-docs", - "version": "0.13.0", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": {
[2/2] brooklyn-docs git commit: This closes #227
This closes #227 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/23b26ca6 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/23b26ca6 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/23b26ca6 Branch: refs/heads/master Commit: 23b26ca653c4be205bb6f5ddb344b198c0fc0eac Parents: 40c59c6 f97f34d Author: Aled SageAuthored: Tue Nov 14 08:54:29 2017 + Committer: Aled Sage Committed: Tue Nov 14 08:54:29 2017 + -- guide/misc/release-notes.md | 25 + package-lock.json | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) --
[3/4] brooklyn-server git commit: add to REST API ability to include specific sensors when fetching
add to REST API ability to include specific sensors when fetching Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ba1c37c5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ba1c37c5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ba1c37c5 Branch: refs/heads/master Commit: ba1c37c54e980647e2a6029e84e279986c1eab04 Parents: ff1ed3c Author: Alex HeneveldAuthored: Thu Nov 9 18:45:42 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 18:53:23 2017 + -- .../brooklyn/rest/api/ApplicationApi.java | 15 --- .../org/apache/brooklyn/rest/api/EntityApi.java | 6 +-- .../brooklyn/rest/domain/EntitySummary.java | 24 ++- .../rest/resources/ApplicationResource.java | 45 +++- .../rest/resources/ApplicationResourceTest.java | 41 +- 5 files changed, 92 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ba1c37c5/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java -- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java index 2e66fa4..3dab15e 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/ApplicationApi.java @@ -56,16 +56,21 @@ public interface ApplicationApi { @GET @Path("/fetch") @ApiOperation( -value = "Fetch display details for all applications and optionally selected additional entities" +value = "Fetch details for all applications and optionally selected additional entity items, " ++ "optionally also with the values for selected sensors" ) public List fetch( -@ApiParam(value="Selected additional entity ID's to include, comma-separated", required=false) +@ApiParam(value="Any additional entity ID's to include, as JSON or comma-separated list", required=false) @DefaultValue("") -@QueryParam("items") String items); +@QueryParam("items") String items, +@ApiParam(value="Any additional sensors to include, as JSON or comma-separated list; " ++ "current sensor values if present are returned for each entity in a name-value map under the 'sensors' key", required=false) +@DefaultValue("") +@QueryParam("sensors") String sensors); @GET @ApiOperation( -value = "Fetch list of applications, as ApplicationSummary objects", +value = "Fetch the list of applications managed here", response = org.apache.brooklyn.rest.domain.ApplicationSummary.class ) public List list( @@ -82,7 +87,7 @@ public interface ApplicationApi { @GET @Path("/{application}") @ApiOperation( -value = "Fetch a specific application", +value = "Fetch details of an application", response = org.apache.brooklyn.rest.domain.ApplicationSummary.class ) @ApiResponses(value = { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ba1c37c5/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java -- diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java index d475b52..9455575 100644 --- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java +++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/EntityApi.java @@ -42,7 +42,7 @@ import java.util.Map; public interface EntityApi { @GET -@ApiOperation(value = "Fetch the list of entities for a given application", +@ApiOperation(value = "Fetch the list of children entities directly under the root of an application", response = org.apache.brooklyn.rest.domain.EntitySummary.class, responseContainer = "List") @ApiResponses(value = { @@ -54,7 +54,7 @@ public interface EntityApi { @GET @Path("/{entity}") -@ApiOperation(value = "Fetch details about a specific application entity", +@ApiOperation(value = "Fetch details of an entity", response = org.apache.brooklyn.rest.domain.EntitySummary.class) @ApiResponses(value = { @ApiResponse(code = 404, message = "Application or entity missing") @@ -67,7 +67,7 @@ public interface EntityApi { // TODO rename as "/children" ?
[2/4] brooklyn-server git commit: mark the batch config read as transient
mark the batch config read as transient otherwise it wipes out other things from activity history Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ff1ed3cd Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ff1ed3cd Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ff1ed3cd Branch: refs/heads/master Commit: ff1ed3cd66be2168f8386da163fb287b131bf54e Parents: 4f607ec Author: Alex HeneveldAuthored: Thu Nov 9 18:51:17 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 18:53:14 2017 + -- .../apache/brooklyn/rest/resources/EntityConfigResource.java | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ff1ed3cd/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java -- diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java index 3431b99..a3698b9 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/EntityConfigResource.java @@ -29,6 +29,8 @@ import org.apache.brooklyn.core.config.BasicConfigKey; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.internal.EntityConfigMap; +import org.apache.brooklyn.core.mgmt.BrooklynTags; +import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntityAndItem; import org.apache.brooklyn.rest.api.EntityConfigApi; @@ -88,7 +90,9 @@ public class EntityConfigResource extends AbstractBrooklynRestResource implement } // wrap in a task for better runtime view -return Entities.submit(entity, Tasks.
[1/4] brooklyn-server git commit: Merge branch 'enhancements' into r2
Repository: brooklyn-server Updated Branches: refs/heads/master b7ad01e96 -> c68cbaffe Merge branch 'enhancements' into r2 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/4f607ece Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/4f607ece Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/4f607ece Branch: refs/heads/master Commit: 4f607ecee1cdb00e112244375be3fdd60fb79400 Parents: 34016b6 6fa3b7a Author: Alex HeneveldAuthored: Thu Nov 9 18:52:58 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 18:52:58 2017 + -- .../brooklyn/api/mgmt/ManagementContext.java| 13 +++-- .../brooklyn/core/entity/EntityAsserts.java | 4 +- .../internal/AbstractManagementContext.java | 50 +++- .../NonDeploymentManagementContext.java | 13 + .../brooklyn/util/core/task/BasicTask.java | 9 ++-- .../apache/brooklyn/util/core/task/Tasks.java | 5 +- .../brooklyn/enricher/stock/EnrichersTest.java | 11 + 7 files changed, 94 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4f607ece/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java --
[4/4] brooklyn-server git commit: This closes #890
This closes #890 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c68cbaff Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c68cbaff Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c68cbaff Branch: refs/heads/master Commit: c68cbaffee6e5f8bac0441d634e1cf2a31e8ee81 Parents: b7ad01e ba1c37c Author: Aled SageAuthored: Fri Nov 10 10:59:40 2017 + Committer: Aled Sage Committed: Fri Nov 10 10:59:40 2017 + -- .../brooklyn/rest/api/ApplicationApi.java | 15 --- .../org/apache/brooklyn/rest/api/EntityApi.java | 6 +-- .../brooklyn/rest/domain/EntitySummary.java | 24 ++- .../rest/resources/ApplicationResource.java | 45 +++- .../rest/resources/EntityConfigResource.java| 6 ++- .../rest/resources/ApplicationResourceTest.java | 41 +- 6 files changed, 97 insertions(+), 40 deletions(-) --
[11/11] brooklyn-server git commit: This closes #879
This closes #879 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b7ad01e9 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b7ad01e9 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b7ad01e9 Branch: refs/heads/master Commit: b7ad01e961e3d72f98073891f71bad157cbad905 Parents: 73ec34d 32c1771 Author: Aled SageAuthored: Fri Nov 10 10:58:49 2017 + Committer: Aled Sage Committed: Fri Nov 10 10:58:49 2017 + -- .../org/apache/brooklyn/api/entity/Entity.java | 2 +- .../brooklyn/api/mgmt/ManagementContext.java| 3 + camp/camp-brooklyn/pom.xml | 7 + .../camp/brooklyn/AbstractYamlRebindTest.java | 10 +- .../camp/brooklyn/AbstractYamlTest.java | 12 +- .../test/policy/failover/ElectPrimaryTest.java | 427 + .../internal/AbstractManagementContext.java | 1 + .../mgmt/internal/LocalSubscriptionManager.java | 2 + .../core/mgmt/rebind/RebindIteration.java | 2 + .../policy/failover/ElectPrimaryConfig.java | 85 .../policy/failover/ElectPrimaryEffector.java | 479 +++ .../policy/failover/ElectPrimaryPolicy.java | 280 +++ .../policy/failover/PrimaryRunningEnricher.java | 75 +++ .../failover/PropagatePrimaryEnricher.java | 134 ++ .../policy/failover/ElectPrimaryTest.java | 26 + .../failover/elect-primary-propagate-test.yaml | 37 ++ .../elect-primary-selection-mode-test.yaml | 33 ++ .../failover/elect-primary-simple-test.yaml | 28 ++ 18 files changed, 1634 insertions(+), 9 deletions(-) --
[08/11] brooklyn-server git commit: Merge branch 'config-on-entity-dynamic-goes-on-type-after-persistence' into e2
Merge branch 'config-on-entity-dynamic-goes-on-type-after-persistence' into e2 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b0dd4cee Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b0dd4cee Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b0dd4cee Branch: refs/heads/master Commit: b0dd4cee7175c147fbcfb0002ccda81f4f2793b4 Parents: bd9f69c 0f53865 Author: Alex HeneveldAuthored: Thu Nov 9 15:25:05 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 15:25:05 2017 + -- .../core/mgmt/rebind/dto/BasicEntityMemento.java| 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) --
[03/11] brooklyn-server git commit: move to `failover` package instead of `ha` and mark beta
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0191d90e/policy/src/main/java/org/apache/brooklyn/policy/failover/PropagatePrimaryEnricher.java -- diff --git a/policy/src/main/java/org/apache/brooklyn/policy/failover/PropagatePrimaryEnricher.java b/policy/src/main/java/org/apache/brooklyn/policy/failover/PropagatePrimaryEnricher.java new file mode 100644 index 000..b209e90 --- /dev/null +++ b/policy/src/main/java/org/apache/brooklyn/policy/failover/PropagatePrimaryEnricher.java @@ -0,0 +1,204 @@ +/* + * 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.failover; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.mgmt.TaskAdaptable; +import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.api.sensor.EnricherSpec; +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.effector.EffectorTasks.EffectorTaskFactory; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.enricher.AbstractEnricher; +import org.apache.brooklyn.core.entity.EntityInternal; +import org.apache.brooklyn.core.entity.EntityInternal.SensorSupportInternal; +import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.enricher.stock.Propagator; +import org.apache.brooklyn.util.collections.MutableSet; +import org.apache.brooklyn.util.core.config.ConfigBag; +import org.apache.brooklyn.util.core.task.DynamicTasks; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.annotations.Beta; +import com.google.common.base.Objects; + +/** Makes all sensors/effectors available on primary mirrored at this node, + * apart from those already present here. */ +@Beta +public class PropagatePrimaryEnricher extends AbstractEnricher implements SensorEventListener { + +private static final Logger log = LoggerFactory.getLogger(PropagatePrimaryEnricher.class); + +public static final ConfigKey PRIMARY_SENSOR_NAME = ElectPrimaryConfig.PRIMARY_SENSOR_NAME; + +public static final ConfigKey PROPAGATE_EFFECTORS = ConfigKeys.newBooleanConfigKey("propagate.effectors", +"Whether to propagate effectors, default true (effectors already defined here will not be propagated)", +true); + +public static final ConfigKey PROPAGATING_ALL = Propagator.PROPAGATING_ALL; +public static final ConfigKey> PROPAGATING_ALL_BUT = Propagator.PROPAGATING_ALL_BUT; +public static final ConfigKey > PROPAGATING = Propagator.PROPAGATING; +public static final ConfigKey > SENSOR_MAPPING = Propagator.SENSOR_MAPPING; + +Entity lastPrimary; +Propagator propagator; + +Set effectorsAddedForPrimary; +Set blacklistedEffectors = MutableSet.of("start", "stop", "restart", "promote", "demote", +getConfig(ElectPrimaryConfig.PROMOTE_EFFECTOR_NAME), getConfig(ElectPrimaryConfig.DEMOTE_EFFECTOR_NAME)); +Set blacklistedSensors = MutableSet.of(); + +public void setEntity(@SuppressWarnings("deprecation") org.apache.brooklyn.api.entity.EntityLocal entity) { +super.setEntity(entity); + + blacklistedEffectors.addAll(((EntityInternal)entity).getMutableEntityType().getEffectors().keySet()); + blacklistedSensors.addAll(((EntityInternal)entity).getMutableEntityType().getSensors().keySet()); +for (Sensor s: Propagator.SENSORS_NOT_USUALLY_PROPAGATED) { +blacklistedSensors.add(s.getName()); +} + blacklistedSensors.addAll(MutableSet.of(getConfig(PRIMARY_SENSOR_NAME), getConfig(ElectPrimaryConfig.PRIMARY_WEIGHT_NAME))); + +subscriptions().subscribe(entity, Sensors.newSensor(Entity.class, config().get(PRIMARY_SENSOR_NAME)),
[04/11] brooklyn-server git commit: move to `failover` package instead of `ha` and mark beta
move to `failover` package instead of `ha` and mark beta Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0191d90e Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0191d90e Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0191d90e Branch: refs/heads/master Commit: 0191d90e2be59f25dcfa19bcbbd53c78d08be2d8 Parents: 62706c6 Author: Alex HeneveldAuthored: Wed Nov 8 09:32:36 2017 + Committer: Alex Heneveld Committed: Wed Nov 8 09:32:36 2017 + -- .../test/policy/failover/ElectPrimaryTest.java | 379 .../policies/ha/brooklyn/ElectPrimaryTest.java | 379 .../policy/failover/ElectPrimaryConfig.java | 85 .../policy/failover/ElectPrimaryEffector.java | 442 +++ .../policy/failover/ElectPrimaryPolicy.java | 225 ++ .../policy/failover/PrimaryRunningEnricher.java | 75 .../failover/PropagatePrimaryEnricher.java | 204 + .../brooklyn/policy/ha/ElectPrimaryConfig.java | 82 .../policy/ha/ElectPrimaryEffector.java | 440 -- .../brooklyn/policy/ha/ElectPrimaryPolicy.java | 223 -- .../policy/ha/PrimaryRunningEnricher.java | 74 .../policy/ha/PropagatePrimaryEnricher.java | 204 - .../policy/failover/ElectPrimaryTest.java | 26 ++ .../brooklyn/policy/ha/ElectPrimaryTest.java| 26 -- .../failover/elect-primary-propagate-test.yaml | 37 ++ .../elect-primary-selection-mode-test.yaml | 33 ++ .../failover/elect-primary-simple-test.yaml | 28 ++ .../policy/ha/elect-primary-propagate-test.yaml | 37 -- .../ha/elect-primary-selection-mode-test.yaml | 33 -- .../policy/ha/elect-primary-simple-test.yaml| 28 -- 20 files changed, 1534 insertions(+), 1526 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0191d90e/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java new file mode 100644 index 000..583da10 --- /dev/null +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java @@ -0,0 +1,379 @@ +/* + * 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.camp.brooklyn.test.policy.failover; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +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.camp.brooklyn.AbstractYamlTest; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.effector.AddEffector; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.entity.Dumper; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; +import org.apache.brooklyn.core.entity.EntityPredicates; +import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; +import org.apache.brooklyn.core.entity.trait.Startable; +import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.policy.failover.ElectPrimaryConfig; +import org.apache.brooklyn.policy.failover.ElectPrimaryConfig.PrimaryDefaultSensorsAndEffectors; +import
[07/11] brooklyn-server git commit: Merge branch 'config-on-entity-dynamic-goes-on-type-after-persistence' into e2
Merge branch 'config-on-entity-dynamic-goes-on-type-after-persistence' into e2 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/bd9f69ce Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/bd9f69ce Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/bd9f69ce Branch: refs/heads/master Commit: bd9f69ce594dfe16bb3bb736305a227f9929d5f0 Parents: 8424e5e 31ff185 Author: Alex HeneveldAuthored: Thu Nov 9 11:39:20 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 11:39:20 2017 + -- .../apache/brooklyn/api/entity/EntitySpec.java | 25 +- .../brooklyn/api/mgmt/ExecutionContext.java | 24 +- .../mementos/BrooklynMementoPersister.java | 5 +- .../apache/brooklyn/api/objs/Configurable.java | 12 +- .../BrooklynComponentTemplateResolver.java | 34 +- .../spi/creation/CampInternalUtils.java | 7 +- .../camp/brooklyn/EntitiesYamlTest.java | 10 +- .../core/BrooklynFeatureEnablement.java | 10 +- .../catalog/internal/CatalogInitialization.java | 11 +- .../brooklyn/core/config/BasicConfigKey.java| 3 +- .../config/internal/AbstractConfigMapImpl.java | 56 +- .../core/location/CatalogLocationResolver.java | 4 +- .../apache/brooklyn/core/mgmt/BrooklynTags.java | 5 + .../brooklyn/core/mgmt/ha/OsgiManager.java | 2 + .../BrooklynMementoPersisterToObjectStore.java | 14 +- .../core/mgmt/persist/XmlMementoSerializer.java | 52 +- .../rebind/BasicCatalogItemRebindSupport.java | 10 +- .../core/mgmt/rebind/RebindContextImpl.java | 2 +- .../mgmt/rebind/RebindContextLookupContext.java | 24 + .../core/mgmt/rebind/RebindIteration.java | 55 +- .../mgmt/rebind/dto/BasicEntityMemento.java | 36 +- .../core/objs/proxy/InternalEntityFactory.java | 7 + .../entity/CatalogEntitySpecResolver.java | 40 +- .../core/typereg/BasicBrooklynTypeRegistry.java | 28 +- .../core/typereg/BundleUpgradeParser.java | 140 ++- .../brooklyn/entity/group/DynamicCluster.java | 19 +- .../brooklyn/util/core/ClassLoaderUtils.java| 19 +- .../util/core/task/BasicExecutionContext.java | 16 +- .../apache/brooklyn/util/core/task/Tasks.java | 6 +- .../brooklyn/util/core/task/ValueResolver.java | 98 +- .../MapListAndOtherStructuredConfigKeyTest.java | 19 + .../entity/RecordingSensorEventListener.java| 4 + .../mgmt/persist/XmlMementoSerializerTest.java | 21 +- .../mgmt/rebind/AbstractRebindHistoricTest.java | 11 +- .../core/mgmt/rebind/RebindEntityTest.java | 70 +- .../rebind/RebindHistoricEntitySpecTest.java| 134 +++ .../core/typereg/BundleUpgradeParserTest.java | 12 + .../enricher/stock/UpdatingMapTest.java | 9 +- .../entity/group/DynamicClusterTest.java| 20 + .../brooklyn/util/core/task/TasksTest.java | 7 +- .../util/core/task/ValueResolverTest.java | 45 + .../core/mgmt/rebind/enricher-abcdefghij| 25 + ...ityspec-containing-empty-policies-wj5s8u9h73 | 49 + ...th-entityspec-containing-policies-aeifj99fjd | 53 ++ .../brooklyn/core/mgmt/rebind/policy-awmsgjxp8i | 25 + .../BrooklynLauncherRebindCatalogOsgiTest.java | 116 ++- .../BrooklynLauncherUpgradeCatalogOsgiTest.java | 23 +- parent/pom.xml | 2 + server-cli/pom.xml | 28 +- .../main/resources/brooklyn/default.catalog.bom | 375 .../main/resources/brooklyn/icons/cluster.svg | 1 - .../main/resources/brooklyn/icons/server.svg| 933 --- server-cli/src/main/resources/catalog.bom | 368 .../base/VanillaSoftwareProcessImpl.java| 11 + .../base/VanillaSoftwareProcessTest.java| 74 ++ .../org/apache/brooklyn/config/ConfigMap.java | 1 + 56 files changed, 1333 insertions(+), 1877 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bd9f69ce/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java --
[02/11] brooklyn-server git commit: add policies for electing primaries
add policies for electing primaries Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/62706c69 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/62706c69 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/62706c69 Branch: refs/heads/master Commit: 62706c69270fe5a7133c42452a687adbedebc68c Parents: ebc930a Author: Alex HeneveldAuthored: Mon Nov 6 13:59:30 2017 + Committer: Alex Heneveld Committed: Mon Nov 6 14:29:12 2017 + -- camp/camp-brooklyn/pom.xml | 7 + .../policies/ha/brooklyn/ElectPrimaryTest.java | 379 .../brooklyn/policy/ha/ElectPrimaryConfig.java | 82 .../policy/ha/ElectPrimaryEffector.java | 440 +++ .../brooklyn/policy/ha/ElectPrimaryPolicy.java | 223 ++ .../policy/ha/PrimaryRunningEnricher.java | 74 .../policy/ha/PropagatePrimaryEnricher.java | 204 + .../brooklyn/policy/ha/ElectPrimaryTest.java| 26 ++ .../policy/ha/elect-primary-propagate-test.yaml | 37 ++ .../ha/elect-primary-selection-mode-test.yaml | 33 ++ .../policy/ha/elect-primary-simple-test.yaml| 28 ++ 11 files changed, 1533 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/62706c69/camp/camp-brooklyn/pom.xml -- diff --git a/camp/camp-brooklyn/pom.xml b/camp/camp-brooklyn/pom.xml index 8ebd96d..d229c58 100644 --- a/camp/camp-brooklyn/pom.xml +++ b/camp/camp-brooklyn/pom.xml @@ -127,6 +127,13 @@ org.apache.brooklyn +brooklyn-policy +${project.version} +tests +test + + +org.apache.brooklyn brooklyn-software-base ${project.version} tests http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/62706c69/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/policies/ha/brooklyn/ElectPrimaryTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/policies/ha/brooklyn/ElectPrimaryTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/policies/ha/brooklyn/ElectPrimaryTest.java new file mode 100644 index 000..638fba8 --- /dev/null +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/policies/ha/brooklyn/ElectPrimaryTest.java @@ -0,0 +1,379 @@ +/* + * 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.camp.policies.ha.brooklyn; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.api.entity.Entity; +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.camp.brooklyn.AbstractYamlTest; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.effector.AddEffector; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.entity.Dumper; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; +import org.apache.brooklyn.core.entity.EntityPredicates; +import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; +import org.apache.brooklyn.core.entity.trait.Startable; +import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.policy.ha.ElectPrimaryConfig; +import org.apache.brooklyn.policy.ha.ElectPrimaryConfig.PrimaryDefaultSensorsAndEffectors; +import org.apache.brooklyn.policy.ha.ElectPrimaryConfig.SelectionMode; +import
[09/11] brooklyn-server git commit: simplify propagation, and add rebind test for elect primary and propagtor
simplify propagation, and add rebind test for elect primary and propagtor Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/33123862 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/33123862 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/33123862 Branch: refs/heads/master Commit: 331238622709e41dd8f4912bc17144e159f65bbf Parents: b0dd4ce Author: Alex HeneveldAuthored: Thu Nov 9 10:11:00 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 15:54:51 2017 + -- .../camp/brooklyn/AbstractYamlRebindTest.java | 10 +- .../camp/brooklyn/AbstractYamlTest.java | 12 +- .../test/policy/failover/ElectPrimaryTest.java | 110 + .../internal/AbstractManagementContext.java | 1 + .../core/mgmt/rebind/RebindIteration.java | 2 + .../policy/failover/ElectPrimaryEffector.java | 9 +- .../policy/failover/ElectPrimaryPolicy.java | 3 +- .../failover/PropagatePrimaryEnricher.java | 164 +-- 8 files changed, 147 insertions(+), 164 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/33123862/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java index 47ed222..7653d31 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java @@ -137,11 +137,11 @@ public class AbstractYamlRebindTest extends RebindTestFixturehttp://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/33123862/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java index 091598f..79671f5 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java @@ -67,6 +67,7 @@ import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; +import com.google.common.annotations.Beta; import com.google.common.base.Joiner; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; @@ -154,11 +155,16 @@ public abstract class AbstractYamlTest { } protected String loadYaml(String yamlFileName, String ...extraLines) throws Exception { -ResourceUtils ru = new ResourceUtils(this); +return loadYaml(this, yamlFileName, extraLines); +} + +@Beta +public static String loadYaml(Object loadContext, String yamlFileName, String ...extraLines) throws Exception { +ResourceUtils ru = new ResourceUtils(loadContext); if (!ru.doesUrlExist(yamlFileName)) { -if (ru.doesUrlExist(Urls.mergePaths(getClass().getPackage().getName().replace('.', '/'), yamlFileName))) { +if (ru.doesUrlExist(Urls.mergePaths(loadContext.getClass().getPackage().getName().replace('.', '/'), yamlFileName))) { // look in package-specific folder if not found at root -yamlFileName = Urls.mergePaths(getClass().getPackage().getName().replace('.', '/'), yamlFileName); +yamlFileName = Urls.mergePaths(loadContext.getClass().getPackage().getName().replace('.', '/'), yamlFileName); } } String input = ru.getResourceAsString(yamlFileName).trim(); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/33123862/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java index 4a32535..b7be4ff 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java +++
[01/11] brooklyn-server git commit: minor tidies to javadoc, propagate fatal exceptions
Repository: brooklyn-server Updated Branches: refs/heads/master 73ec34dda -> b7ad01e96 minor tidies to javadoc, propagate fatal exceptions Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ebc930a0 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ebc930a0 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ebc930a0 Branch: refs/heads/master Commit: ebc930a023c06bacfc01b73018d708488efaa11d Parents: 6fa3b7a Author: Alex HeneveldAuthored: Mon Nov 6 13:58:27 2017 + Committer: Alex Heneveld Committed: Mon Nov 6 13:58:27 2017 + -- api/src/main/java/org/apache/brooklyn/api/entity/Entity.java | 2 +- .../brooklyn/core/mgmt/internal/LocalSubscriptionManager.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ebc930a0/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java -- diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java index d981efd..94fc55b 100644 --- a/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java +++ b/api/src/main/java/org/apache/brooklyn/api/entity/Entity.java @@ -302,7 +302,7 @@ public interface Entity extends BrooklynObject { /** * Removes the given enricher from this entity. - * @return True if the policy enricher at this entity; false otherwise + * @return True if the enricher existed at this entity; false otherwise */ @Override boolean remove(Enricher enricher); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ebc930a0/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java index a5fed0e..ab82e47 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManager.java @@ -52,6 +52,7 @@ import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.task.BasicExecutionContext; import org.apache.brooklyn.util.core.task.BasicExecutionManager; import org.apache.brooklyn.util.core.task.SingleThreadedScheduler; +import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.text.Identifiers; import org.apache.brooklyn.util.text.Strings; import org.slf4j.Logger; @@ -349,6 +350,7 @@ public class LocalSubscriptionManager extends AbstractSubscriptionManager { s.listener.onEvent(event); } catch (Throwable t) { +Exceptions.propagateIfFatal(t); if (event!=null && event.getSource()!=null && Entities.isNoLongerManaged(event.getSource())) { LOG.debug("Error processing subscriptions to "+this+", after entity unmanaged: "+t, t); } else {
[06/11] brooklyn-server git commit: address all remaining PR comments except rebind (to follow)
address all remaining PR comments except rebind (to follow) * _.once(rescan) efficiency * run at start * subscribe to members _or_ children (not both) * javadoc tidy * don't forget to set lastPrimary Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/8424e5e6 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/8424e5e6 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/8424e5e6 Branch: refs/heads/master Commit: 8424e5e6a3cf58054e136e5c422c4034ecf4351f Parents: 3bd7987 Author: Alex HeneveldAuthored: Thu Nov 9 00:59:55 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 01:03:59 2017 + -- .../test/policy/failover/ElectPrimaryTest.java | 6 +- .../policy/failover/ElectPrimaryEffector.java | 344 ++- .../policy/failover/ElectPrimaryPolicy.java | 118 +-- .../failover/PropagatePrimaryEnricher.java | 10 +- 4 files changed, 271 insertions(+), 207 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/8424e5e6/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java index 583da10..4a32535 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/test/policy/failover/ElectPrimaryTest.java @@ -88,6 +88,11 @@ public class ElectPrimaryTest extends AbstractYamlTest { Entity app = createAndStartApplication(loadYaml("classpath://org/apache/brooklyn/policy/failover/elect-primary-simple-test.yaml")); EntityAsserts.assertAttributeEventually(app, PRIMARY, Predicates.notNull()); log.info("Primary sensor is: "+app.sensors().get(PRIMARY)); + +// and confirm the result with the selector directly +// (and show how internals can be accessed in case people want to investigate it) +Asserts.assertEquals(new ElectPrimaryEffector.CheckPrimaries(app, ConfigBag.newInstance()).call(), +app.sensors().get(PRIMARY) ); } @Test @@ -196,7 +201,6 @@ public class ElectPrimaryTest extends AbstractYamlTest { // shouldn't be necessary as app is set starting before primary set to a, so // above method checks not pass until promotion/demotion invocations have also completed //Asserts.succeedsEventually(() -> Asserts.assertSize(promoteDemoteEffectorMessages, 2)); - Asserts.assertTrue(promoteDemoteEffectorMessages.stream().anyMatch((s) -> s.matches("promote .*"+a.getId()+".* args=.*")), "Missing/bad promotion message in: "+promoteDemoteEffectorMessages); Asserts.assertTrue(promoteDemoteEffectorMessages.stream().anyMatch((s) -> s.matches("demote .*"+b.getId()+".* args=.*")), http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/8424e5e6/policy/src/main/java/org/apache/brooklyn/policy/failover/ElectPrimaryEffector.java -- diff --git a/policy/src/main/java/org/apache/brooklyn/policy/failover/ElectPrimaryEffector.java b/policy/src/main/java/org/apache/brooklyn/policy/failover/ElectPrimaryEffector.java index 64c454f..a14c4db 100644 --- a/policy/src/main/java/org/apache/brooklyn/policy/failover/ElectPrimaryEffector.java +++ b/policy/src/main/java/org/apache/brooklyn/policy/failover/ElectPrimaryEffector.java @@ -53,6 +53,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.annotations.Beta; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Stopwatch; import com.google.common.collect.Iterables; @@ -63,7 +64,7 @@ The primary is selected from service-up candidates based on a numeric weight as In the case of ties, or a new candidate emerging with a weight higher than a current healthy primary, behaviour can be configured with `primary.selection.mode`. -Returns a map containing a message, newPrimary, oldPrimary, and a {@link ResultCode} code. +@return a map containing a message, newPrimary, oldPrimary, and a {@link ResultCode} code. */ @Beta public class ElectPrimaryEffector implements EntityInitializer, ElectPrimaryConfig { @@ -84,7 +85,6 @@ public class ElectPrimaryEffector implements EntityInitializer, ElectPrimaryConf public
[4/5] brooklyn-server git commit: routine to `assertEntityHealthyEventually`
routine to `assertEntityHealthyEventually` Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6fa3b7aa Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6fa3b7aa Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6fa3b7aa Branch: refs/heads/master Commit: 6fa3b7aa1bd21eb12fcc00b03d172f1773362263 Parents: 447cac7 Author: Alex HeneveldAuthored: Fri Nov 3 14:14:15 2017 + Committer: Alex Heneveld Committed: Fri Nov 3 14:14:15 2017 + -- .../main/java/org/apache/brooklyn/core/entity/EntityAsserts.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6fa3b7aa/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java b/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java index 043332a..7969f3d 100644 --- a/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java +++ b/core/src/main/java/org/apache/brooklyn/core/entity/EntityAsserts.java @@ -230,7 +230,6 @@ public class EntityAsserts { * Setting these sensors is common behaviour for entities, but depends on the particular entity * implementation. */ -@Beta public static void assertEntityHealthy(Entity entity) { assertAttributeEquals(entity, SERVICE_UP, true); assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING); @@ -241,6 +240,9 @@ public class EntityAsserts { } }); } +public static void assertEntityHealthyEventually(Entity entity) { +Asserts.succeedsEventually(() -> assertEntityHealthy(entity)); +} /** * Asserts sensors {@code service.isUp} is false, and that {@code service.state} is "on fire".
[3/5] brooklyn-server git commit: suppress warning on task finalization if its execution context is shutdown
suppress warning on task finalization if its execution context is shutdown Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/447cac71 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/447cac71 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/447cac71 Branch: refs/heads/master Commit: 447cac711463f5ef1bf685759f167e88580b759e Parents: 2900156 Author: Alex HeneveldAuthored: Fri Nov 3 14:13:50 2017 + Committer: Alex Heneveld Committed: Fri Nov 3 14:13:50 2017 + -- .../java/org/apache/brooklyn/util/core/task/BasicTask.java | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/447cac71/core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java -- diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java index 4913ab3..e7278912 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/task/BasicTask.java @@ -43,6 +43,7 @@ import java.util.concurrent.TimeoutException; import org.apache.brooklyn.api.mgmt.HasTaskChildren; import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; import org.apache.brooklyn.util.JavaGroovyEquivalents; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.guava.Maybe; @@ -808,10 +809,10 @@ public class BasicTask implements TaskInternal { return; } if (!t.isDone()) { -// shouldn't happen -// TODO But does happen if management context was terminated (e.g. running test suite). -// Should check if Execution Manager is running, and only log if it was not terminated? -log.warn("Task "+t+" is being finalized before completion"); +if (!BrooklynTaskTags.getExecutionContext(t).isShutdown()) { +// not sure how this could happen +log.warn("Task "+t+" was submitted but forgotten before it was run (finalized before completion)"); +} return; } }
[2/5] brooklyn-server git commit: support more ManagementContext.lookup including predicates, adjuncts, lookupAll
support more ManagementContext.lookup including predicates, adjuncts, lookupAll Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2900156d Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2900156d Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2900156d Branch: refs/heads/master Commit: 2900156d8988a16e2c7de8847de648ceaa62cfae Parents: a70a553 Author: Alex HeneveldAuthored: Thu Nov 2 16:51:06 2017 + Committer: Alex Heneveld Committed: Thu Nov 2 16:51:20 2017 + -- .../brooklyn/api/mgmt/ManagementContext.java| 13 +++-- .../internal/AbstractManagementContext.java | 50 +++- .../NonDeploymentManagementContext.java | 13 + .../brooklyn/enricher/stock/EnrichersTest.java | 11 + 4 files changed, 82 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2900156d/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java -- diff --git a/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java b/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java index 4ad9718..b82c884 100644 --- a/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java +++ b/api/src/main/java/org/apache/brooklyn/api/mgmt/ManagementContext.java @@ -41,6 +41,7 @@ import org.apache.brooklyn.config.StringConfigMap; import org.apache.brooklyn.util.guava.Maybe; import com.google.common.annotations.Beta; +import com.google.common.base.Predicate; /** * This is the entry point for accessing and interacting with a realm of applications and their entities in Brooklyn. @@ -309,8 +310,14 @@ public interface ManagementContext { /** As {@link #lookup(String, Class)} but not constraining the return type */ public BrooklynObject lookup(String id); -/** Finds an entity with the given ID known at this management context */ -// TODO in future support policies etc +/** As {@link #lookup(Predicate)} comparing the ID of the object with the given string */ public T lookup(String id, Class type); -} \ No newline at end of file +/** Finds a {@link BrooklynObject} known in this management context + * satisfying the given predicate, or null */ +public T lookup(Predicate filter); + +/** As {@link #lookup(Predicate)} but returning all such instances */ +public Collection lookupAll(Predicate filter); + +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2900156d/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java index 3cdd944..c0e3d7c 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/AbstractManagementContext.java @@ -25,6 +25,7 @@ import java.lang.reflect.InvocationTargetException; import java.net.URI; import java.net.URL; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -88,6 +89,7 @@ import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.base.Objects; import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -536,8 +538,52 @@ public abstract class AbstractManagementContext implements ManagementContextInte result = getLocationManager().getLocation(id); if (result!=null && type.isInstance(result)) return (T)result; -// TODO policies, enrichers, feeds; bundles? -return null; +return lookup((o) -> { return type.isInstance(o) && Objects.equal(id, o.getId()); }); +} + +@Override +public T lookup(Predicate filter) { +Collection list = lookupAll(filter, true); +if (list.isEmpty()) return null; +return list.iterator().next(); +} + +@Override +public Collection lookupAll(Predicate filter) { +return lookupAll(filter, false); +} + +@SuppressWarnings("unchecked") +private Collection lookupAll(Predicate filter, boolean justOne) { +List result = MutableList.of(); + +final class Scanner { +
[1/5] brooklyn-server git commit: allow Task.warning that doesn't log
Repository: brooklyn-server Updated Branches: refs/heads/master 589b68933 -> 73ec34dda allow Task.warning that doesn't log Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a70a5535 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a70a5535 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a70a5535 Branch: refs/heads/master Commit: a70a5535b09d474153a2e71e8db5c6528a58107c Parents: 95c5b1e Author: Alex HeneveldAuthored: Thu Nov 2 16:50:53 2017 + Committer: Alex Heneveld Committed: Thu Nov 2 16:50:53 2017 + -- .../src/main/java/org/apache/brooklyn/util/core/task/Tasks.java | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a70a5535/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java -- diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java b/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java index a31c663..7dc7584 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java @@ -357,7 +357,10 @@ public class Tasks { } }).build(); } public static Task warning(final String message, final Throwable optionalError) { -log.warn(message); +return warning(message, optionalError, true); +} +public static Task warning(final String message, final Throwable optionalError, boolean logWarning) { +if (logWarning) log.warn(message); return TaskTags.markInessential(fail(message, optionalError)); }
[5/5] brooklyn-server git commit: This closes #878
This closes #878 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/73ec34dd Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/73ec34dd Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/73ec34dd Branch: refs/heads/master Commit: 73ec34ddab4faa14f1096a2a7f2ba75ecd17982b Parents: 589b689 6fa3b7a Author: Aled SageAuthored: Fri Nov 10 10:58:04 2017 + Committer: Aled Sage Committed: Fri Nov 10 10:58:04 2017 + -- .../brooklyn/api/mgmt/ManagementContext.java| 13 +++-- .../brooklyn/core/entity/EntityAsserts.java | 4 +- .../internal/AbstractManagementContext.java | 50 +++- .../NonDeploymentManagementContext.java | 13 + .../brooklyn/util/core/task/BasicTask.java | 9 ++-- .../apache/brooklyn/util/core/task/Tasks.java | 5 +- .../brooklyn/enricher/stock/EnrichersTest.java | 11 + 7 files changed, 94 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/73ec34dd/core/src/main/java/org/apache/brooklyn/util/core/task/Tasks.java --
[1/2] brooklyn-server git commit: guard against possible NPE when rebinding legacy catalog items
Repository: brooklyn-server Updated Branches: refs/heads/master 34016b66b -> 6e756bfbb guard against possible NPE when rebinding legacy catalog items Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c713529a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c713529a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c713529a Branch: refs/heads/master Commit: c713529a99bdb4b22ed4035c4d1b9bff05229cd0 Parents: 34016b6 Author: Alex HeneveldAuthored: Thu Nov 9 19:11:16 2017 + Committer: Alex Heneveld Committed: Thu Nov 9 19:11:16 2017 + -- .../brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java | 3 --- .../org/apache/brooklyn/core/typereg/BundleUpgradeParser.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c713529a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java index aa76d26..ee2871c 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java @@ -18,15 +18,12 @@ */ package org.apache.brooklyn.core.mgmt.rebind; -import java.util.Set; - import org.apache.brooklyn.api.mgmt.rebind.RebindContext; import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento; import org.apache.brooklyn.core.catalog.internal.CatalogItemDtoAbstract; import org.apache.brooklyn.core.typereg.BundleUpgradeParser.CatalogUpgrades; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.flags.FlagUtils; -import org.apache.brooklyn.util.osgi.VersionedName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c713529a/core/src/main/java/org/apache/brooklyn/core/typereg/BundleUpgradeParser.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/typereg/BundleUpgradeParser.java b/core/src/main/java/org/apache/brooklyn/core/typereg/BundleUpgradeParser.java index 82b02b8..d808c24 100644 --- a/core/src/main/java/org/apache/brooklyn/core/typereg/BundleUpgradeParser.java +++ b/core/src/main/java/org/apache/brooklyn/core/typereg/BundleUpgradeParser.java @@ -352,7 +352,8 @@ public class BundleUpgradeParser { @Beta public static String getBundleUpgradedIfNecessary(ManagementContext mgmt, String vName) { -if (vName==null) return null; +// mgmt can be null in some edge cases, eg BasicCatalogItemRebindSupport.possiblyUpgradedBundle +if (vName==null || mgmt==null) return null; Maybe osgi = ((ManagementContextInternal)mgmt).getOsgiManager(); if (osgi.isAbsent()) { // ignore upgrades if not osgi
[2/2] brooklyn-server git commit: This closes #891
This closes #891 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6e756bfb Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6e756bfb Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6e756bfb Branch: refs/heads/master Commit: 6e756bfbb026ca86a724474dda35ea2b75b80e5a Parents: 34016b6 c713529 Author: Aled SageAuthored: Thu Nov 9 21:03:08 2017 + Committer: Aled Sage Committed: Thu Nov 9 21:03:08 2017 + -- .../brooklyn/core/mgmt/rebind/BasicCatalogItemRebindSupport.java | 3 --- .../org/apache/brooklyn/core/typereg/BundleUpgradeParser.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) --
[1/2] brooklyn-server git commit: Add brooklyn-cli as a feature to karaf
Repository: brooklyn-server Updated Branches: refs/heads/master 3bf16b489 -> 97c5cf693 Add brooklyn-cli as a feature to karaf Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a2570d8b Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a2570d8b Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a2570d8b Branch: refs/heads/master Commit: a2570d8b0a462e94410e2b2f5eab29b56100a0c5 Parents: 3bf16b4 Author: graeme.millerAuthored: Tue Nov 7 21:17:22 2017 + Committer: graeme.miller Committed: Tue Nov 7 21:17:22 2017 + -- karaf/features/src/main/feature/feature.xml | 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a2570d8b/karaf/features/src/main/feature/feature.xml -- diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml index 4878ef5..3ad602c 100644 --- a/karaf/features/src/main/feature/feature.xml +++ b/karaf/features/src/main/feature/feature.xml @@ -327,11 +327,16 @@ mvn:org.apache.brooklyn/brooklyn-test-framework/${project.version} + + mvn:org.apache.brooklyn/brooklyn-cli/${project.version} + + brooklyn-software-base brooklyn-jmxmp-agent brooklyn-jmxrmi-agent brooklyn-test-framework +brooklyn-cli
[2/2] brooklyn-server git commit: This closes #884
This closes #884 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/97c5cf69 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/97c5cf69 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/97c5cf69 Branch: refs/heads/master Commit: 97c5cf693a08c961ce38812f0815af55ae326d63 Parents: 3bf16b4 a2570d8 Author: Aled SageAuthored: Tue Nov 7 21:24:15 2017 + Committer: Aled Sage Committed: Tue Nov 7 21:24:15 2017 + -- karaf/features/src/main/feature/feature.xml | 5 + 1 file changed, 5 insertions(+) --
[1/2] brooklyn-server git commit: update maven-bundle-plugin to include headers for catalog bundles rebind after upgrade
Repository: brooklyn-server Updated Branches: refs/heads/master 1acd6420e -> 3bf16b489 update maven-bundle-plugin to include headers for catalog bundles rebind after upgrade Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/1c26b1c7 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/1c26b1c7 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/1c26b1c7 Branch: refs/heads/master Commit: 1c26b1c7b452a3bcd23c19cfded8e1c5f4130e1b Parents: aa43a5f Author: Robert MossAuthored: Mon Nov 6 12:07:29 2017 + Committer: Robert Moss Committed: Mon Nov 6 12:07:29 2017 + -- parent/pom.xml | 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1c26b1c7/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index b3ec0c6..752e1a7 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -1315,6 +1315,8 @@ brooklyn.*,org.apache.brooklyn.* ${buildNumber} ${scmBranch} + * + *
[2/2] brooklyn-server git commit: This closes #877
This closes #877 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/3bf16b48 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/3bf16b48 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/3bf16b48 Branch: refs/heads/master Commit: 3bf16b48985e6d2e4619977823d2142eba67e848 Parents: 1acd642 1c26b1c Author: Aled SageAuthored: Tue Nov 7 12:49:51 2017 + Committer: Aled Sage Committed: Tue Nov 7 12:49:51 2017 + -- parent/pom.xml | 2 ++ 1 file changed, 2 insertions(+) --
[3/3] brooklyn-server git commit: This closes #875
This closes #875 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b1126924 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b1126924 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b1126924 Branch: refs/heads/master Commit: b1126924f42ba50721897f738ed1b1cbb4ef5774 Parents: 2f57d79 95c5b1e Author: Aled SageAuthored: Mon Nov 6 23:20:12 2017 + Committer: Aled Sage Committed: Mon Nov 6 23:20:12 2017 + -- .../spi/dsl/BrooklynDslDeferredSupplier.java| 5 +- .../brooklyn/spi/dsl/methods/DslComponent.java | 6 +-- .../brooklyn/core/mgmt/BrooklynTaskTags.java| 49 .../mgmt/internal/LocalSubscriptionManager.java | 7 +++ .../util/core/task/BasicExecutionContext.java | 12 - .../internal/LocalSubscriptionManagerTest.java | 16 +++ .../customize/TemplateOptionsOption.java| 10 +--- 7 files changed, 86 insertions(+), 19 deletions(-) --
[1/3] brooklyn-server git commit: failing test illustrating problem
Repository: brooklyn-server Updated Branches: refs/heads/master 2f57d79eb -> b1126924f failing test illustrating problem Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/e797cbe1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/e797cbe1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/e797cbe1 Branch: refs/heads/master Commit: e797cbe179e0483599474a66141ed30d5f8c607a Parents: 48f0900 Author: Alex HeneveldAuthored: Thu Nov 2 15:35:58 2017 + Committer: Alex Heneveld Committed: Thu Nov 2 15:36:15 2017 + -- .../mgmt/internal/LocalSubscriptionManagerTest.java | 16 1 file changed, 16 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/e797cbe1/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManagerTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManagerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManagerTest.java index 5c04978..09cd40e 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManagerTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/LocalSubscriptionManagerTest.java @@ -41,6 +41,7 @@ import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.entity.group.BasicGroup; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; +import org.apache.brooklyn.util.core.task.BasicExecutionContext; import org.apache.brooklyn.util.time.Duration; import org.testng.Assert; import org.testng.annotations.BeforeMethod; @@ -259,4 +260,19 @@ public class LocalSubscriptionManagerTest extends BrooklynAppUnitTestSupport { Assert.assertEquals(listener.getEvents().get(9).getValue(), entity.sensors().get(TestEntity.SEQUENCE)); } +@Test +public void testSubscriptionHasSubscribersExecutionContext() throws Exception { +final AtomicReference result = new AtomicReference<>(); +final CountDownLatch latch = new CountDownLatch(1); +app.subscriptions().subscribe(entity, TestEntity.SEQUENCE, new SensorEventListener() { +@Override public void onEvent(SensorEvent event) { + result.set(BasicExecutionContext.getCurrentExecutionContext()); +latch.countDown(); +}}); +entity.setSequenceValue(1234); +if (!latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) { +fail("Timeout waiting for Event on TestEntity listener"); +} +Assert.assertEquals(result.get(), app.getExecutionContext()); +} }
[2/3] brooklyn-server git commit: share code for inferring execution context, and ensure EC is set in subscriptions
share code for inferring execution context, and ensure EC is set in subscriptions Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/95c5b1e7 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/95c5b1e7 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/95c5b1e7 Branch: refs/heads/master Commit: 95c5b1e78fba24e37216e99c209568a5e3cf2fec Parents: e797cbe Author: Alex HeneveldAuthored: Thu Nov 2 15:20:17 2017 + Committer: Alex Heneveld Committed: Thu Nov 2 15:36:16 2017 + -- .../spi/dsl/BrooklynDslDeferredSupplier.java| 5 +- .../brooklyn/spi/dsl/methods/DslComponent.java | 6 +-- .../brooklyn/core/mgmt/BrooklynTaskTags.java| 49 .../mgmt/internal/LocalSubscriptionManager.java | 7 +++ .../util/core/task/BasicExecutionContext.java | 12 - .../customize/TemplateOptionsOption.java| 10 +--- 6 files changed, 70 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/95c5b1e7/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java -- diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java index 835f5d4..3b31637 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/BrooklynDslDeferredSupplier.java @@ -100,10 +100,7 @@ public abstract class BrooklynDslDeferredSupplier implements DeferredSupplier if (log.isDebugEnabled()) log.debug("Queuing task to resolve "+dsl+", called by "+Tasks.current()); -EntityInternal entity = (EntityInternal) BrooklynTaskTags.getTargetOrContextEntity(Tasks.current()); -ExecutionContext exec = -(entity != null) ? entity.getExecutionContext() - : BasicExecutionContext.getCurrentExecutionContext(); +ExecutionContext exec = BrooklynTaskTags.getCurrentExecutionContext(); if (exec == null) { throw new IllegalStateException("No execution context available to resolve " + dsl); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/95c5b1e7/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java -- diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java index 9ecad76..9dc5ed1 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java @@ -46,7 +46,6 @@ import org.apache.brooklyn.core.sensor.DependentConfiguration; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.util.JavaGroovyEquivalents; import org.apache.brooklyn.util.core.flags.TypeCoercions; -import org.apache.brooklyn.util.core.task.BasicExecutionContext; import org.apache.brooklyn.util.core.task.DeferredSupplier; import org.apache.brooklyn.util.core.task.ImmediateSupplier; import org.apache.brooklyn.util.core.task.TaskBuilder; @@ -339,10 +338,7 @@ public class DslComponent extends BrooklynDslDeferredSupplier implements } static ExecutionContext findExecutionContext(Object callerContext) { -EntityInternal contextEntity = (EntityInternal) BrooklynTaskTags.getTargetOrContextEntity(Tasks.current()); -ExecutionContext execContext = -(contextEntity != null) ? contextEntity.getExecutionContext() -: BasicExecutionContext.getCurrentExecutionContext(); +ExecutionContext execContext = BrooklynTaskTags.getCurrentExecutionContext(); if (execContext == null) { throw new IllegalStateException("No execution context available to resolve " + callerContext); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/95c5b1e7/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/BrooklynTaskTags.java
[2/2] brooklyn-server git commit: This closes #881
This closes #881 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2f57d79e Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2f57d79e Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2f57d79e Branch: refs/heads/master Commit: 2f57d79eb6f6b0b9b7a93f7f0f66a1757d02e35e Parents: 9c9331c b8782c2 Author: Aled SageAuthored: Mon Nov 6 23:11:57 2017 + Committer: Aled Sage Committed: Mon Nov 6 23:11:57 2017 + -- .../base/VanillaSoftwareProcessImpl.java| 11 +++ .../base/VanillaSoftwareProcessTest.java| 74 2 files changed, 85 insertions(+) --
[1/2] brooklyn-server git commit: BROOKLYN-547: fix VanillaSoftwareProcess.restart with no ssh-monitoring
Repository: brooklyn-server Updated Branches: refs/heads/master 9c9331c1b -> 2f57d79eb BROOKLYN-547: fix VanillaSoftwareProcess.restart with no ssh-monitoring Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b8782c25 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b8782c25 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b8782c25 Branch: refs/heads/master Commit: b8782c253f87f79d84c65c93f0391ec527729383 Parents: 9c9331c Author: Aled SageAuthored: Mon Nov 6 17:54:28 2017 + Committer: Aled Sage Committed: Mon Nov 6 17:54:28 2017 + -- .../base/VanillaSoftwareProcessImpl.java| 11 +++ .../base/VanillaSoftwareProcessTest.java| 74 2 files changed, 85 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b8782c25/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessImpl.java -- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessImpl.java index 5fa7b66..02a34f1 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessImpl.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessImpl.java @@ -18,7 +18,10 @@ */ package org.apache.brooklyn.entity.software.base; +import org.apache.brooklyn.api.sensor.Enricher; +import org.apache.brooklyn.core.entity.EntityAdjuncts; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceNotUpLogic; +import org.apache.brooklyn.util.guava.Maybe; public class VanillaSoftwareProcessImpl extends SoftwareProcessImpl implements VanillaSoftwareProcess { @@ -35,6 +38,14 @@ public class VanillaSoftwareProcessImpl extends SoftwareProcessImpl implements V } else { // See SoftwareProcessImpl.waitForEntityStart(). We will already have waited for driver.isRunning. // We will not poll for that again. +// +// Also disable the associated enricher - otherwise that would reset the not-up-indicator +// if serviceUp=false temporarily (e.g. if restart effector is called). +// See https://issues.apache.org/jira/browse/BROOKLYN-547 +Maybe enricher = EntityAdjuncts.tryFindWithUniqueTag(enrichers(), "service-process-is-running-updating-not-up"); +if (enricher.isPresent()) { +enrichers().remove(enricher.get()); +} ServiceNotUpLogic.clearNotUpIndicator(this, SERVICE_PROCESS_IS_RUNNING); } } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b8782c25/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java -- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java index fa8695f..3c78b35 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java @@ -19,6 +19,8 @@ package org.apache.brooklyn.entity.software.base; import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecContains; +import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecHasAtLeastOnce; +import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecHasNever; import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecHasOnlyOnce; import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecSatisfies; import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecsContain; @@ -26,25 +28,38 @@ import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertEx import static org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts.assertExecsSatisfy; import java.util.Map; +import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.location.MachineLocation; +import
[1/2] brooklyn-server git commit: Fix rebind EntitySpec with policies ref
Repository: brooklyn-server Updated Branches: refs/heads/master aa43a5feb -> 9c9331c1b Fix rebind EntitySpec with policies ref Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/59800ab5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/59800ab5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/59800ab5 Branch: refs/heads/master Commit: 59800ab51f8dbe09fcff6ea3eee86f48effdd0a9 Parents: aa43a5f Author: Aled SageAuthored: Mon Nov 6 13:11:20 2017 + Committer: Aled Sage Committed: Mon Nov 6 14:56:45 2017 + -- .../apache/brooklyn/api/entity/EntitySpec.java | 25 +++- .../mgmt/rebind/AbstractRebindHistoricTest.java | 11 +- .../rebind/RebindHistoricEntitySpecTest.java| 134 +++ .../core/mgmt/rebind/enricher-abcdefghij| 25 ...ityspec-containing-empty-policies-wj5s8u9h73 | 49 +++ ...th-entityspec-containing-policies-aeifj99fjd | 53 .../brooklyn/core/mgmt/rebind/policy-awmsgjxp8i | 25 7 files changed, 319 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/59800ab5/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java -- diff --git a/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java index 7e11387..43df6fe 100644 --- a/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java +++ b/api/src/main/java/org/apache/brooklyn/api/entity/EntitySpec.java @@ -29,9 +29,13 @@ import javax.annotation.Nullable; import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.LocationSpec; +import org.apache.brooklyn.api.policy.Policy; import org.apache.brooklyn.api.policy.PolicySpec; +import org.apache.brooklyn.api.sensor.Enricher; import org.apache.brooklyn.api.sensor.EnricherSpec; import org.apache.brooklyn.util.collections.MutableList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.google.common.base.Function; import com.google.common.base.Throwables; @@ -55,6 +59,8 @@ public class EntitySpec extends AbstractBrooklynObjectSpec 0) { +LOG.warn("NOT SUPPORTED: EntitySpec "+this+" has hard-coded policies, rather than use of PolicySpec - policies will be ignored ("+policies+")"); +policies = null; +} +if (enrichers != null && enrichers.size() > 0) { +LOG.warn("NOT SUPPORTED: EntitySpec "+this+" has hard-coded enrichers, rather than use of EnricherSpec - enrichers will be ignored ("+enrichers+")"); +enrichers = null; +} +return super.readResolve(); +} + +@Override protected EntitySpec copyFrom(EntitySpec otherSpec) { super.copyFrom(otherSpec) .additionalInterfaces(otherSpec.getAdditionalInterfaces()) http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/59800ab5/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/AbstractRebindHistoricTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/AbstractRebindHistoricTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/AbstractRebindHistoricTest.java index 1a0face..9df6357 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/AbstractRebindHistoricTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/AbstractRebindHistoricTest.java @@ -18,7 +18,9 @@ */ package org.apache.brooklyn.core.mgmt.rebind; -import com.google.common.io.Files; +import java.io.File; +import java.io.FileInputStream; + import
[2/2] brooklyn-server git commit: This closes #880
This closes #880 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9c9331c1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9c9331c1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9c9331c1 Branch: refs/heads/master Commit: 9c9331c1b72888db3a6de13c1edf158757fa277d Parents: aa43a5f 59800ab Author: Aled SageAuthored: Mon Nov 6 15:44:43 2017 + Committer: Aled Sage Committed: Mon Nov 6 15:44:43 2017 + -- .../apache/brooklyn/api/entity/EntitySpec.java | 25 +++- .../mgmt/rebind/AbstractRebindHistoricTest.java | 11 +- .../rebind/RebindHistoricEntitySpecTest.java| 134 +++ .../core/mgmt/rebind/enricher-abcdefghij| 25 ...ityspec-containing-empty-policies-wj5s8u9h73 | 49 +++ ...th-entityspec-containing-policies-aeifj99fjd | 53 .../brooklyn/core/mgmt/rebind/policy-awmsgjxp8i | 25 7 files changed, 319 insertions(+), 3 deletions(-) --
[3/3] brooklyn-server git commit: This closes #876
This closes #876 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/aa43a5fe Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/aa43a5fe Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/aa43a5fe Branch: refs/heads/master Commit: aa43a5feb0ae331174a8292712c9ae5358772bcf Parents: 48f0900 2d14f64 Author: Aled SageAuthored: Mon Nov 6 11:24:06 2017 + Committer: Aled Sage Committed: Mon Nov 6 11:24:06 2017 + -- .../brooklyn/entity/group/DynamicCluster.java | 19 +++ .../entity/group/DynamicClusterTest.java| 20 2 files changed, 31 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/aa43a5fe/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java --
[2/3] brooklyn-server git commit: Add test
Add test Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2d14f640 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2d14f640 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2d14f640 Branch: refs/heads/master Commit: 2d14f6406ad6fe60ff29ed50b527095426077df1 Parents: 09b9cda Author: Duncan GodwinAuthored: Fri Nov 3 14:01:38 2017 + Committer: Duncan Godwin Committed: Fri Nov 3 14:03:10 2017 + -- .../entity/group/DynamicClusterTest.java| 20 1 file changed, 20 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2d14f640/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java index 0827664..03a4a64 100644 --- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java +++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java @@ -171,6 +171,26 @@ public class DynamicClusterTest extends AbstractDynamicClusterOrFabricTest { } @Test +public void testMemberSpecNotInherited() throws Exception { +DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class) +.configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TestEntity.class))); +DynamicCluster child = cluster.addChild(EntitySpec.create(DynamicCluster.class)); +Asserts.assertNull(child.getConfig(DynamicCluster.MEMBER_SPEC)); +DynamicCluster memberChild = cluster.addMemberChild(EntitySpec.create(DynamicCluster.class)); +Asserts.assertNull(memberChild.getConfig(DynamicCluster.MEMBER_SPEC)); +} + +@Test +public void testFirstMemberSpecNotInherited() throws Exception { +DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class) +.configure(DynamicCluster.FIRST_MEMBER_SPEC, EntitySpec.create(TestEntity.class))); +DynamicCluster child = cluster.addChild(EntitySpec.create(DynamicCluster.class)); +Asserts.assertNull(child.getConfig(DynamicCluster.FIRST_MEMBER_SPEC)); +DynamicCluster memberChild = cluster.addMemberChild(EntitySpec.create(DynamicCluster.class)); + Asserts.assertNull(memberChild.getConfig(DynamicCluster.FIRST_MEMBER_SPEC)); +} + +@Test public void testClusterHasOneLocationAfterStarting() throws Exception { DynamicCluster cluster = app.createAndManageChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TestEntity.class)));
[1/3] brooklyn-server git commit: Stop memberSpecs being inherited
Repository: brooklyn-server Updated Branches: refs/heads/master 48f090071 -> aa43a5feb Stop memberSpecs being inherited Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/09b9cda3 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/09b9cda3 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/09b9cda3 Branch: refs/heads/master Commit: 09b9cda37f92a62216ac69ac6c30b178e522a104 Parents: 84e9e19 Author: Duncan GodwinAuthored: Fri Nov 3 11:46:18 2017 + Committer: Duncan Godwin Committed: Fri Nov 3 11:48:01 2017 + -- .../brooklyn/entity/group/DynamicCluster.java| 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/09b9cda3/core/src/main/java/org/apache/brooklyn/entity/group/DynamicCluster.java -- diff --git a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicCluster.java b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicCluster.java index 2be07b0..417a014 100644 --- a/core/src/main/java/org/apache/brooklyn/entity/group/DynamicCluster.java +++ b/core/src/main/java/org/apache/brooklyn/entity/group/DynamicCluster.java @@ -35,6 +35,7 @@ import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.annotation.Effector; import org.apache.brooklyn.core.annotation.EffectorParam; +import org.apache.brooklyn.core.config.BasicConfigInheritance; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.effector.MethodEffector; import org.apache.brooklyn.core.entity.Attributes; @@ -138,16 +139,18 @@ public interface DynamicCluster extends AbstractGroup, Cluster, MemberReplaceabl @CatalogConfig(label = "Member spec") @SetFromFlag("memberSpec") -ConfigKey MEMBER_SPEC = ConfigKeys.newConfigKey( -new TypeToken () { }, -"dynamiccluster.memberspec", "entity spec for creating new cluster members", null); +ConfigKey MEMBER_SPEC = ConfigKeys.builder(new TypeToken (){}, "dynamiccluster.memberspec") +.description("entity spec for creating new cluster members") +.defaultValue(null) +.runtimeInheritance(BasicConfigInheritance.NOT_REINHERITED) +.build(); @SetFromFlag("firstMemberSpec") -ConfigKey FIRST_MEMBER_SPEC = ConfigKeys.newConfigKey( -new TypeToken () { }, -"dynamiccluster.firstmemberspec", -"entity spec for creating the first member of the cluster (if unset, will use the member spec for all)", -null); +ConfigKey FIRST_MEMBER_SPEC = ConfigKeys.builder(new TypeToken (){}, "dynamiccluster.firstmemberspec") +.description("entity spec for creating the first member of the cluster (if unset, will use the member spec for all)") +.defaultValue(null) +.runtimeInheritance(BasicConfigInheritance.NOT_REINHERITED) +.build(); @SetFromFlag("removalStrategy") ConfigKey > REMOVAL_STRATEGY = ConfigKeys.newConfigKey(
[1/2] brooklyn-server git commit: Revert "Retrieve the right AWS metadata for private hostname"
Repository: brooklyn-server Updated Branches: refs/heads/master e73ee2912 -> 5eb08b262 Revert "Retrieve the right AWS metadata for private hostname" This reverts commit 8877368aa4c04e21eecd167538f878c4e0681900. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2fb23337 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2fb23337 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2fb23337 Branch: refs/heads/master Commit: 2fb23337d48611a5cf9deb061cbd29f7b7137718 Parents: e73ee29 Author: graeme.millerAuthored: Fri Oct 27 13:18:57 2017 +0100 Committer: graeme.miller Committed: Fri Oct 27 13:18:57 2017 +0100 -- .../brooklyn/location/jclouds/JcloudsLocation.java | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2fb23337/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java -- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java index 39ccc52..80e289a 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java @@ -2827,11 +2827,16 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im return getPublicHostname(node, sshHostAndPort, userCredentials, setup); } -// NodeMetadata.getHostname() is supposed to return the private hostname. If it's not null, we want to prioritise -// this, otherwise we call getPrivateHostnameGeneric() -final String hostname = node.getHostname(); -if (hostname != null) { -return hostname; +String provider = (setup != null) ? setup.get(CLOUD_PROVIDER) : null; +Boolean lookupAwsHostname = (setup != null) ? setup.get(LOOKUP_AWS_HOSTNAME) : null; +if (provider == null) provider = getProvider(); + +// TODO Discouraged to do cloud-specific things; think of this code for aws as an +// exceptional situation rather than a pattern to follow. We need a better way to +// do cloud-specific things. +if ("aws-ec2".equals(provider) && Boolean.TRUE.equals(lookupAwsHostname)) { +Maybe result = getHostnameAws(node, sshHostAndPort, userCredentials, setup); +if (result.isPresent()) return result.get(); } Optional preferredAddress = sshHostAndPort.isPresent() ? Optional.of(sshHostAndPort.get().getHostText()) : Optional.absent();
[2/2] brooklyn-server git commit: This closes #871
This closes #871 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/5eb08b26 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/5eb08b26 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/5eb08b26 Branch: refs/heads/master Commit: 5eb08b26253b2249fec2c3df279a8b391177b1e3 Parents: e73ee29 2fb2333 Author: Aled SageAuthored: Fri Oct 27 13:37:00 2017 +0100 Committer: Aled Sage Committed: Fri Oct 27 13:37:00 2017 +0100 -- .../brooklyn/location/jclouds/JcloudsLocation.java | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) --
[1/9] brooklyn-server git commit: WIP - allow types from different bundles if equivalent
Repository: brooklyn-server Updated Branches: refs/heads/master 9045005dd -> e73ee2912 WIP - allow types from different bundles if equivalent previously this was only allowed if older bundle was a wrapper, or if it was forced; this could cause problems if such a disallowed addition was forced and then you tried to rebind! now it stores the bundle from which a registered type comes, so we can sensibly have several types. we could even allow them to be different - which would of course cause chaos for users, but if we allow multi-tenant catalogs it will be essential (we simply have to filter for visible types when looking at the registry, and prevent bundle name collisions - eg by prefixing with tenant) though for now we don't allow them to be different. needs testing and test cases still Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c380e6be Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c380e6be Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c380e6be Branch: refs/heads/master Commit: c380e6becf3100311620f569fd77b2f1facbc4a0 Parents: 05d6ee0 Author: Alex HeneveldAuthored: Tue Oct 24 17:38:43 2017 +0100 Committer: Alex Heneveld Committed: Tue Oct 24 17:38:43 2017 +0100 -- .../core/mgmt/ha/OsgiArchiveInstaller.java | 1 + .../core/typereg/BasicBrooklynTypeRegistry.java | 144 +-- .../core/typereg/BasicRegisteredType.java | 4 +- 3 files changed, 101 insertions(+), 48 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c380e6be/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java index f4c2a10..0351838 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java @@ -377,6 +377,7 @@ class OsgiArchiveInstaller { } } if (canUpdate()) { + result.bundle = osgiManager.framework.getBundleContext().getBundle(result.getMetadata().getOsgiUniqueUrl()); if (result.getBundle()==null) { log.warn("Brooklyn thought is was already managing bundle "+result.getMetadata().getVersionedName()+" but it's not installed to framework; reinstalling it"); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c380e6be/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java index 565e3f0..6c14ecf 100644 --- a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java +++ b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java @@ -20,8 +20,10 @@ package org.apache.brooklyn.core.typereg; import java.util.Collection; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; +import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -37,8 +39,6 @@ import org.apache.brooklyn.api.typereg.RegisteredTypeLoadingContext; import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog; import org.apache.brooklyn.core.catalog.internal.CatalogItemBuilder; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; -import org.apache.brooklyn.core.mgmt.ha.OsgiManager; -import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.collections.MutableSet; @@ -62,7 +62,7 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry { private static final Logger log = LoggerFactory.getLogger(BasicBrooklynTypeRegistry.class); private ManagementContext mgmt; -private Map localRegisteredTypes = MutableMap.of(); +private Map > localRegisteredTypesAndContainingBundles = MutableMap.of(); public BasicBrooklynTypeRegistry(ManagementContext mgmt) { this.mgmt = mgmt; @@ -76,12 +76,14 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry {
[7/9] brooklyn-server git commit: duplicate types in different bundles should be returned by `getAll()`
duplicate types in different bundles should be returned by `getAll()` Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/081212f9 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/081212f9 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/081212f9 Branch: refs/heads/master Commit: 081212f9377eba37531166e8ef3ecda0c0a0e753 Parents: 856c1c9 Author: Alex HeneveldAuthored: Thu Oct 26 01:23:34 2017 +0100 Committer: Alex Heneveld Committed: Thu Oct 26 01:23:34 2017 +0100 -- .../core/typereg/BasicBrooklynTypeRegistry.java | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/081212f9/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java index 663e6a5..46d3400 100644 --- a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java +++ b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java @@ -115,14 +115,17 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry { @SuppressWarnings("deprecation") @Override public Iterable getMatching(Predicate filter) { -Map result = MutableMap.of(); +Set result = MutableSet.of(); +// keep name record also so we can remove legacy items that are superseded +Set typeNamesFound = MutableSet.of(); for (RegisteredType rt: getAllWithoutCatalog(filter)) { -result.put(rt.getId(), rt); +result.add(rt); +typeNamesFound.add(rt.getId()); } for (RegisteredType rt: Iterables.filter( Iterables.transform(mgmt.getCatalog().getCatalogItemsLegacy(), RegisteredTypes.CI_TO_RT), filter)) { -if (!result.containsKey(rt.getId())) { +if (!typeNamesFound.contains(rt.getId())) { // TODO ideally never come here, however // legacy cataog currently still used for java-scanned annotations; // hopefully that will be deprecated and removed in near future @@ -131,10 +134,11 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry { // make TypeRegistry instances instead of CatalogItem, esp if we had YOML to write that plan) //log.warn("Item '"+rt.getId()+"' not in type registry; only found in legacy catalog"); -result.put(rt.getId(), rt); +typeNamesFound.add(rt.getId()); +result.add(rt); } } -return result.values(); +return result; } @SuppressWarnings("deprecation")
[9/9] brooklyn-server git commit: This closes #868
This closes #868 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/e73ee291 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/e73ee291 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/e73ee291 Branch: refs/heads/master Commit: e73ee291203aec7b9212731c9e2ee9c25b512069 Parents: 9045005 ed498fd Author: Aled SageAuthored: Fri Oct 27 12:25:54 2017 +0100 Committer: Aled Sage Committed: Fri Oct 27 12:25:54 2017 +0100 -- .../CatalogOsgiVersionMoreEntityTest.java | 8 +- .../catalog/internal/BasicBrooklynCatalog.java | 25 ++- .../catalog/internal/CatalogBundleLoader.java | 9 +- .../core/mgmt/ha/OsgiArchiveInstaller.java | 1 + .../core/typereg/BasicBrooklynTypeRegistry.java | 221 ++- .../core/typereg/BasicRegisteredType.java | 4 +- .../brooklyn/util/osgi/VersionedName.java | 16 ++ .../brooklyn/util/osgi/VersionedNameTest.java | 28 +++ 8 files changed, 240 insertions(+), 72 deletions(-) --
[2/9] brooklyn-server git commit: fix type registry access synchronization and tweak minor load semantics
fix type registry access synchronization and tweak minor load semantics synchronization pointed out in PR, fixed. also changed one bug, and it shares code with synch fixes so done here; the bug is: until recently, if the same type were added from multiple bundles only the last one were kept. on rebind the "last one added" might be different, so there was inconsistency. previous commit means we keep all of them, and take the _first_ one added, and while we could change it to have the same semantics (last one) it seems better to resolve the rebind inconsistency, so now it takes from the "best" bundle, which is the first alpha and preferring highest version. use predictable resolution when multiple instances found Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/54dcb0c6 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/54dcb0c6 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/54dcb0c6 Branch: refs/heads/master Commit: 54dcb0c641026039767a033f204bff4fd521f1d5 Parents: c380e6b Author: Alex HeneveldAuthored: Wed Oct 25 14:10:59 2017 +0100 Committer: Alex Heneveld Committed: Wed Oct 25 14:10:59 2017 +0100 -- .../CatalogOsgiVersionMoreEntityTest.java | 8 +- .../catalog/internal/BasicBrooklynCatalog.java | 9 +- .../core/typereg/BasicBrooklynTypeRegistry.java | 155 +++ .../brooklyn/util/osgi/VersionedName.java | 16 ++ .../brooklyn/util/osgi/VersionedNameTest.java | 28 5 files changed, 142 insertions(+), 74 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/54dcb0c6/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java index e1e4b55..241a658 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java @@ -151,8 +151,8 @@ public class CatalogOsgiVersionMoreEntityTest extends AbstractYamlTest implement } @Test -/** TODO this test works if we assume most recent version wins, but semantics TBC */ -public void testMoreEntityV2ThenV1GivesV1() throws Exception { +/** Now assumes highest version wins regardless of install order */ +public void testMoreEntityV1AndV2GivesV2() throws Exception { TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar"); TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar"); TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar"); @@ -163,8 +163,8 @@ public class CatalogOsgiVersionMoreEntityTest extends AbstractYamlTest implement Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]"); Entity moreEntity = Iterables.getOnlyElement(app.getChildren()); -OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntity); -OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntity); +OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity); +OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity); } /** unlike {@link #testMoreEntityV2ThenV1GivesV1()} this test should always work, http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/54dcb0c6/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java index 8dd361b..10880c0 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java @@ -950,8 +950,13 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { } if (version==null) { -// use this as default version when nothing specified -version =
[6/9] brooklyn-server git commit: fix discrepancy message
fix discrepancy message just compare names. the "kind" can switch from "unresolved" but the result won't be updated. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/856c1c96 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/856c1c96 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/856c1c96 Branch: refs/heads/master Commit: 856c1c96663f32e6b799f6b187ed3cfda511c10c Parents: d179585 Author: Alex HeneveldAuthored: Wed Oct 25 17:29:07 2017 +0100 Committer: Alex Heneveld Committed: Wed Oct 25 17:29:07 2017 +0100 -- .../brooklyn/core/catalog/internal/CatalogBundleLoader.java | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/856c1c96/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java index be9abba..c57808c 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogBundleLoader.java @@ -25,6 +25,7 @@ import java.net.URL; import java.util.Collection; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import org.apache.brooklyn.api.catalog.CatalogItem; import org.apache.brooklyn.api.mgmt.ManagementContext; @@ -103,11 +104,13 @@ public class CatalogBundleLoader { this.managementContext.getCatalog().addTypesFromBundleBom(bomText, mb, force, result.mapOfNewToReplaced); if (validate) { Set matches = MutableSet.copyOf(this.managementContext.getTypeRegistry().getMatching(RegisteredTypePredicates.containingBundle(mb.getVersionedName(; -if (!(matches.containsAll(result.mapOfNewToReplaced.keySet()) && result.mapOfNewToReplaced.keySet().containsAll(matches))) { +Set resultNames = result.mapOfNewToReplaced.keySet().stream().map((type) -> type.getId()).collect(Collectors.toSet()); +Set matchesNames = matches.stream().map((type) -> type.getId()).collect(Collectors.toSet()); +if (!(matchesNames.containsAll(resultNames) && resultNames.containsAll(matchesNames))) { // sanity check LOG.warn("Discrepancy in list of Brooklyn items found for "+mb.getVersionedName()+": "+ -"installer said "+result.mapOfNewToReplaced.keySet()+" ("+result.mapOfNewToReplaced.keySet().size()+") "+ -"but registry search found "+matches+" ("+matches.size()+")"); +"installer gave "+result+" (of "+result.mapOfNewToReplaced.keySet().size()+" total installed), "+ +"but registry search gave "+matches+" (from "+matches.size()+" total found for this bundle)"); } Map validationErrors = this.managementContext.getCatalog().validateTypes( matches ); if (!validationErrors.isEmpty()) {
[8/9] brooklyn-server git commit: tidy OsgiManager passed in internal code
tidy OsgiManager passed in internal code Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ed498fd0 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ed498fd0 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ed498fd0 Branch: refs/heads/master Commit: ed498fd06db921c403be261172ee00de1ef6ae90 Parents: 081212f Author: Alex HeneveldAuthored: Fri Oct 27 10:23:53 2017 +0100 Committer: Alex Heneveld Committed: Fri Oct 27 10:23:53 2017 +0100 -- .../brooklyn/core/catalog/internal/BasicBrooklynCatalog.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ed498fd0/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java index a79fec6..810ffc1 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java @@ -1440,7 +1440,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { Maybe osgiManager = ((ManagementContextInternal)mgmt).getOsgiManager(); if (osgiManager.isPresent() && AUTO_WRAP_CATALOG_YAML_AS_BUNDLE) { // wrap in a bundle to be managed; need to get bundle and version from yaml -OsgiBundleInstallationResult result = addItemsOsgi(yaml, forceUpdate, osgiManager); +OsgiBundleInstallationResult result = addItemsOsgi(yaml, forceUpdate, osgiManager.get()); return toLegacyCatalogItems(result.getTypesInstalled()); // if all items pertaining to an older anonymous catalog.bom bundle have been overridden @@ -1457,7 +1457,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { Maybe osgiManager = ((ManagementContextInternal)mgmt).getOsgiManager(); if (osgiManager.isPresent() && AUTO_WRAP_CATALOG_YAML_AS_BUNDLE) { // wrap in a bundle to be managed; need to get bundle and version from yaml -return addItemsOsgi(yaml, forceUpdate, osgiManager); +return addItemsOsgi(yaml, forceUpdate, osgiManager.get()); // if all items pertaining to an older anonymous catalog.bom bundle have been overridden // we delete those later; see list of wrapper bundles kept in OsgiManager @@ -1472,7 +1472,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { return result; } -protected OsgiBundleInstallationResult addItemsOsgi(String yaml, boolean forceUpdate, Maybe osgiManager) { +protected OsgiBundleInstallationResult addItemsOsgi(String yaml, boolean forceUpdate, OsgiManager osgiManager) { Map cm = BasicBrooklynCatalog.getCatalogMetadata(yaml); if(cm == null) { @@ -1503,7 +1503,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { OsgiBundleInstallationResult result = null; try { -result = osgiManager.get().install(new BasicManagedBundle(vn.getSymbolicName(), vn.getVersionString(), null), new FileInputStream(bf), true, true, forceUpdate).get(); +result = osgiManager.install(new BasicManagedBundle(vn.getSymbolicName(), vn.getVersionString(), null), new FileInputStream(bf), true, true, forceUpdate).get(); } catch (FileNotFoundException e) { throw Exceptions.propagate(e); } finally {
[5/9] brooklyn-server git commit: pass known version metadata in so we get the user's version, not the osgified version
pass known version metadata in so we get the user's version, not the osgified version Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d1795856 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d1795856 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d1795856 Branch: refs/heads/master Commit: d1795856f0776df6aace712dd5df613115f19b65 Parents: 7b45a56 Author: Alex HeneveldAuthored: Wed Oct 25 17:07:23 2017 +0100 Committer: Alex Heneveld Committed: Wed Oct 25 17:07:23 2017 +0100 -- .../brooklyn/core/catalog/internal/BasicBrooklynCatalog.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d1795856/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java index 74ee09e..a79fec6 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java @@ -62,6 +62,7 @@ import org.apache.brooklyn.core.mgmt.ha.OsgiManager; import org.apache.brooklyn.core.mgmt.internal.CampYamlParser; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.core.typereg.BasicBrooklynTypeRegistry; +import org.apache.brooklyn.core.typereg.BasicManagedBundle; import org.apache.brooklyn.core.typereg.BasicRegisteredType; import org.apache.brooklyn.core.typereg.BasicTypeImplementationPlan; import org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer; @@ -1502,7 +1503,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { OsgiBundleInstallationResult result = null; try { -result = osgiManager.get().install(null, new FileInputStream(bf), true, true, forceUpdate).get(); +result = osgiManager.get().install(new BasicManagedBundle(vn.getSymbolicName(), vn.getVersionString(), null), new FileInputStream(bf), true, true, forceUpdate).get(); } catch (FileNotFoundException e) { throw Exceptions.propagate(e); } finally {
[3/9] brooklyn-server git commit: weaken the "types being replaced must come from the same bundle" to support anonymous bundles
weaken the "types being replaced must come from the same bundle" to support anonymous bundles this is when user uploads a catalog.bom without any bundle identification. if they do it again, and the things are snapshot, they should be allowed to replace, even though bundle names are different. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0801cb1e Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0801cb1e Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0801cb1e Branch: refs/heads/master Commit: 0801cb1e07bf6535a492dff783b8fc767de2ed15 Parents: 54dcb0c Author: Alex HeneveldAuthored: Wed Oct 25 16:27:46 2017 +0100 Committer: Alex Heneveld Committed: Wed Oct 25 16:27:46 2017 +0100 -- .../catalog/internal/BasicBrooklynCatalog.java | 7 +++- .../core/typereg/BasicBrooklynTypeRegistry.java | 35 ++-- 2 files changed, 38 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0801cb1e/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java index 10880c0..74ee09e 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java @@ -1041,7 +1041,12 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { // (originally seen during a race where the empty-remover ran while we were installing) throw new IllegalStateException("Loading from a bundle which is not installed"); } -String wrapped = bb.get().getHeaders().get(BROOKLYN_WRAPPED_BOM_BUNDLE); +return isWrapperBundle(bb.get()); +} + +@Beta +public static boolean isWrapperBundle(Bundle b) { +String wrapped = b.getHeaders().get(BROOKLYN_WRAPPED_BOM_BUNDLE); return wrapped!=null && wrapped.equalsIgnoreCase("true"); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0801cb1e/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java index 7dc98fd..a5e781b 100644 --- a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java +++ b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java @@ -41,6 +41,8 @@ import org.apache.brooklyn.api.typereg.RegisteredTypeLoadingContext; import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog; import org.apache.brooklyn.core.catalog.internal.CatalogItemBuilder; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; +import org.apache.brooklyn.core.mgmt.ha.OsgiManager; +import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.collections.MutableSet; @@ -52,6 +54,7 @@ import org.apache.brooklyn.util.osgi.VersionedName.VersionedNameStringComparator import org.apache.brooklyn.util.text.BrooklynVersionSyntax; import org.apache.brooklyn.util.text.Identifiers; import org.apache.brooklyn.util.text.Strings; +import org.osgi.framework.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -400,10 +403,19 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry { localRegisteredTypesAndContainingBundles.put(type.getId(), knownMatchingTypesByBundles); } +Set oldContainingBundlesToRemove = MutableSet.of(); for (RegisteredType existingT: knownMatchingTypesByBundles.values()) { String reasonForDetailedCheck = null; -if (Objects.equals(existingT.getContainingBundle(), type.getContainingBundle())) { -// they are in the same bundle; is force replacement allowed? +boolean sameBundle = Objects.equals(existingT.getContainingBundle(), type.getContainingBundle()); +boolean oldIsWrapperBundle = isWrapperBundle(existingT.getContainingBundle()); +if (sameBundle || oldIsWrapperBundle) { +
[4/9] brooklyn-server git commit: fix inconsistency when type definitions come from anonymous BOMs vs named-bundles
fix inconsistency when type definitions come from anonymous BOMs vs named-bundles Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/7b45a567 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/7b45a567 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/7b45a567 Branch: refs/heads/master Commit: 7b45a56704f24df72a45c0915ac5d2a5f9d41aae Parents: 0801cb1 Author: Alex HeneveldAuthored: Wed Oct 25 16:59:40 2017 +0100 Committer: Alex Heneveld Committed: Wed Oct 25 16:59:40 2017 +0100 -- .../brooklyn/core/typereg/BasicBrooklynTypeRegistry.java | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7b45a567/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java index a5e781b..663e6a5 100644 --- a/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java +++ b/core/src/main/java/org/apache/brooklyn/core/typereg/BasicBrooklynTypeRegistry.java @@ -404,11 +404,12 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry { } Set oldContainingBundlesToRemove = MutableSet.of(); +boolean newIsWrapperBundle = isWrapperBundle(type.getContainingBundle()); for (RegisteredType existingT: knownMatchingTypesByBundles.values()) { String reasonForDetailedCheck = null; boolean sameBundle = Objects.equals(existingT.getContainingBundle(), type.getContainingBundle()); boolean oldIsWrapperBundle = isWrapperBundle(existingT.getContainingBundle()); -if (sameBundle || oldIsWrapperBundle) { +if (sameBundle || (oldIsWrapperBundle && newIsWrapperBundle)) { // allow replacement (different plan for same type) if either // it's the same bundle or the old one was a wrapper, AND // either we're forced or in snapshot-land @@ -435,6 +436,10 @@ public class BasicBrooklynTypeRegistry implements BrooklynTypeRegistry { } else { reasonForDetailedCheck = "the type is not a SNAPSHOT and addition is not forced"; } +} else if (oldIsWrapperBundle) { +reasonForDetailedCheck = type.getId()+" is in a named bundle replacing an item from an anonymous bundle-wrapped BOM, so definitions must be the same (or else give it a different version)"; +} else if (newIsWrapperBundle) { +reasonForDetailedCheck = type.getId()+" is in an anonymous bundle-wrapped BOM replacing an item from a named bundle, so definitions must be the same (or else give it a different version)"; } else { reasonForDetailedCheck = type.getId()+" is defined in different bundle"; }
[2/2] brooklyn-server git commit: This closes #858
This closes #858 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/7c317388 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/7c317388 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/7c317388 Branch: refs/heads/master Commit: 7c317388fa0a933d2b0afc06d04dba2d9b9a4673 Parents: 464ed22 09b25fe Author: Aled SageAuthored: Mon Oct 9 12:50:47 2017 +0100 Committer: Aled Sage Committed: Mon Oct 9 12:50:47 2017 +0100 -- ...rFromStackOfBrooklynClassLoadingContext.java | 3 --- ...mStackOfBrooklynClassLoadingContextTest.java | 1 - .../brooklyn-test-osgi-com-example-entities.jar | Bin 22099 -> 22115 bytes .../osgi/brooklyn-test-osgi-entities.jar| Bin 22864 -> 22878 bytes .../brooklyn-test-osgi-more-entities_0.1.0.jar | Bin 15967 -> 15983 bytes .../brooklyn-test-osgi-more-entities_0.2.0.jar | Bin 16884 -> 16893 bytes ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 14061 -> 14077 bytes 7 files changed, 4 deletions(-) --
[1/2] brooklyn-server git commit: Fixes broken ClassLoaderFromStackOfBrooklynClassLoadingContextTest.testLoadClassFromBundle test
Repository: brooklyn-server Updated Branches: refs/heads/master 464ed227e -> 7c317388f Fixes broken ClassLoaderFromStackOfBrooklynClassLoadingContextTest.testLoadClassFromBundle test Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/09b25fea Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/09b25fea Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/09b25fea Branch: refs/heads/master Commit: 09b25fea0459e8c9346aa910094418c294d581cb Parents: 464ed22 Author: Martin HarrisAuthored: Mon Oct 9 11:39:00 2017 +0100 Committer: Martin Harris Committed: Mon Oct 9 11:39:00 2017 +0100 -- ...rFromStackOfBrooklynClassLoadingContext.java | 3 --- ...mStackOfBrooklynClassLoadingContextTest.java | 1 - .../brooklyn-test-osgi-com-example-entities.jar | Bin 22099 -> 22115 bytes .../osgi/brooklyn-test-osgi-entities.jar| Bin 22864 -> 22878 bytes .../brooklyn-test-osgi-more-entities_0.1.0.jar | Bin 15967 -> 15983 bytes .../brooklyn-test-osgi-more-entities_0.2.0.jar | Bin 16884 -> 16893 bytes ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 14061 -> 14077 bytes 7 files changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/09b25fea/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContext.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContext.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContext.java index b4a3675..e7a7de4 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContext.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContext.java @@ -25,9 +25,6 @@ import java.util.concurrent.atomic.AtomicReference; import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.api.mgmt.classloading.BrooklynClassLoadingContext; -import org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContextSequential; -import org.apache.brooklyn.core.mgmt.classloading.ClassLoaderFromBrooklynClassLoadingContext; -import org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext; import org.apache.brooklyn.util.core.ClassLoaderUtils; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.javalang.ClassLoadingContext; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/09b25fea/core/src/test/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContextTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContextTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContextTest.java index a2237af..036aabc 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContextTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/classloading/ClassLoaderFromStackOfBrooklynClassLoadingContextTest.java @@ -24,7 +24,6 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.core.entity.AbstractEntity; import org.apache.brooklyn.core.entity.Entities; -import org.apache.brooklyn.core.mgmt.classloading.ClassLoaderFromStackOfBrooklynClassLoadingContext; import org.apache.brooklyn.core.mgmt.ha.OsgiManager; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/09b25fea/utils/common/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-com-example-entities.jar -- diff --git a/utils/common/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-com-example-entities.jar b/utils/common/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-com-example-entities.jar index 44f5273..3caa879 100644 Binary files a/utils/common/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-com-example-entities.jar and b/utils/common/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-com-example-entities.jar differ
[3/3] brooklyn-server git commit: This closes #832
This closes #832 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/1dcd797a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/1dcd797a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/1dcd797a Branch: refs/heads/master Commit: 1dcd797abe7812fba196635ee5f80d08b7cf3dd5 Parents: ef20daa 1883380 Author: Aled SageAuthored: Wed Sep 27 21:03:52 2017 +0100 Committer: Aled Sage Committed: Wed Sep 27 21:03:52 2017 +0100 -- .../mgmt/ha/HighAvailabilityManagerImpl.java| 45 +++-- .../internal/AbstractManagementContext.java | 5 +- .../core/mgmt/internal/LocalUsageManager.java | 31 +--- .../ManagementNodeStateListenerManager.java | 175 +++ .../mgmt/usage/ManagementNodeStateListener.java | 53 ++ .../core/server/BrooklynServerConfig.java | 20 +++ .../brooklyn/util/core/flags/TypeCoercions.java | 21 +++ .../ha/HighAvailabilityManagerInMemoryTest.java | 5 - .../ha/HighAvailabilityManagerTestFixture.java | 61 ++- .../usage/ManagementNodeStateListenerTest.java | 160 + .../util/core/internal/TypeCoercionsTest.java | 31 ...ailabilityManagerJcloudsObjectStoreTest.java | 7 +- 12 files changed, 560 insertions(+), 54 deletions(-) --
[1/3] brooklyn-server git commit: Adds ManagementNodeStateListener support
Repository: brooklyn-server Updated Branches: refs/heads/master ef20daaac -> 1dcd797ab Adds ManagementNodeStateListener support Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/1883380a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/1883380a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/1883380a Branch: refs/heads/master Commit: 1883380a87c793cb006586698768449b6702e0cd Parents: 854c351 Author: Aled SageAuthored: Tue Sep 19 15:21:58 2017 +0100 Committer: Aled Sage Committed: Thu Sep 21 09:09:34 2017 +0100 -- .../mgmt/ha/HighAvailabilityManagerImpl.java| 45 +++-- .../internal/AbstractManagementContext.java | 5 +- .../ManagementNodeStateListenerManager.java | 175 +++ .../mgmt/usage/ManagementNodeStateListener.java | 53 ++ .../core/server/BrooklynServerConfig.java | 20 +++ .../ha/HighAvailabilityManagerInMemoryTest.java | 5 - .../ha/HighAvailabilityManagerTestFixture.java | 61 ++- .../usage/ManagementNodeStateListenerTest.java | 160 + ...ailabilityManagerJcloudsObjectStoreTest.java | 7 +- 9 files changed, 502 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1883380a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java index a4f8870..4d5a2ee 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java @@ -39,8 +39,8 @@ import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord; import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecord; import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister; -import org.apache.brooklyn.api.mgmt.ha.MementoCopyMode; import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister.Delta; +import org.apache.brooklyn.api.mgmt.ha.MementoCopyMode; import org.apache.brooklyn.api.mgmt.rebind.RebindManager; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.BrooklynFeatureEnablement; @@ -61,9 +61,10 @@ import org.apache.brooklyn.core.mgmt.internal.LocationManagerInternal; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.core.mgmt.internal.ManagementTransitionMode; import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils; -import org.apache.brooklyn.core.mgmt.persist.PersistenceActivityMetrics; import org.apache.brooklyn.core.mgmt.persist.BrooklynPersistenceUtils.CreateBackupMode; +import org.apache.brooklyn.core.mgmt.persist.PersistenceActivityMetrics; import org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl; +import org.apache.brooklyn.core.mgmt.usage.ManagementNodeStateListener; import org.apache.brooklyn.core.server.BrooklynServerConfig; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; @@ -129,6 +130,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager { private static final Logger LOG = LoggerFactory.getLogger(HighAvailabilityManagerImpl.class); private final ManagementContextInternal managementContext; +private final ManagementNodeStateListener stateListener; private final String ownNodeId; private volatile ManagementPlaneSyncRecordPersister persister; private volatile PromotionListener promotionListener; @@ -161,8 +163,15 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager { private volatile PersistenceActivityMetrics managementStateReadPersistenceMetrics = new PersistenceActivityMetrics(); private final long startTimeUtc; -public HighAvailabilityManagerImpl(ManagementContextInternal managementContext) { +/** + * + * @param managementContext + * @param stateListener The listener to be notified when the (publicised) {@link ManagementNodeState} + * changes, as would be advertised by {@link #getNodeState()} + */ +public HighAvailabilityManagerImpl(ManagementContextInternal managementContext, ManagementNodeStateListener stateListener) { this.managementContext = managementContext; +this.stateListener = stateListener; ownNodeId = managementContext.getManagementNodeId();
[2/2] brooklyn-server git commit: This closes #843
This closes #843 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b1baef3c Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b1baef3c Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b1baef3c Branch: refs/heads/master Commit: b1baef3c8f1ea28ac5095458ed0434a2192e4a52 Parents: df83d44 464d1d8 Author: Aled SageAuthored: Tue Sep 26 11:34:47 2017 +0100 Committer: Aled Sage Committed: Tue Sep 26 11:34:47 2017 +0100 -- .../brooklyn/core/catalog/internal/BasicBrooklynCatalog.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b1baef3c/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java --
[1/2] brooklyn-server git commit: Fix catalog YAML
Repository: brooklyn-server Updated Branches: refs/heads/master 2a63d8e57 -> 228f5655b Fix catalog YAML Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0d5b031f Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0d5b031f Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0d5b031f Branch: refs/heads/master Commit: 0d5b031fdf0cddda9d65741c2e4fc05a72485091 Parents: 2a63d8e Author: Duncan GodwinAuthored: Thu Sep 21 11:37:55 2017 +0100 Committer: Duncan Godwin Committed: Thu Sep 21 11:37:55 2017 +0100 -- karaf/init/src/main/resources/catalog-classes.bom | 12 ++-- policy/src/main/resources/catalog.bom | 8 test-framework/src/main/resources/catalog.bom | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0d5b031f/karaf/init/src/main/resources/catalog-classes.bom -- diff --git a/karaf/init/src/main/resources/catalog-classes.bom b/karaf/init/src/main/resources/catalog-classes.bom index d89d9c8..96afc8f 100644 --- a/karaf/init/src/main/resources/catalog-classes.bom +++ b/karaf/init/src/main/resources/catalog-classes.bom @@ -239,8 +239,8 @@ brooklyn.catalog: itemType: enricher item: type: org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher -name: [DEPRECATED] Rolling Mean in Time Window -description: [DEPRECATED] Prefer YamlRollingTimeWindowMeanEnricher +name: "[DEPRECATED] Rolling Mean in Time Window" +description: "[DEPRECATED] Prefer YamlRollingTimeWindowMeanEnricher" - id: org.apache.brooklyn.policy.enricher.TimeFractionDeltaEnricher itemType: enricher item: @@ -253,8 +253,8 @@ brooklyn.catalog: itemType: enricher item: type: org.apache.brooklyn.policy.enricher.TimeWeightedDeltaEnricher -name: [DEPRECATED] Time Weighted Delta -description: [DEPRECATED] prefer 'YamlTimeWeightedDeltaEnricher' +name: "[DEPRECATED] Time Weighted Delta" +description: "[DEPRECATED] prefer 'YamlTimeWeightedDeltaEnricher'" - id: org.apache.brooklyn.policy.ha.ServiceFailureDetector itemType: enricher item: @@ -332,8 +332,8 @@ brooklyn.catalog: - id: org.apache.brooklyn.test.framework.SimpleShellCommandTest item: type: org.apache.brooklyn.test.framework.SimpleShellCommandTest -name: [DEPRECATED] Simple Shell Command Test -description: [DEPRECATED] Instead use TestSshCommand +name: "[DEPRECATED] Simple Shell Command Test" +description: "[DEPRECATED] Instead use TestSshCommand" - id: org.apache.brooklyn.test.framework.ParallelTestCase item: type: org.apache.brooklyn.test.framework.ParallelTestCase http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0d5b031f/policy/src/main/resources/catalog.bom -- diff --git a/policy/src/main/resources/catalog.bom b/policy/src/main/resources/catalog.bom index f10a957..29747d1 100644 --- a/policy/src/main/resources/catalog.bom +++ b/policy/src/main/resources/catalog.bom @@ -101,8 +101,8 @@ brooklyn.catalog: - id: org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher item: type: org.apache.brooklyn.policy.enricher.RollingTimeWindowMeanEnricher -name: [DEPRECATED] Rolling Mean in Time Window -description: [DEPRECATED] Prefer YamlRollingTimeWindowMeanEnricher +name: "[DEPRECATED] Rolling Mean in Time Window" +description: "[DEPRECATED] Prefer YamlRollingTimeWindowMeanEnricher" - id: org.apache.brooklyn.policy.enricher.TimeFractionDeltaEnricher item: type: org.apache.brooklyn.policy.enricher.TimeFractionDeltaEnricher @@ -113,8 +113,8 @@ brooklyn.catalog: - id: org.apache.brooklyn.policy.enricher.TimeWeightedDeltaEnricher item: type: org.apache.brooklyn.policy.enricher.TimeWeightedDeltaEnricher -name: [DEPRECATED] Time Weighted Delta -description: [DEPRECATED] prefer 'YamlTimeWeightedDeltaEnricher' +name: "[DEPRECATED] Time Weighted Delta" +description: "[DEPRECATED] prefer 'YamlTimeWeightedDeltaEnricher'" - id: org.apache.brooklyn.policy.ha.ServiceFailureDetector item: type: org.apache.brooklyn.policy.ha.ServiceFailureDetector http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0d5b031f/test-framework/src/main/resources/catalog.bom -- diff --git
[2/2] brooklyn-server git commit: This closes #840
This closes #840 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/228f5655 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/228f5655 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/228f5655 Branch: refs/heads/master Commit: 228f5655b8756f072d9683af8c361ba035fb3aa6 Parents: 2a63d8e 0d5b031 Author: Aled SageAuthored: Thu Sep 21 13:02:27 2017 +0100 Committer: Aled Sage Committed: Thu Sep 21 13:02:27 2017 +0100 -- karaf/init/src/main/resources/catalog-classes.bom | 12 ++-- policy/src/main/resources/catalog.bom | 8 test-framework/src/main/resources/catalog.bom | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) --
[2/2] brooklyn-server git commit: This closes #837
This closes #837 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2a63d8e5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2a63d8e5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2a63d8e5 Branch: refs/heads/master Commit: 2a63d8e5762f790592eecfecb5b0d9e6da1199f3 Parents: a0e5edc 733554d Author: Aled SageAuthored: Thu Sep 21 09:08:19 2017 +0100 Committer: Aled Sage Committed: Thu Sep 21 09:08:19 2017 +0100 -- .../camp/brooklyn/FunctionSensorYamlTest.java | 38 ++-- .../core/sensor/function/FunctionSensor.java| 2 -- 2 files changed, 36 insertions(+), 4 deletions(-) --
[1/2] brooklyn-server git commit: Fix FunctionSensor’s rebind
Repository: brooklyn-server Updated Branches: refs/heads/master a0e5edcf6 -> 2a63d8e57 Fix FunctionSensorâs rebind It was trying to serialise the TypeCoercions function. We donât need that - it coerces automatically. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/733554db Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/733554db Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/733554db Branch: refs/heads/master Commit: 733554dbf3965de0f0be208c3b9d41173cb9abe2 Parents: a0e5edc Author: Aled SageAuthored: Wed Sep 20 23:12:48 2017 +0100 Committer: Aled Sage Committed: Wed Sep 20 23:12:48 2017 +0100 -- .../camp/brooklyn/FunctionSensorYamlTest.java | 38 ++-- .../core/sensor/function/FunctionSensor.java| 2 -- 2 files changed, 36 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/733554db/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java index 14402ec..ba6e669 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java @@ -38,7 +38,7 @@ public class FunctionSensorYamlTest extends AbstractYamlRebindTest { private static final Logger log = LoggerFactory.getLogger(FunctionSensorYamlTest.class); final static AttributeSensor SENSOR_STRING = Sensors.newStringSensor("aString"); -final static String TARGET_TYPE = "java.lang.String"; +final static AttributeSensor SENSOR_INT = Sensors.newIntegerSensor("anInt"); public static class MyCallable implements Callable { public static AtomicReference val = new AtomicReference<>(); @@ -62,7 +62,7 @@ public class FunctionSensorYamlTest extends AbstractYamlRebindTest { "brooklyn.config:", " "+FunctionSensor.SENSOR_PERIOD.getName()+": 100ms", " "+FunctionSensor.SENSOR_NAME.getName()+": " + SENSOR_STRING.getName(), -" "+FunctionSensor.SENSOR_TYPE.getName()+": " + TARGET_TYPE, +" "+FunctionSensor.SENSOR_TYPE.getName()+": String", " "+FunctionSensor.FUNCTION.getName()+":", "$brooklyn:object:", " type: "+MyCallable.class.getName()); @@ -82,6 +82,40 @@ public class FunctionSensorYamlTest extends AbstractYamlRebindTest { EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_STRING, "third"); } +@Test +public void testFunctionSensorCoerces() throws Exception { +MyCallable.val.set("1"); + +Entity app = createAndStartApplication( +"services:", +"- type: " + TestEntity.class.getName(), +" brooklyn.config:", +"onbox.base.dir.skipResolution: true", +" brooklyn.initializers:", +" - type: "+FunctionSensor.class.getName(), +"brooklyn.config:", +" "+FunctionSensor.SENSOR_PERIOD.getName()+": 100ms", +" "+FunctionSensor.SENSOR_NAME.getName()+": " + SENSOR_INT.getName(), +" "+FunctionSensor.SENSOR_TYPE.getName()+": int", +" "+FunctionSensor.FUNCTION.getName()+":", +"$brooklyn:object:", +" type: "+MyCallable.class.getName()); +waitForApplicationTasks(app); +Entity entity = Iterables.getOnlyElement(app.getChildren()); + +EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 1); + +MyCallable.val.set("1"); +EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_INT, 1); + +// Rebind, and confirm that it resumes polling +Application newApp = rebind(); +Entity newEntity = Iterables.getOnlyElement(newApp.getChildren()); + +MyCallable.val.set("3"); +EntityAsserts.assertAttributeEqualsEventually(newEntity, SENSOR_INT, 3); +} + @Override protected Logger getLogger() { return log; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/733554db/core/src/main/java/org/apache/brooklyn/core/sensor/function/FunctionSensor.java -- diff --git
[2/2] brooklyn-docs git commit: This closes #214
This closes #214 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/4ba464b0 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/4ba464b0 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/4ba464b0 Branch: refs/heads/master Commit: 4ba464b0fe97f0ba4986e6b25bab34f0685fc3af Parents: 5af77a7 646da10 Author: Aled SageAuthored: Wed Sep 20 11:55:11 2017 +0100 Committer: Aled Sage Committed: Wed Sep 20 11:55:11 2017 +0100 -- guide/blueprints/custom-entities.md | 142 ++- .../example_yaml/vanilla-bash-netcat-file.yaml | 3 + .../vanilla-bash-netcat-more-commands.yaml | 10 +- 3 files changed, 118 insertions(+), 37 deletions(-) --
[1/2] brooklyn-docs git commit: Document `sshMonitoring.enabled`
Repository: brooklyn-docs Updated Branches: refs/heads/master 5af77a7d1 -> 4ba464b0f Document `sshMonitoring.enabled` And some other tidies of custom-entities doc. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/646da104 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/646da104 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/646da104 Branch: refs/heads/master Commit: 646da104470f21091ecbef9b4333d925b11c1352 Parents: 5af77a7 Author: Aled SageAuthored: Tue Sep 19 20:52:13 2017 +0100 Committer: Aled Sage Committed: Wed Sep 20 11:54:08 2017 +0100 -- guide/blueprints/custom-entities.md | 142 ++- .../example_yaml/vanilla-bash-netcat-file.yaml | 3 + .../vanilla-bash-netcat-more-commands.yaml | 10 +- 3 files changed, 118 insertions(+), 37 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/646da104/guide/blueprints/custom-entities.md -- diff --git a/guide/blueprints/custom-entities.md b/guide/blueprints/custom-entities.md index 88d62ff..efd03ba 100644 --- a/guide/blueprints/custom-entities.md +++ b/guide/blueprints/custom-entities.md @@ -46,7 +46,7 @@ before running `launch.command` relative to where that file is installed (or unp with the default `launch.command` being `./start.sh`. So if we create a file `/tmp/netcat-server.tgz` containing just `start.sh` in the root -which consists of the two lines in the previous example, +which contains the line `echo hello | nc -l 4321`, we can instead write our example as: {% highlight yaml %} @@ -54,6 +54,41 @@ we can instead write our example as: {% endhighlight %} + Determining Successful Launch + +The default method used to determine a successful launch of `VanillaSoftwareProcess` is to run a +command over ssh to do a health check. The health check is done post-launch (repeating until it +succeeds, before then reporting that the entity has started). + +The default command used to carry out this health check will determine if the pid, written to +`$PID_FILE` is running. This is why we included in the entity's launch script the line +`echo $! > $PID_FILE`. + +You'll observe this if you connect to one of the netcat services (e.g. via `telnet localhost 4321`): +the `nc` process exits afterwards, causing Brooklyn to set the entity to an `ON_FIRE` state. +(You can also test this with a `killall nc`). + +There are other options for determining health: you can set `checkRunning.command` and `stop.command` instead, +as documented on the javadoc and config keys of the +{% include java_link.html class_name="VanillaSoftwareProcess" package_path="org/apache/brooklyn/entity/software/base" project_subpath="software/base" %} class, +and those scripts will be used instead of checking and stopping the process whose PID is in `$PID_FILE`. For example: + +{% highlight yaml %} +{% readj example_yaml/vanilla-bash-netcat-more-commands.yaml %} +{% endhighlight %} + + + Periodic Health Check + +After start-up is complete, the health check described above is also run periodically, defaulting +to every 5 seconds (configured with the config key `softwareProcess.serviceProcessIsRunningPollPeriod`). + +This ssh-based polling can be turned off by configuring `sshMonitoring.enabled: false`. However, if +no alternative health-check is defined then failure of the process would never be detected by Brooklyn. + +See [Health Check Sensors](#health-check-sensors) for alternative ways of detecting failures. + + Port Inferencing If you're deploying to a cloud machine, a firewall might block the port 4321. @@ -126,7 +161,7 @@ This gives us quite a bit more power in writing our blueprint: we'll show this in the next section - Using the Catalog and Clustering +### Using the Catalog and Clustering The *Catalog* tab allows you to add blueprints which you can refer to in other blueprints. In that tab, click *+* then *YAML*, and enter the following: @@ -166,30 +201,7 @@ before you have to restart it. You can also run `restart` on the cluster, and if you haven't yet experimented with `resize` on the cluster you might want to do that. - Determining Successful Launch - -One requirement of the launch script is that it store the process ID (PID) in the file -pointed to by `$PID_FILE`, hence the second line of the script. -This is because Brooklyn wants to monitor the services under management. -You'll observe this if you connect to one of the netcat services, -as the process exits afterwards and Brooklyn sets the entity to an `ON_FIRE` state. -(You can also test this with a `killall nc` before
[2/5] brooklyn-server git commit: EmptySoftwareProcessYamlTest: make unit test
EmptySoftwareProcessYamlTest: make unit test Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c5ba3816 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c5ba3816 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c5ba3816 Branch: refs/heads/master Commit: c5ba3816f0359773d0c0d8b85dc44d3506be1d78 Parents: 3ef6742 Author: Aled SageAuthored: Fri Sep 15 09:14:10 2017 +0100 Committer: Aled Sage Committed: Fri Sep 15 18:56:41 2017 +0100 -- .../brooklyn/EmptySoftwareProcessYamlTest.java | 94 +++- 1 file changed, 54 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c5ba3816/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java index 889985a..772a960 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EmptySoftwareProcessYamlTest.java @@ -18,37 +18,62 @@ */ package org.apache.brooklyn.camp.brooklyn; -import java.util.Iterator; +import static org.testng.Assert.assertEquals; + import java.util.Map; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.location.Location; +import org.apache.brooklyn.api.location.MachineLocation; +import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityAsserts; +import org.apache.brooklyn.core.location.Locations; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; import org.apache.brooklyn.location.ssh.SshMachineLocation; -import org.apache.brooklyn.util.collections.Jsonya; +import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; +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; @Test public class EmptySoftwareProcessYamlTest extends AbstractYamlTest { private static final Logger log = LoggerFactory.getLogger(EnrichersYamlTest.class); -@Test(groups="Integration") +@BeforeMethod(alwaysRun=true) +@Override +public void setUp() throws Exception { +super.setUp(); +RecordingSshTool.clear(); +} + +@AfterMethod(alwaysRun=true) +@Override +public void tearDown() throws Exception { +super.tearDown(); +RecordingSshTool.clear(); +} + +@Test public void testProvisioningProperties() throws Exception { Entity app = createAndStartApplication( -"location: localhost", +"location:", +" localhost:", +"sshToolClass: "+RecordingSshTool.class.getName(), +"myLocConfig: myval", "services:", "- type: "+EmptySoftwareProcess.class.getName(), -" provisioning.properties:", -"minRam: 16384"); +" brooklyn.config:", +"provisioning.properties:", +" minRam: 16384"); waitForApplicationTasks(app); log.info("App started:"); @@ -56,59 +81,46 @@ public class EmptySoftwareProcessYamlTest extends AbstractYamlTest { EmptySoftwareProcess entity = (EmptySoftwareProcess) app.getChildren().iterator().next(); Map pp = entity.getConfig(EmptySoftwareProcess.PROVISIONING_PROPERTIES); -Assert.assertEquals(pp.get("minRam"), 16384); -} - -@Test(groups="Integration") -public void testProvisioningPropertiesViaJsonya() throws Exception { -Entity app = createAndStartApplication( -Jsonya.newInstance() -.put("location", "localhost") -.at("services").list() -.put("type", EmptySoftwareProcess.class.getName()) -.at("provisioning.properties").put("minRam", 16384) -.root().toString()); -waitForApplicationTasks(app); - -log.info("App started:"); -Entities.dumpInfo(app); +assertEquals(pp.get("minRam"), 16384);
[5/5] brooklyn-server git commit: This closes #824
This closes #824 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d389e40d Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d389e40d Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d389e40d Branch: refs/heads/master Commit: d389e40d564fe4a1f16bf3bfcb31291535f8ecc4 Parents: 8c69a7d 509747f Author: Aled SageAuthored: Tue Sep 19 16:06:33 2017 +0100 Committer: Aled Sage Committed: Tue Sep 19 16:06:33 2017 +0100 -- .../camp/brooklyn/AbstractYamlTest.java | 31 +- .../brooklyn/EmptySoftwareProcessYamlTest.java | 94 +++--- .../camp/brooklyn/FunctionSensorYamlTest.java | 89 ++ .../VanillaSoftwareProcessYamlTest.java | 299 +++ .../core/sensor/function/FunctionSensor.java| 91 ++ .../entity/RecordingSensorEventListener.java| 12 + .../sensor/function/FunctionSensorTest.java | 77 + .../util/core/internal/ssh/ExecCmdAsserts.java | 12 +- .../software/base/EmptySoftwareProcessImpl.java | 4 +- .../software/base/VanillaSoftwareProcess.java | 6 + .../base/VanillaSoftwareProcessImpl.java| 16 +- 11 files changed, 679 insertions(+), 52 deletions(-) --
[4/5] brooklyn-server git commit: Add/test VanillaSoftwareProcess ‘sshMonitoring.enabled’
Add/test VanillaSoftwareProcess âsshMonitoring.enabledâ Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/509747f9 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/509747f9 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/509747f9 Branch: refs/heads/master Commit: 509747f95fa10a319549b9e2065f86119c0324cc Parents: d10282c Author: Aled SageAuthored: Fri Sep 15 09:29:28 2017 +0100 Committer: Aled Sage Committed: Fri Sep 15 18:58:57 2017 +0100 -- .../camp/brooklyn/AbstractYamlTest.java | 31 +- .../VanillaSoftwareProcessYamlTest.java | 299 +++ .../entity/RecordingSensorEventListener.java| 12 + .../util/core/internal/ssh/ExecCmdAsserts.java | 12 +- .../software/base/VanillaSoftwareProcess.java | 6 + .../base/VanillaSoftwareProcessImpl.java| 16 +- 6 files changed, 366 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/509747f9/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java index 6c269d2..3d4bbd2 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java @@ -27,6 +27,8 @@ import java.util.Map; import java.util.Set; import java.util.zip.ZipEntry; +import javax.annotation.Nullable; + import org.apache.brooklyn.api.catalog.BrooklynCatalog; import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; @@ -58,6 +60,7 @@ import org.apache.brooklyn.util.exceptions.ReferenceWithError; import org.apache.brooklyn.util.net.Urls; import org.apache.brooklyn.util.osgi.VersionedName; import org.apache.brooklyn.util.stream.Streams; +import org.apache.brooklyn.util.time.Duration; import org.osgi.framework.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -138,10 +141,15 @@ public abstract class AbstractYamlTest { } protected void waitForApplicationTasks(Entity app) { +waitForApplicationTasks(app, null); +} + +protected void waitForApplicationTasks(Entity app, @Nullable Duration timeout) { Set tasks = BrooklynTaskTags.getTasksInEntityContext(brooklynMgmt.getExecutionManager(), app); getLogger().info("Waiting on " + tasks.size() + " task(s)"); for (Task t : tasks) { -t.blockUntilEnded(); +boolean done = t.blockUntilEnded(timeout); +if (!done) throw new RuntimeException("Timeout waiting for task to complete: " + t); } } @@ -174,10 +182,7 @@ public abstract class AbstractYamlTest { return createAndStartApplication(input, MutableMap. of()); } protected Entity createAndStartApplication(String input, Map startParameters) throws Exception { -EntitySpec spec = - mgmt().getTypeRegistry().createSpecFromPlan(CampTypePlanTransformer.FORMAT, input, RegisteredTypeLoadingContexts.spec(Application.class), EntitySpec.class); -final Entity app = brooklynMgmt.getEntityManager().createEntity(spec); -// start the app (happens automatically if we use camp to instantiate, but not if we use crate spec approach) +final Entity app = createApplicationUnstarted(input); app.invoke(Startable.START, startParameters).get(); return app; } @@ -191,12 +196,22 @@ public abstract class AbstractYamlTest { } protected Entity createAndStartApplicationAsync(String yaml, Map startParameters) throws Exception { +final Entity app = createApplicationUnstarted(yaml); +// Not calling .get() on task, so this is non-blocking. +app.invoke(Startable.START, startParameters); +return app; +} + +protected Entity createApplicationUnstarted(String... multiLineYaml) throws Exception { +return createApplicationUnstarted(joinLines(multiLineYaml)); +} + +protected Entity createApplicationUnstarted(String yaml) throws Exception { +// not starting the app (would have happened automatically if we use camp to instantiate, +// but not if we use create spec approach). EntitySpec spec = mgmt().getTypeRegistry().createSpecFromPlan(CampTypePlanTransformer.FORMAT, yaml,
[3/5] brooklyn-server git commit: Adds FunctionSensor (for yaml FunctionFeed)
Adds FunctionSensor (for yaml FunctionFeed) Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/3ef6742d Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/3ef6742d Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/3ef6742d Branch: refs/heads/master Commit: 3ef6742d002a7be6ac5f483c339e7a3aa344d440 Parents: 001730b Author: Aled SageAuthored: Fri Sep 15 09:11:45 2017 +0100 Committer: Aled Sage Committed: Fri Sep 15 18:56:41 2017 +0100 -- .../camp/brooklyn/FunctionSensorYamlTest.java | 89 +++ .../core/sensor/function/FunctionSensor.java| 91 .../sensor/function/FunctionSensorTest.java | 77 + 3 files changed, 257 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3ef6742d/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java new file mode 100644 index 000..14402ec --- /dev/null +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/FunctionSensorYamlTest.java @@ -0,0 +1,89 @@ +/* + * 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.camp.brooklyn; + +import java.util.concurrent.Callable; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.brooklyn.api.entity.Application; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.sensor.AttributeSensor; +import org.apache.brooklyn.core.entity.EntityAsserts; +import org.apache.brooklyn.core.sensor.Sensors; +import org.apache.brooklyn.core.sensor.function.FunctionSensor; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.Test; + +import com.google.common.collect.Iterables; + +public class FunctionSensorYamlTest extends AbstractYamlRebindTest { +private static final Logger log = LoggerFactory.getLogger(FunctionSensorYamlTest.class); + +final static AttributeSensor SENSOR_STRING = Sensors.newStringSensor("aString"); +final static String TARGET_TYPE = "java.lang.String"; + +public static class MyCallable implements Callable { +public static AtomicReference val = new AtomicReference<>(); + +@Override public Object call() throws Exception { +return val.get(); +} +} + +@Test +public void testFunctionSensor() throws Exception { +MyCallable.val.set("first"); + +Entity app = createAndStartApplication( +"services:", +"- type: " + TestEntity.class.getName(), +" brooklyn.config:", +"onbox.base.dir.skipResolution: true", +" brooklyn.initializers:", +" - type: "+FunctionSensor.class.getName(), +"brooklyn.config:", +" "+FunctionSensor.SENSOR_PERIOD.getName()+": 100ms", +" "+FunctionSensor.SENSOR_NAME.getName()+": " + SENSOR_STRING.getName(), +" "+FunctionSensor.SENSOR_TYPE.getName()+": " + TARGET_TYPE, +" "+FunctionSensor.FUNCTION.getName()+":", +"$brooklyn:object:", +" type: "+MyCallable.class.getName()); +waitForApplicationTasks(app); +Entity entity = Iterables.getOnlyElement(app.getChildren()); + +EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_STRING, "first"); + +MyCallable.val.set("second"); +EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_STRING, "second"); + +// Rebind, and confirm that it resumes polling +Application newApp = rebind(); +
[1/5] brooklyn-server git commit: EmptySoftwareProcessImpl: improve setting of service.isRunning
Repository: brooklyn-server Updated Branches: refs/heads/master 8c69a7d99 -> d389e40d5 EmptySoftwareProcessImpl: improve setting of service.isRunning Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d10282cc Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d10282cc Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d10282cc Branch: refs/heads/master Commit: d10282cc037184b2819dccb8e819894a7cfd98c6 Parents: c5ba381 Author: Aled SageAuthored: Fri Sep 15 09:14:35 2017 +0100 Committer: Aled Sage Committed: Fri Sep 15 18:56:41 2017 +0100 -- .../brooklyn/entity/software/base/EmptySoftwareProcessImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d10282cc/software/base/src/main/java/org/apache/brooklyn/entity/software/base/EmptySoftwareProcessImpl.java -- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/EmptySoftwareProcessImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/EmptySoftwareProcessImpl.java index 7330461..2a8c721 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/EmptySoftwareProcessImpl.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/EmptySoftwareProcessImpl.java @@ -18,7 +18,7 @@ */ package org.apache.brooklyn.entity.software.base; -import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic.ServiceNotUpLogic; public class EmptySoftwareProcessImpl extends SoftwareProcessImpl implements EmptySoftwareProcess { @@ -33,7 +33,7 @@ public class EmptySoftwareProcessImpl extends SoftwareProcessImpl implements Emp if (isSshMonitoringEnabled()) { connectServiceUpIsRunning(); } else { -sensors().set(Attributes.SERVICE_UP, true); +ServiceNotUpLogic.clearNotUpIndicator(this, SERVICE_PROCESS_IS_RUNNING); } }
[2/2] brooklyn-server git commit: This closes #825
This closes #825 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/8c69a7d9 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/8c69a7d9 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/8c69a7d9 Branch: refs/heads/master Commit: 8c69a7d9920a4785c185bd8aa350d6f4315ffeb6 Parents: d5f9ae4 2cc9daf Author: Aled SageAuthored: Tue Sep 19 15:57:24 2017 +0100 Committer: Aled Sage Committed: Tue Sep 19 15:57:24 2017 +0100 -- .../policy/autoscaling/AutoScalerPolicy.java | 4 ++-- .../autoscaling/AutoScalerPolicyPoolSizeTest.java | 18 ++ 2 files changed, 16 insertions(+), 6 deletions(-) --
[1/2] brooklyn-server git commit: fix non-det failure in scaling down test
Repository: brooklyn-server Updated Branches: refs/heads/master d5f9ae48b -> 8c69a7d99 fix non-det failure in scaling down test ensuring that policy doesn't start before size reaches 6, and fix execution context bug found in autoscaler changing pool size Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2cc9dafb Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2cc9dafb Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2cc9dafb Branch: refs/heads/master Commit: 2cc9dafb5151dbf6ebbda2d209a78f77236e6962 Parents: c9f7b0d Author: Alex HeneveldAuthored: Sat Sep 16 03:23:00 2017 +0100 Committer: Alex Heneveld Committed: Sat Sep 16 03:25:36 2017 +0100 -- .../policy/autoscaling/AutoScalerPolicy.java | 4 ++-- .../autoscaling/AutoScalerPolicyPoolSizeTest.java | 18 ++ 2 files changed, 16 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2cc9dafb/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java -- diff --git a/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java b/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java index baa3871..0b33760 100644 --- a/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java +++ b/policy/src/main/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicy.java @@ -768,8 +768,8 @@ public class AutoScalerPolicy extends AbstractPolicy { int desiredSize = Math.min(max, Math.max(min, currentSize)); if (currentSize != desiredSize) { -if (LOG.isInfoEnabled()) LOG.info("{} resizing pool {} immediateley from {} to {} (due to new pool size limits)", new Object[] {this, poolEntity, currentSize, desiredSize}); -getResizeOperator().resize(poolEntity, desiredSize); +if (LOG.isInfoEnabled()) LOG.info("{} resizing pool {} triggering resize computation due to new pool size limits, current {} exceeds bound of {}", new Object[] {this, poolEntity, currentSize, desiredSize}); +resizeNow("Size "+currentSize+" not in new bounds"); } } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2cc9dafb/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java -- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java index b03c194..16325d2 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/autoscaling/AutoScalerPolicyPoolSizeTest.java @@ -30,6 +30,8 @@ import org.apache.brooklyn.core.test.entity.TestCluster; import org.apache.brooklyn.core.test.entity.TestSizeRecordingCluster; import org.apache.brooklyn.entity.stock.BasicStartable; import org.apache.brooklyn.util.collections.MutableList; +import org.apache.brooklyn.util.time.Duration; +import org.apache.brooklyn.util.time.Time; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -64,7 +66,7 @@ public class AutoScalerPolicyPoolSizeTest extends BrooklynAppUnitTestSupport { .configure(AutoScalerPolicy.RESIZE_OPERATOR, new ResizeOperator() { @Override public Integer resize(Entity entity, Integer desiredSize) { -LOG.info("resizing to " + desiredSize); +LOG.info("test policy resizing to " + desiredSize); resizes.add(desiredSize); return ((Resizable) entity).resize(desiredSize); } @@ -101,10 +103,18 @@ public class AutoScalerPolicyPoolSizeTest extends BrooklynAppUnitTestSupport { @Test public void testResizeDown() throws Exception { EntityAsserts.assertAttributeEqualsEventually(cluster, TestCluster.GROUP_SIZE, CLUSTER_INIITIAL_SIZE); +// temporarily increase, otherwise the policy can sometimes kick in to resize down before size 6 is reached +policy.config().set(AutoScalerPolicy.MAX_POOL_SIZE, CLUSTER_MAX_SIZE + 2); cluster.resize(CLUSTER_MAX_SIZE + 2); +
[1/2] brooklyn-library git commit: Add icons to catalog.bom files
Repository: brooklyn-library Updated Branches: refs/heads/master 77b0be8b5 -> 127c96916 Add icons to catalog.bom files Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/45d22be2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/45d22be2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/45d22be2 Branch: refs/heads/master Commit: 45d22be2ab96a985c4222b2fa3432e8e0fad5832 Parents: 64f5ccd Author: Aled SageAuthored: Fri Sep 15 20:32:42 2017 +0100 Committer: Aled Sage Committed: Fri Sep 15 20:32:42 2017 +0100 -- .../cm/ansible/src/main/resources/catalog.bom | 1 + software/cm/salt/src/main/resources/catalog.bom | 1 + .../database/src/main/resources/catalog.bom | 7 - .../messaging/src/main/resources/catalog.bom| 14 ++ .../monitoring/src/main/resources/catalog.bom | 1 + software/nosql/src/main/resources/catalog.bom | 28 software/osgi/src/main/resources/catalog.bom| 1 + software/webapp/src/main/resources/catalog.bom | 9 +++ 8 files changed, 61 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/45d22be2/software/cm/ansible/src/main/resources/catalog.bom -- diff --git a/software/cm/ansible/src/main/resources/catalog.bom b/software/cm/ansible/src/main/resources/catalog.bom index f93ae7d..8dec54c 100644 --- a/software/cm/ansible/src/main/resources/catalog.bom +++ b/software/cm/ansible/src/main/resources/catalog.bom @@ -20,6 +20,7 @@ brooklyn.catalog: itemType: entity items: - id: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity + iconUrl: classpath:///ansible-logo.png item: type: org.apache.brooklyn.entity.cm.ansible.AnsibleEntity name: AnsibleEntity http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/45d22be2/software/cm/salt/src/main/resources/catalog.bom -- diff --git a/software/cm/salt/src/main/resources/catalog.bom b/software/cm/salt/src/main/resources/catalog.bom index 6d60a34..5d4e767 100644 --- a/software/cm/salt/src/main/resources/catalog.bom +++ b/software/cm/salt/src/main/resources/catalog.bom @@ -20,6 +20,7 @@ brooklyn.catalog: itemType: entity items: - id: org.apache.brooklyn.entity.cm.salt.SaltEntity + iconUrl: classpath:///saltstack-logo.png item: type: org.apache.brooklyn.entity.cm.salt.SaltEntity name: SaltEntity http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/45d22be2/software/database/src/main/resources/catalog.bom -- diff --git a/software/database/src/main/resources/catalog.bom b/software/database/src/main/resources/catalog.bom index e033aa7..4c09ec4 100644 --- a/software/database/src/main/resources/catalog.bom +++ b/software/database/src/main/resources/catalog.bom @@ -20,32 +20,37 @@ brooklyn.catalog: itemType: entity items: - id: org.apache.brooklyn.entity.database.crate.CrateNode + iconUrl: classpath:///crate-logo.png item: type: org.apache.brooklyn.entity.database.crate.CrateNode name: Crate Node description: CrateDB offers Standard-SQL real-time queries and document support - id: org.apache.brooklyn.entity.database.mysql.MySqlNode + iconUrl: classpath:///mysql-logo-110x57.png item: type: org.apache.brooklyn.entity.database.mysql.MySqlNode name: MySql Node description: MySql is an open source relational database management system (RDBMS) - id: org.apache.brooklyn.entity.database.mysql.MySqlCluster + iconUrl: classpath:///mysql-logo-110x57.png item: type: org.apache.brooklyn.entity.database.mysql.MySqlCluster name: MySql Master-Slave cluster description: Sets up a cluster of MySQL nodes using master-slave relation and binary logging - id: org.apache.brooklyn.entity.database.postgresql.PostgreSqlNode + iconUrl: classpath:///postgresql-logo-200px.png item: type: org.apache.brooklyn.entity.database.postgresql.PostgreSqlNode name: PostgreSQL Node description: PostgreSQL is an object-relational database management system (ORDBMS) - id: org.apache.brooklyn.entity.database.rubyrep.RubyRepNode + iconUrl: classpath:///rubyrep-logo.png item: type: org.apache.brooklyn.entity.database.rubyrep.RubyRepNode name: RubyRep Node description: RubyRep is a database replication system -iconUrl: classpath:///rubyrep-logo.jpeg - id:
[2/2] brooklyn-library git commit: This closes #128
This closes #128 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/127c9691 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/127c9691 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/127c9691 Branch: refs/heads/master Commit: 127c969163495ce2da873e68bd81bb88a11ae1f9 Parents: 77b0be8 45d22be Author: Aled SageAuthored: Tue Sep 19 15:38:00 2017 +0100 Committer: Aled Sage Committed: Tue Sep 19 15:38:00 2017 +0100 -- .../cm/ansible/src/main/resources/catalog.bom | 1 + software/cm/salt/src/main/resources/catalog.bom | 1 + .../database/src/main/resources/catalog.bom | 7 - .../messaging/src/main/resources/catalog.bom| 14 ++ .../monitoring/src/main/resources/catalog.bom | 1 + software/nosql/src/main/resources/catalog.bom | 28 software/osgi/src/main/resources/catalog.bom| 1 + software/webapp/src/main/resources/catalog.bom | 9 +++ 8 files changed, 61 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/cm/ansible/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/cm/salt/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/database/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/messaging/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/monitoring/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/nosql/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/osgi/src/main/resources/catalog.bom -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/127c9691/software/webapp/src/main/resources/catalog.bom --
[3/4] brooklyn-library git commit: DatastoreMixins.CanExecuteScript.COMMANDS: remove
DatastoreMixins.CanExecuteScript.COMMANDS: remove Because entities extend this interface, they were reporting this as a config key on the entity rather than just on the effector. Therefore remove it as a constant. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/0d59c30c Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/0d59c30c Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/0d59c30c Branch: refs/heads/master Commit: 0d59c30c6fe7d84cd9e9ce9fc84851cd4399ec6a Parents: 021400c Author: Aled SageAuthored: Tue Sep 12 18:36:33 2017 +0100 Committer: Aled Sage Committed: Tue Sep 12 18:36:33 2017 +0100 -- .../java/org/apache/brooklyn/entity/database/DatastoreMixins.java | 3 +-- .../apache/brooklyn/entity/database/mysql/MySqlClusterUtils.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/0d59c30c/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java -- diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java index def05a3..dc46f68 100644 --- a/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java +++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java @@ -58,10 +58,9 @@ public class DatastoreMixins { public static final Effector EXECUTE_SCRIPT = CanExecuteScript.EXECUTE_SCRIPT; public static interface CanExecuteScript { -ConfigKey COMMANDS = ConfigKeys.newStringConfigKey("commands"); Effector EXECUTE_SCRIPT = Effectors.effector(String.class, "executeScript") .description("executes the given script contents") -.parameter(COMMANDS) +.parameter(ConfigKeys.newStringConfigKey("commands")) .buildAbstract(); } http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/0d59c30c/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterUtils.java -- diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterUtils.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterUtils.java index 9f8dc6d..7ba1ce0 100644 --- a/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterUtils.java +++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlClusterUtils.java @@ -37,7 +37,7 @@ public class MySqlClusterUtils { // Can't call node.executeScript directly, need to change execution context, so use an effector task protected static Task executeSqlOnNodeAsync(MySqlNode node, String commands) { -return DynamicTasks.queue(Effectors.invocation(node, MySqlNode.EXECUTE_SCRIPT, ImmutableMap.of(CanExecuteScript.COMMANDS.getName(), commands))).asTask(); +return DynamicTasks.queue(Effectors.invocation(node, MySqlNode.EXECUTE_SCRIPT, ImmutableMap.of("commands", commands))).asTask(); } protected static String validateSqlParam(String config) {
[3/3] brooklyn-server git commit: This closes #791
This closes #791 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/06c9f621 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/06c9f621 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/06c9f621 Branch: refs/heads/master Commit: 06c9f621c9a2a3f827a83007cb859a22adb55a6d Parents: 25312b1 c5cbc08 Author: Aled SageAuthored: Mon Sep 11 09:20:33 2017 +0100 Committer: Aled Sage Committed: Mon Sep 11 09:20:33 2017 +0100 -- .../persist/FileBasedStoreObjectAccessor.java | 33 +++- 1 file changed, 32 insertions(+), 1 deletion(-) --
[2/3] brooklyn-server git commit: Sync before close
Sync before close Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c5cbc084 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c5cbc084 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c5cbc084 Branch: refs/heads/master Commit: c5cbc0843d9635072d09379ed053968a2e670387 Parents: 9fe0179 Author: Geoff MacartneyAuthored: Fri Sep 8 10:21:25 2017 +0100 Committer: Geoff Macartney Committed: Fri Sep 8 10:21:25 2017 +0100 -- .../core/mgmt/persist/FileBasedStoreObjectAccessor.java | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c5cbc084/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java index 6a3de10..9387fe3 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.FileDescriptor; import java.io.FileOutputStream; import java.io.IOException; +import java.io.InputStream; import java.io.SyncFailedException; import java.util.Date; @@ -90,8 +91,15 @@ public class FileBasedStoreObjectAccessor implements PersistenceObjectStore.Stor try { FileUtil.setFilePermissionsTo600(tmpFile); final FileOutputStream tempStream = new FileOutputStream(tmpFile); -Streams.copyClose(bytes.openStream(), tempStream); -syncFileSystem(tempStream.getFD()); +final InputStream byteStream = bytes.openStream(); +try { +Streams.copy(byteStream, tempStream); +syncFileSystem(tempStream.getFD()); +} finally { +Streams.closeQuietly(byteStream); +Streams.closeQuietly(tempStream); +} + FileBasedObjectStore.moveFile(tmpFile, file); } catch (IOException e) { throw Exceptions.propagateAnnotated("Problem writing data to file "+file+" (via temporary file "+tmpFile+")", e);
[1/3] brooklyn-server git commit: Sync file system on temp file before moving it.
Repository: brooklyn-server Updated Branches: refs/heads/master 25312b16a -> 06c9f621c Sync file system on temp file before moving it. See https://issues.apache.org/jira/browse/BROOKLYN-526 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9fe0179a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9fe0179a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9fe0179a Branch: refs/heads/master Commit: 9fe0179a5fb04b7578c94684ecc5a6342ed79c06 Parents: d961de3 Author: Geoff MacartneyAuthored: Fri Aug 4 12:09:34 2017 +0100 Committer: Geoff Macartney Committed: Fri Aug 18 14:42:04 2017 +0100 -- .../persist/FileBasedStoreObjectAccessor.java | 25 +++- 1 file changed, 24 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9fe0179a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java index a8d7cf1..6a3de10 100644 --- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java +++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/FileBasedStoreObjectAccessor.java @@ -19,8 +19,10 @@ package org.apache.brooklyn.core.mgmt.persist; import java.io.File; +import java.io.FileDescriptor; import java.io.FileOutputStream; import java.io.IOException; +import java.io.SyncFailedException; import java.util.Date; import org.apache.brooklyn.util.exceptions.Exceptions; @@ -87,7 +89,9 @@ public class FileBasedStoreObjectAccessor implements PersistenceObjectStore.Stor public void put(ByteSource bytes) { try { FileUtil.setFilePermissionsTo600(tmpFile); -Streams.copyClose(bytes.openStream(), new FileOutputStream(tmpFile)); +final FileOutputStream tempStream = new FileOutputStream(tmpFile); +Streams.copyClose(bytes.openStream(), tempStream); +syncFileSystem(tempStream.getFD()); FileBasedObjectStore.moveFile(tmpFile, file); } catch (IOException e) { throw Exceptions.propagateAnnotated("Problem writing data to file "+file+" (via temporary file "+tmpFile+")", e); @@ -96,6 +100,25 @@ public class FileBasedStoreObjectAccessor implements PersistenceObjectStore.Stor } } +private void syncFileSystem(final FileDescriptor fd) throws SyncFailedException { +// Simple retry a number of times; avoids Repeater to avoid complications of timeouts and separate threads +int maxTries = 3; + +SyncFailedException sfe = null; +for (int c = 0 ; c < maxTries ; c++) { +try { +fd.sync(); +sfe = null; +break; +} catch (SyncFailedException e) { +sfe = e; +} +} +if (sfe != null) { +throw sfe; +} +} + // TODO Should this write to the temporary file? Otherwise we'll risk getting a partial view of the write. @Override public void append(String val) {
[4/5] brooklyn-server git commit: PR #790: address comments for preemptiveBaicAuth
PR #790: address comments for preemptiveBaicAuth Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f2f59225 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f2f59225 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f2f59225 Branch: refs/heads/master Commit: f2f592253dfac36e022db644e257e22a803f665d Parents: 6fb5166 Author: Aled SageAuthored: Fri Aug 4 11:23:52 2017 +0100 Committer: Aled Sage Committed: Fri Aug 4 13:09:24 2017 +0100 -- .../org/apache/brooklyn/feed/http/HttpFeed.java | 9 ++- .../apache/brooklyn/feed/http/HttpFeedTest.java | 58 +++- .../test/http/RecordingHttpRequestHandler.java | 3 +- 3 files changed, 64 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f2f59225/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java -- diff --git a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java index 37fb32f..a2d3125 100644 --- a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java +++ b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java @@ -242,8 +242,15 @@ public class HttpFeed extends AbstractFeed { throw new IllegalArgumentException("Must not enable preemptiveBasicAuth when there are no credentials, in feed for "+baseUri); } String username = checkNotNull(creds.getUserPrincipal().getName(), "username"); +if (username == null) { +throw new IllegalArgumentException("Must not enable preemptiveBasicAuth when username is null, in feed for "+baseUri); +} +if (username.contains(":")) { +throw new IllegalArgumentException("Username must not contain colon when preemptiveBasicAuth is enabled, in feed for "+baseUri); +} + String password = creds.getPassword(); -String toencode = username + (password == null ? "" : ":"+password); +String toencode = username + ":" + (password == null ? "" : password); String headerVal = "Basic " + BaseEncoding.base64().encode((toencode).getBytes(StandardCharsets.UTF_8)); return ImmutableMap. builder() http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f2f59225/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java b/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java index 08abbe6..af66e45 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java @@ -204,6 +204,7 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { @Test public void testUsesFailureHandlerOn4xx() throws Exception { +if (server != null) server.shutdown(); server = BetterMockWebServer.newInstanceLocalhost(); for (int i = 0; i < 100; i++) { server.enqueue(new MockResponse() @@ -232,6 +233,7 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { @Test public void testUsesExceptionHandlerOn4xxAndNoFailureHandler() throws Exception { +if (server != null) server.shutdown(); server = BetterMockWebServer.newInstanceLocalhost(); for (int i = 0; i < 100; i++) { server.enqueue(new MockResponse() @@ -332,9 +334,11 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { } // because takes a wee while +// TODO time-sensitive brittle test - relies on assertion spotting sensor value in first 10 polls (i.e. 1 second) @SuppressWarnings("rawtypes") @Test(groups="Integration") public void testPollsMultiClearsOnSubsequentFailure() throws Exception { +if (server != null) server.shutdown(); server = BetterMockWebServer.newInstanceLocalhost(); for (int i = 0; i < 10; i++) { server.enqueue(new MockResponse() @@ -366,10 +370,39 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { } @Test +public void testFailsIfUsernameNull() throws Exception { +try { +feed = HttpFeed.builder() +.entity(entity) +.baseUrl(new URL("http://shouldNeverBeCalled.org;)) +.credentials(null, "Pa55w0rd") +.poll(new
[2/5] brooklyn-server git commit: PR #790: address comments for preemptiveBaicAuth
PR #790: address comments for preemptiveBaicAuth Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9cb715b1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9cb715b1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9cb715b1 Branch: refs/heads/master Commit: 9cb715b1be3162371be701072bb9c9783bbf3d9f Parents: 6b9c6ac Author: Aled SageAuthored: Fri Aug 4 11:23:52 2017 +0100 Committer: Aled Sage Committed: Fri Aug 4 11:23:52 2017 +0100 -- .../org/apache/brooklyn/feed/http/HttpFeed.java | 9 ++- .../apache/brooklyn/feed/http/HttpFeedTest.java | 58 +++- .../test/http/RecordingHttpRequestHandler.java | 3 +- 3 files changed, 64 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9cb715b1/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java -- diff --git a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java index 37fb32f..a2d3125 100644 --- a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java +++ b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java @@ -242,8 +242,15 @@ public class HttpFeed extends AbstractFeed { throw new IllegalArgumentException("Must not enable preemptiveBasicAuth when there are no credentials, in feed for "+baseUri); } String username = checkNotNull(creds.getUserPrincipal().getName(), "username"); +if (username == null) { +throw new IllegalArgumentException("Must not enable preemptiveBasicAuth when username is null, in feed for "+baseUri); +} +if (username.contains(":")) { +throw new IllegalArgumentException("Username must not contain colon when preemptiveBasicAuth is enabled, in feed for "+baseUri); +} + String password = creds.getPassword(); -String toencode = username + (password == null ? "" : ":"+password); +String toencode = username + ":" + (password == null ? "" : password); String headerVal = "Basic " + BaseEncoding.base64().encode((toencode).getBytes(StandardCharsets.UTF_8)); return ImmutableMap. builder() http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9cb715b1/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java b/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java index 08abbe6..af66e45 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/http/HttpFeedTest.java @@ -204,6 +204,7 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { @Test public void testUsesFailureHandlerOn4xx() throws Exception { +if (server != null) server.shutdown(); server = BetterMockWebServer.newInstanceLocalhost(); for (int i = 0; i < 100; i++) { server.enqueue(new MockResponse() @@ -232,6 +233,7 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { @Test public void testUsesExceptionHandlerOn4xxAndNoFailureHandler() throws Exception { +if (server != null) server.shutdown(); server = BetterMockWebServer.newInstanceLocalhost(); for (int i = 0; i < 100; i++) { server.enqueue(new MockResponse() @@ -332,9 +334,11 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { } // because takes a wee while +// TODO time-sensitive brittle test - relies on assertion spotting sensor value in first 10 polls (i.e. 1 second) @SuppressWarnings("rawtypes") @Test(groups="Integration") public void testPollsMultiClearsOnSubsequentFailure() throws Exception { +if (server != null) server.shutdown(); server = BetterMockWebServer.newInstanceLocalhost(); for (int i = 0; i < 10; i++) { server.enqueue(new MockResponse() @@ -366,10 +370,39 @@ public class HttpFeedTest extends BrooklynAppUnitTestSupport { } @Test +public void testFailsIfUsernameNull() throws Exception { +try { +feed = HttpFeed.builder() +.entity(entity) +.baseUrl(new URL("http://shouldNeverBeCalled.org;)) +.credentials(null, "Pa55w0rd") +.poll(new
[5/5] brooklyn-server git commit: This closes #790
This closes #790 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d5cd336f Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d5cd336f Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d5cd336f Branch: refs/heads/master Commit: d5cd336fb0f48c9636f052957e21e273df588915 Parents: f2f5922 9cb715b Author: Aled SageAuthored: Fri Aug 4 13:09:24 2017 +0100 Committer: Aled Sage Committed: Fri Aug 4 13:09:24 2017 +0100 -- --
[3/5] brooklyn-server git commit: Adds HttpFeed.preemptiveBasicAuth
Adds HttpFeed.preemptiveBasicAuth Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6fb5166a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6fb5166a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6fb5166a Branch: refs/heads/master Commit: 6fb5166aad7f9731c0d912b4ad31578f1ff02554 Parents: 9e53af9 Author: Aled SageAuthored: Thu Aug 3 17:38:41 2017 +0100 Committer: Aled Sage Committed: Fri Aug 4 13:09:24 2017 +0100 -- .../core/sensor/http/HttpRequestSensor.java | 12 ++- .../org/apache/brooklyn/feed/http/HttpFeed.java | 34 +++- .../core/sensor/http/HttpRequestSensorTest.java | 40 - .../feed/http/HttpFeedIntegrationTest.java | 10 +++ .../apache/brooklyn/feed/http/HttpFeedTest.java | 89 +++- .../test/http/RecordingHttpRequestHandler.java | 78 + 6 files changed, 251 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6fb5166a/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java b/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java index 22e24f1..107d9a4 100644 --- a/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java +++ b/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java @@ -56,8 +56,13 @@ public final class HttpRequestSensor extends AddSensor { public static final ConfigKey JSON_PATH = ConfigKeys.newStringConfigKey("jsonPath", "JSON path to select in HTTP response; default $", "$"); public static final ConfigKey USERNAME = ConfigKeys.newStringConfigKey("username", "Username for HTTP request, if required"); public static final ConfigKey PASSWORD = ConfigKeys.newStringConfigKey("password", "Password for HTTP request, if required"); -public static final ConfigKey > HEADERS = new MapConfigKey(String.class, "headers"); - +public static final ConfigKey > HEADERS = new MapConfigKey<>(String.class, "headers"); + +public static final ConfigKey PREEMPTIVE_BASIC_AUTH = ConfigKeys.newBooleanConfigKey( +"preemptiveBasicAuth", +"Whether to pre-emptively including a basic-auth header of the username:password (rather than waiting for a challenge)", +Boolean.FALSE); + public HttpRequestSensor(final ConfigBag params) { super(params); } @@ -85,7 +90,7 @@ public final class HttpRequestSensor extends AddSensor { final String username = EntityInitializers.resolve(allConfig, USERNAME); final String password = EntityInitializers.resolve(allConfig, PASSWORD); final Map headers = EntityInitializers.resolve(allConfig, HEADERS); - +final Boolean preemptiveBasicAuth = EntityInitializers.resolve(allConfig, PREEMPTIVE_BASIC_AUTH); HttpPollConfig pollConfig = new HttpPollConfig(sensor) .checkSuccess(HttpValueFunctions.responseCodeEquals(200)) @@ -96,6 +101,7 @@ public final class HttpRequestSensor extends AddSensor { HttpFeed.Builder httpRequestBuilder = HttpFeed.builder().entity(entity) .baseUri(uri) .credentialsIfNotNull(username, password) +.preemptiveBasicAuth(Boolean.TRUE.equals(preemptiveBasicAuth)) .poll(pollConfig); if (headers != null) { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6fb5166a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java -- diff --git a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java index 36d19c2..37fb32f 100644 --- a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java +++ b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java @@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.List; import java.util.Map; @@ -47,11 +48,11 @@ import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.util.executor.HttpExecutorFactory; import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.http.HttpToolResponse; -import org.apache.brooklyn.util.http.executor.UsernamePassword; import org.apache.brooklyn.util.http.executor.HttpConfig;
[1/5] brooklyn-server git commit: Adds HttpFeed.preemptiveBasicAuth
Repository: brooklyn-server Updated Branches: refs/heads/master 9e53af950 -> d5cd336fb Adds HttpFeed.preemptiveBasicAuth Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6b9c6ac1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6b9c6ac1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6b9c6ac1 Branch: refs/heads/master Commit: 6b9c6ac172a5e1ddfbc07f624324a9a589a7d7bc Parents: 34b4c0d Author: Aled SageAuthored: Thu Aug 3 17:38:41 2017 +0100 Committer: Aled Sage Committed: Thu Aug 3 17:44:22 2017 +0100 -- .../core/sensor/http/HttpRequestSensor.java | 12 ++- .../org/apache/brooklyn/feed/http/HttpFeed.java | 34 +++- .../core/sensor/http/HttpRequestSensorTest.java | 40 - .../feed/http/HttpFeedIntegrationTest.java | 10 +++ .../apache/brooklyn/feed/http/HttpFeedTest.java | 89 +++- .../test/http/RecordingHttpRequestHandler.java | 78 + 6 files changed, 251 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6b9c6ac1/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java -- diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java b/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java index 22e24f1..107d9a4 100644 --- a/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java +++ b/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java @@ -56,8 +56,13 @@ public final class HttpRequestSensor extends AddSensor { public static final ConfigKey JSON_PATH = ConfigKeys.newStringConfigKey("jsonPath", "JSON path to select in HTTP response; default $", "$"); public static final ConfigKey USERNAME = ConfigKeys.newStringConfigKey("username", "Username for HTTP request, if required"); public static final ConfigKey PASSWORD = ConfigKeys.newStringConfigKey("password", "Password for HTTP request, if required"); -public static final ConfigKey > HEADERS = new MapConfigKey(String.class, "headers"); - +public static final ConfigKey > HEADERS = new MapConfigKey<>(String.class, "headers"); + +public static final ConfigKey PREEMPTIVE_BASIC_AUTH = ConfigKeys.newBooleanConfigKey( +"preemptiveBasicAuth", +"Whether to pre-emptively including a basic-auth header of the username:password (rather than waiting for a challenge)", +Boolean.FALSE); + public HttpRequestSensor(final ConfigBag params) { super(params); } @@ -85,7 +90,7 @@ public final class HttpRequestSensor extends AddSensor { final String username = EntityInitializers.resolve(allConfig, USERNAME); final String password = EntityInitializers.resolve(allConfig, PASSWORD); final Map headers = EntityInitializers.resolve(allConfig, HEADERS); - +final Boolean preemptiveBasicAuth = EntityInitializers.resolve(allConfig, PREEMPTIVE_BASIC_AUTH); HttpPollConfig pollConfig = new HttpPollConfig(sensor) .checkSuccess(HttpValueFunctions.responseCodeEquals(200)) @@ -96,6 +101,7 @@ public final class HttpRequestSensor extends AddSensor { HttpFeed.Builder httpRequestBuilder = HttpFeed.builder().entity(entity) .baseUri(uri) .credentialsIfNotNull(username, password) +.preemptiveBasicAuth(Boolean.TRUE.equals(preemptiveBasicAuth)) .poll(pollConfig); if (headers != null) { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6b9c6ac1/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java -- diff --git a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java index 36d19c2..37fb32f 100644 --- a/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java +++ b/core/src/main/java/org/apache/brooklyn/feed/http/HttpFeed.java @@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.URI; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.List; import java.util.Map; @@ -47,11 +48,11 @@ import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.util.executor.HttpExecutorFactory; import org.apache.brooklyn.util.guava.Maybe; import org.apache.brooklyn.util.http.HttpToolResponse; -import
[1/2] brooklyn-server git commit: Upgrade json-path to 2.4.0 (from 2.0.0)
Repository: brooklyn-server Updated Branches: refs/heads/master 33d39242e -> 34b4c0df9 Upgrade json-path to 2.4.0 (from 2.0.0) This supports `.size()` Also fix the json-path dependency, to exclude conflicting versions Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/495d73a2 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/495d73a2 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/495d73a2 Branch: refs/heads/master Commit: 495d73a288d4619a35c9a1cffc6502524a809ee0 Parents: 092edf1 Author: Aled SageAuthored: Wed Aug 2 12:35:18 2017 +0100 Committer: Aled Sage Committed: Thu Aug 3 13:45:38 2017 +0100 -- .../brooklyn/feed/http/JsonFunctionsTest.java | 15 karaf/features/src/main/feature/feature.xml | 3 +- parent/pom.xml | 37 ++-- pom.xml | 7 ++-- 4 files changed, 48 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java b/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java index ba654a4..d1a5d0a 100644 --- a/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java +++ b/core/src/test/java/org/apache/brooklyn/feed/http/JsonFunctionsTest.java @@ -28,6 +28,7 @@ import org.apache.brooklyn.util.guava.Maybe; import org.testng.Assert; import org.testng.annotations.Test; +import com.google.common.collect.ImmutableList; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import com.jayway.jsonpath.PathNotFoundException; @@ -121,6 +122,20 @@ public class JsonFunctionsTest { } @Test +public void testGetPathSizeOfMap(){ +JsonElement json = JsonFunctions.asJson().apply("{\"mymap\": {\"k1\": \"v1\", \"k2\": \"v2\"}}"); +Integer obj = (Integer) JsonFunctions.getPath("$.mymap.size()").apply(json); +Assert.assertEquals(obj, (Integer)2); +} + +@Test +public void testGetPathSizeOfList(){ +JsonElement json = JsonFunctions.asJson().apply("{\"mylist\": [\"a\", \"b\", \"c\"]}"); +Integer obj = (Integer) JsonFunctions.getPath("$.mylist.size()").apply(json); +Assert.assertEquals(obj, (Integer)3); +} + +@Test public void testGetMissingPathIsNullOrThrows(){ try { // TODO is there a way to force this to return null if not found? http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/karaf/features/src/main/feature/feature.xml -- diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml index d6a5038..be16e90 100644 --- a/karaf/features/src/main/feature/feature.xml +++ b/karaf/features/src/main/feature/feature.xml @@ -142,7 +142,8 @@ mvn:com.fasterxml.jackson.core/jackson-databind/${fasterxml.jackson.version} mvn:com.fasterxml.jackson.core/jackson-annotations/${fasterxml.jackson.version} mvn:net.minidev/json-smart/${jsonSmart.version} -mvn:net.minidev/asm/${minidev.asm.version} +mvn:net.minidev/accessors-smart/${minidev.accessors-smart.version} +mvn:org.ow2.asm/asm/${ow2.asm.version} mvn:com.thoughtworks.xstream/xstream/${xstream.version} mvn:org.freemarker/freemarker/${freemarker.version} mvn:com.hierynomus/sshj/${sshj.version} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/495d73a2/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index 10e5ea4..d559d1e 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -463,6 +463,33 @@ com.jayway.jsonpath json-path ${jsonPath.version} + + + +org.slf4j +slf4j-api + + + +com.fasterxml.jackson.core +jackson-databind + + + + +net.minidev +json-smart +${jsonSmart.version} + + +net.minidev +accessors-smart +${minidev.accessors-smart.version} + + +org.ow2.asm +
[2/2] brooklyn-server git commit: This closes #784
This closes #784 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/34b4c0df Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/34b4c0df Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/34b4c0df Branch: refs/heads/master Commit: 34b4c0df9bc9e1975b3d622ac71d0b1d27c47c08 Parents: 33d3924 495d73a Author: Aled SageAuthored: Thu Aug 3 16:26:49 2017 +0100 Committer: Aled Sage Committed: Thu Aug 3 16:26:49 2017 +0100 -- .../brooklyn/feed/http/JsonFunctionsTest.java | 15 karaf/features/src/main/feature/feature.xml | 3 +- parent/pom.xml | 37 ++-- pom.xml | 7 ++-- 4 files changed, 48 insertions(+), 14 deletions(-) --
[2/3] brooklyn-server git commit: UpdatingMap: fix synchronisation
UpdatingMap: fix synchronisation Delegate to ServiceStateLogic.updateMapSensorEntry, to use a `modify` operation. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b91f03b7 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b91f03b7 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b91f03b7 Branch: refs/heads/master Commit: b91f03b71283e751250beec7ec5e11cdf9f240c1 Parents: af44b6d Author: Aled SageAuthored: Thu Aug 3 15:53:23 2017 +0100 Committer: Aled Sage Committed: Thu Aug 3 15:53:45 2017 +0100 -- .../brooklyn/enricher/stock/UpdatingMap.java| 41 --- .../enricher/stock/UpdatingMapTest.java | 71 ++-- 2 files changed, 79 insertions(+), 33 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b91f03b7/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java -- diff --git a/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java b/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java index c74423e..acd4dbd 100644 --- a/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java +++ b/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java @@ -31,7 +31,7 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.enricher.AbstractEnricher; import org.apache.brooklyn.core.entity.Entities; -import org.apache.brooklyn.util.collections.MutableMap; +import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; import org.apache.brooklyn.util.core.flags.SetFromFlag; import org.apache.brooklyn.util.exceptions.Exceptions; import org.slf4j.Logger; @@ -70,16 +70,24 @@ public class UpdatingMap extends AbstractEnricher implements Sensor @SetFromFlag("fromSensor") public static final ConfigKeySOURCE_SENSOR = ConfigKeys.newConfigKey(new TypeToken () {}, "enricher.sourceSensor"); + @SetFromFlag("targetSensor") public static final ConfigKey TARGET_SENSOR = ConfigKeys.newConfigKey(new TypeToken () {}, "enricher.targetSensor"); + @SetFromFlag("key") public static final ConfigKey KEY_IN_TARGET_SENSOR = ConfigKeys.newConfigKey(Object.class, "enricher.updatingMap.keyInTargetSensor", "Key to update in the target sensor map, defaulting to the name of the source sensor"); + @SetFromFlag("computing") -public static final ConfigKey COMPUTING = ConfigKeys.newConfigKey(new TypeToken () {}, "enricher.updatingMap.computing"); +public static final ConfigKey COMPUTING = ConfigKeys.newConfigKey( +new TypeToken () {}, +"enricher.updatingMap.computing"); + @SetFromFlag("removingIfResultIsNull") -public static final ConfigKey REMOVING_IF_RESULT_IS_NULL = ConfigKeys.newBooleanConfigKey("enricher.updatingMap.removingIfResultIsNull", -"Whether the key in the target map is removed if the result if the computation is null"); +public static final ConfigKey REMOVING_IF_RESULT_IS_NULL = ConfigKeys.newBooleanConfigKey( +"enricher.updatingMap.removingIfResultIsNull", +"Whether the key in the target map is removed if the result if the computation is null", +Boolean.TRUE); protected Entity producer; protected AttributeSensor sourceSensor; @@ -139,37 +147,16 @@ public class UpdatingMap extends AbstractEnricher implements Sensor protected void onUpdated() { try { Object v = computing.apply(producer.getAttribute(sourceSensor)); -if (v == null && !Boolean.FALSE.equals(removingIfResultIsNull)) { +if (v == null && Boolean.TRUE.equals(removingIfResultIsNull)) { v = Entities.REMOVE; } if (v == Entities.UNCHANGED) { // nothing } else { -// TODO check synchronization TKey key = this.key; if (key==null) key = (TKey) sourceSensor.getName(); - -Mapmap = entity.getAttribute(targetSensor); -boolean created = (map==null); -if (created) map = MutableMap.of(); - -boolean changed; -if (v == Entities.REMOVE) { -changed = map.containsKey(key); -if (changed) -map.remove(key); -} else { -TVal oldV = map.get(key); -if
[1/3] brooklyn-server git commit: UpdateMap: support configuring ‘producer’
Repository: brooklyn-server Updated Branches: refs/heads/master 007c4341f -> 33d39242e UpdateMap: support configuring âproducerâ Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/af44b6d4 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/af44b6d4 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/af44b6d4 Branch: refs/heads/master Commit: af44b6d4bbe363b87d0c601f6842d5000cd7dba0 Parents: 092edf1 Author: Aled SageAuthored: Thu Aug 3 13:15:08 2017 +0100 Committer: Aled Sage Committed: Thu Aug 3 15:53:44 2017 +0100 -- .../brooklyn/enricher/stock/UpdatingMap.java| 12 +- .../enricher/stock/UpdatingMapTest.java | 126 +++ 2 files changed, 135 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/af44b6d4/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java -- diff --git a/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java b/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java index 6945d50..c74423e 100644 --- a/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java +++ b/core/src/main/java/org/apache/brooklyn/enricher/stock/UpdatingMap.java @@ -21,6 +21,7 @@ package org.apache.brooklyn.enricher.stock; import java.util.Map; import org.apache.brooklyn.api.catalog.Catalog; +import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.Sensor; @@ -64,12 +65,15 @@ public class UpdatingMap extends AbstractEnricher implements Sensor private static final Logger LOG = LoggerFactory.getLogger(UpdatingMap.class); +public static final ConfigKey PRODUCER = ConfigKeys.newConfigKey(Entity.class, +"enricher.producer"); + @SetFromFlag("fromSensor") public static final ConfigKeySOURCE_SENSOR = ConfigKeys.newConfigKey(new TypeToken () {}, "enricher.sourceSensor"); @SetFromFlag("targetSensor") public static final ConfigKey TARGET_SENSOR = ConfigKeys.newConfigKey(new TypeToken () {}, "enricher.targetSensor"); @SetFromFlag("key") -public static final ConfigKey KEY_IN_TARGET_SENSOR = ConfigKeys.newConfigKey(Object.class, "enricher.updatingMap.keyInTargetSensor", +public static final ConfigKey KEY_IN_TARGET_SENSOR = ConfigKeys.newConfigKey(Object.class, "enricher.updatingMap.keyInTargetSensor", "Key to update in the target sensor map, defaulting to the name of the source sensor"); @SetFromFlag("computing") public static final ConfigKey COMPUTING = ConfigKeys.newConfigKey(new TypeToken () {}, "enricher.updatingMap.computing"); @@ -77,6 +81,7 @@ public class UpdatingMap extends AbstractEnricher implements Sensor public static final ConfigKey REMOVING_IF_RESULT_IS_NULL = ConfigKeys.newBooleanConfigKey("enricher.updatingMap.removingIfResultIsNull", "Whether the key in the target map is removed if the result if the computation is null"); +protected Entity producer; protected AttributeSensor sourceSensor; protected AttributeSensor> targetSensor; protected TKey key; @@ -112,13 +117,14 @@ public class UpdatingMap extends AbstractEnricher implements Sensor @Override public void setEntity(EntityLocal entity) { super.setEntity(entity); +this.producer = getConfig(PRODUCER) == null ? entity: getConfig(PRODUCER); this.sourceSensor = (AttributeSensor) getRequiredConfig(SOURCE_SENSOR); this.targetSensor = (AttributeSensor>) getRequiredConfig(TARGET_SENSOR); this.key = (TKey) getConfig(KEY_IN_TARGET_SENSOR); this.computing = (Function) getRequiredConfig(COMPUTING); this.removingIfResultIsNull = getConfig(REMOVING_IF_RESULT_IS_NULL); -subscriptions().subscribe(ImmutableMap.of("notifyOfInitialValue", true), entity, sourceSensor, this); +subscriptions().subscribe(ImmutableMap.of("notifyOfInitialValue", true), producer, sourceSensor, this); } @Override @@ -132,7 +138,7 @@ public class UpdatingMap extends AbstractEnricher implements Sensor @SuppressWarnings("unchecked") protected void onUpdated() { try { -Object v = computing.apply(entity.getAttribute(sourceSensor)); +Object v = computing.apply(producer.getAttribute(sourceSensor)); if (v == null &&
[3/3] brooklyn-server git commit: This closes #788
This closes #788 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/33d39242 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/33d39242 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/33d39242 Branch: refs/heads/master Commit: 33d39242e204820ee2182c8d86c3df0c2b1cd127 Parents: 007c434 b91f03b Author: Aled SageAuthored: Thu Aug 3 16:24:01 2017 +0100 Committer: Aled Sage Committed: Thu Aug 3 16:24:01 2017 +0100 -- .../brooklyn/enricher/stock/UpdatingMap.java| 53 +++--- .../enricher/stock/UpdatingMapTest.java | 185 +++ 2 files changed, 208 insertions(+), 30 deletions(-) --
[2/2] brooklyn-docs git commit: This closes #203
This closes #203 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/4268b671 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/4268b671 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/4268b671 Branch: refs/heads/master Commit: 4268b6713fe190d0108b325228783d9a872acd2c Parents: 19dd880 06a5656 Author: Aled SageAuthored: Mon Jul 17 12:42:02 2017 +0100 Committer: Aled Sage Committed: Mon Jul 17 12:42:02 2017 +0100 -- guide/blueprints/enrichers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[1/2] brooklyn-docs git commit: Add first addition to Aggregator
Repository: brooklyn-docs Updated Branches: refs/heads/master 19dd880b6 -> 4268b6713 Add first addition to Aggregator Project: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/commit/06a56562 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/tree/06a56562 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-docs/diff/06a56562 Branch: refs/heads/master Commit: 06a56562f61f6cea083900bdffcb41c7557b9bd0 Parents: 19dd880 Author: Duncan GodwinAuthored: Mon Jul 17 10:02:55 2017 +0100 Committer: GitHub Committed: Mon Jul 17 10:02:55 2017 +0100 -- guide/blueprints/enrichers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-docs/blob/06a56562/guide/blueprints/enrichers.md -- diff --git a/guide/blueprints/enrichers.md b/guide/blueprints/enrichers.md index 788fb52..6ef1247 100644 --- a/guide/blueprints/enrichers.md +++ b/guide/blueprints/enrichers.md @@ -44,7 +44,7 @@ There are a number of additional configuration keys available for the Aggregator | Configuration Key | Default | Description | |---|-|-| -| enricher.transformation.untyped | list| Specifies a transformation, as a function from a collection to the value, or as a string matching a pre-defined named transformation, such as 'average' (for numbers), 'sum' (for numbers), 'isQuorate' (to compute a quorum), or 'list' (the default, putting any collection of items into a list) | +| enricher.transformation.untyped | list| Specifies a transformation, as a function from a collection to the value, or as a string matching a pre-defined named transformation, such as 'average' (for numbers), 'sum' (for numbers), 'isQuorate' (to compute a quorum), 'first' (the first value, or null if empty), or 'list' (the default, putting any collection of items into a list) | | quorum.check.type | | The requirement to be considered quorate -- possible values: 'all', 'allAndAtLeastOne', 'atLeastOne', 'atLeastOneUnlessEmpty', 'alwaysHealthy'", "allAndAtLeastOne" | | quorum.total.size | 1 | The total size to consider when determining if quorate |
[2/2] brooklyn-server git commit: This closes #762
This closes #762 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ee551495 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ee551495 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ee551495 Branch: refs/heads/master Commit: ee5514951d23673c5ae3cd1483b60b60003441ce Parents: 0e35b61 6f2c08a Author: Aled SageAuthored: Fri Jul 14 13:55:32 2017 +0100 Committer: Aled Sage Committed: Fri Jul 14 13:55:32 2017 +0100 -- .../brooklyn/util/core/config/ConfigBag.java| 71 ++-- 1 file changed, 22 insertions(+), 49 deletions(-) --
[1/2] brooklyn-server git commit: BROOKLYN-520: better error if type missing
Repository: brooklyn-server Updated Branches: refs/heads/master 1df0db3c8 -> c2326132d BROOKLYN-520: better error if type missing Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/eb03dca5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/eb03dca5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/eb03dca5 Branch: refs/heads/master Commit: eb03dca56796c72cace595a2b8a86224365da8bd Parents: 1df0db3 Author: Aled SageAuthored: Wed Jun 28 16:04:35 2017 +0100 Committer: Aled Sage Committed: Wed Jun 28 17:38:09 2017 +0100 -- .../BrooklynComponentTemplateResolver.java | 12 +- .../brooklyn/ValidationMissingTypeYamlTest.java | 222 +++ 2 files changed, 232 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/eb03dca5/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java -- diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java index 7e9b562..e0cbe47 100644 --- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java +++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java @@ -18,6 +18,8 @@ */ package org.apache.brooklyn.camp.brooklyn.spi.creation; +import static com.google.common.base.Preconditions.checkNotNull; + import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashSet; @@ -97,12 +99,12 @@ public class BrooklynComponentTemplateResolver { private final EntitySpecResolver serviceSpecResolver; private BrooklynComponentTemplateResolver(BrooklynClassLoadingContext loader, ConfigBag attrs, AbstractResource optionalTemplate, String type) { -this.loader = loader; +this.loader = checkNotNull(loader, "loader"); this.mgmt = loader.getManagementContext(); this.attrs = ConfigBag.newInstanceCopying(attrs); this.template = Maybe.fromNullable(optionalTemplate); this.yamlLoader = new BrooklynYamlTypeInstantiator.Factory(loader, this); -this.type = type; +this.type = checkNotNull(type, "type"); this.serviceSpecResolver = new CampServiceSpecResolver(mgmt, getServiceTypeResolverOverrides()); } @@ -130,6 +132,12 @@ public class BrooklynComponentTemplateResolver { private static BrooklynComponentTemplateResolver newInstance(BrooklynClassLoadingContext context, ConfigBag attrs, AbstractResource optionalTemplate) { String type = getDeclaredType(null, optionalTemplate, attrs); +if (Strings.isBlank(type)) { +String msg = "No type defined " ++ (attrs == null ? ", no attributes supplied" : "in " + "[" + attrs.getAllConfigRaw() + "]") ++ (optionalTemplate == null ? "" : ", template " + optionalTemplate); +throw new IllegalArgumentException(msg); +} return new BrooklynComponentTemplateResolver(context, attrs, optionalTemplate, type); } http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/eb03dca5/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ValidationMissingTypeYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ValidationMissingTypeYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ValidationMissingTypeYamlTest.java new file mode 100644 index 000..d71f381 --- /dev/null +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ValidationMissingTypeYamlTest.java @@ -0,0 +1,222 @@ +/* + * 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
[2/2] brooklyn-server git commit: This closes #747
This closes #747 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c2326132 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c2326132 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c2326132 Branch: refs/heads/master Commit: c2326132d82efc0c3bb2bbf93fb5b773962d32e8 Parents: 1df0db3 eb03dca Author: Aled SageAuthored: Wed Jun 28 23:01:18 2017 +0100 Committer: Aled Sage Committed: Wed Jun 28 23:01:18 2017 +0100 -- .../BrooklynComponentTemplateResolver.java | 12 +- .../brooklyn/ValidationMissingTypeYamlTest.java | 222 +++ 2 files changed, 232 insertions(+), 2 deletions(-) --
[1/2] brooklyn-server git commit: DefaultAzureArmNetworkCreator improvements
Repository: brooklyn-server Updated Branches: refs/heads/master 733fe7737 -> 169b55e41 DefaultAzureArmNetworkCreator improvements * Donât use RETURNS_DEEP_STUBS as causes non-deterministic test failure on my dev machine (ClassCastException when calling `thenReturn(...)`!) * Tidy logging * Assert create() calls are made * Minor renames (e.g. _PREFIX to indicate DEFAULT_RESOURCE_GROUP constant is just the naming prefix) Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/55b44603 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/55b44603 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/55b44603 Branch: refs/heads/master Commit: 55b44603e4b0845f6d63f6d5e70953f6fdc1fffe Parents: b1fc16d Author: Aled SageAuthored: Thu Jun 22 11:55:46 2017 +0100 Committer: Aled Sage Committed: Thu Jun 22 14:33:32 2017 +0100 -- .../creator/DefaultAzureArmNetworkCreator.java | 31 ++-- .../DefaultAzureArmNetworkCreatorTest.java | 160 +-- 2 files changed, 95 insertions(+), 96 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/55b44603/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreator.java -- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreator.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreator.java index 179c12c..dc87cfc 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreator.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/networking/creator/DefaultAzureArmNetworkCreator.java @@ -46,9 +46,9 @@ public class DefaultAzureArmNetworkCreator { public static final Logger LOG = LoggerFactory.getLogger(DefaultAzureArmNetworkCreator.class); -private static final String DEFAULT_RESOURCE_GROUP = "brooklyn-default-resource-group"; -private static final String DEFAULT_NETWORK_NAME = "brooklyn-default-network"; -private static final String DEFAULT_SUBNET_NAME = "brooklyn-default-subnet"; +private static final String DEFAULT_RESOURCE_GROUP_PREFIX = "brooklyn-default-resource-group"; +private static final String DEFAULT_NETWORK_NAME_PREFIX = "brooklyn-default-network"; +private static final String DEFAULT_SUBNET_NAME_PREFIX = "brooklyn-default-subnet"; private static final String DEFAULT_VNET_ADDRESS_PREFIX = "10.1.0.0/16"; private static final String DEFAULT_SUBNET_ADDRESS_PREFIX = "10.1.0.0/24"; @@ -61,7 +61,7 @@ public class DefaultAzureArmNetworkCreator { public static void createDefaultNetworkAndAddToTemplateOptionsIfRequired(ComputeService computeService, ConfigBag config) { if (!config.get(AZURE_ARM_DEFAULT_NETWORK_ENABLED)) { -LOG.info("azure.arm.default.network.enabled is disabled, not creating default network"); +LOG.debug("azure.arm.default.network.enabled is disabled, not creating default network"); return; } @@ -70,33 +70,33 @@ public class DefaultAzureArmNetworkCreator { //Only create a default network if we haven't specified a network name (in template options or config) or ip options if (config.containsKey(NETWORK_NAME)) { -LOG.info("Network config specified when provisioning Azure machine. Not creating default network"); +LOG.debug("Network config specified when provisioning Azure machine. Not creating default network"); return; } if (templateOptions != null && (templateOptions.containsKey(NETWORK_NAME.getName()) || templateOptions.containsKey("ipOptions"))) { -LOG.info("Network config specified when provisioning Azure machine. Not creating default network"); +LOG.debug("Network config specified when provisioning Azure machine. Not creating default network"); return; } -LOG.info("Network config not specified when provisioning Azure machine. Creating default network if doesn't exist"); - AzureComputeApi api = computeService.getContext().unwrapApi(AzureComputeApi.class); String location = config.get(CLOUD_REGION_ID); -String resourceGroupName = DEFAULT_RESOURCE_GROUP + "-" + location; -String vnetName = DEFAULT_NETWORK_NAME + "-" + location; -String subnetName = DEFAULT_SUBNET_NAME + "-" + location; +String resourceGroupName = DEFAULT_RESOURCE_GROUP_PREFIX + "-" +
[2/2] brooklyn-server git commit: This closes #742
This closes #742 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/169b55e4 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/169b55e4 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/169b55e4 Branch: refs/heads/master Commit: 169b55e4195f73f1607fea72e384195699edaafb Parents: 733fe77 55b4460 Author: Aled SageAuthored: Fri Jun 23 12:22:09 2017 +0100 Committer: Aled Sage Committed: Fri Jun 23 12:22:09 2017 +0100 -- .../creator/DefaultAzureArmNetworkCreator.java | 31 ++-- .../DefaultAzureArmNetworkCreatorTest.java | 160 +-- 2 files changed, 95 insertions(+), 96 deletions(-) --
[1/2] brooklyn-server git commit: Fix/disable integration tests
Repository: brooklyn-server Updated Branches: refs/heads/master a98357415 -> 6bdad9200 Fix/disable integration tests Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d0dea6b3 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d0dea6b3 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d0dea6b3 Branch: refs/heads/master Commit: d0dea6b39e712ae15e2d5c35766f0994dc623f01 Parents: 41341c4 Author: Svetoslav NeykovAuthored: Tue Jun 6 15:25:59 2017 +0300 Committer: Svetoslav Neykov Committed: Tue Jun 6 15:25:59 2017 +0300 -- .../brooklyn/core/mgmt/ha/HotStandbyTest.java | 9 +++-- .../core/mgmt/rebind/ActivePartialRebindTest.java | 5 ++--- .../policy/ha/ConnectionFailureDetectorTest.java | 18 +- .../base/SoftwareProcessEntityFeedRebindTest.java | 5 - 4 files changed, 30 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d0dea6b3/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HotStandbyTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HotStandbyTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HotStandbyTest.java index 9e3406d..8fc7a0d 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HotStandbyTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HotStandbyTest.java @@ -415,7 +415,8 @@ public class HotStandbyTest { //Failing consistently with error: //Jenkins: java.lang.AssertionError: Too much memory used - 158m > max 154m //Svet local: java.lang.AssertionError: Too much memory used - 16m > max 13m -@Test(groups={"Integration", "Broken"}) +//The test is not deterministic so marking as "Manual", i.e. probably shouldn't be included in automated tests. +@Test(groups={"Integration", "Broken", "Manual"}) public void testHotStandbyDoesNotLeakBigObjects() throws Exception { log.info("Starting test "+JavaClassNames.niceClassAndMethod()); final int SIZE = 5; @@ -463,7 +464,11 @@ public class HotStandbyTest { assertUsedMemoryLessThan("And now all unmanaged", initialUsed+GRACE*1000*1000); } -@Test(groups="Integration") // because it's slow +// Fails on Apache Jenkins with: +// Too much memory used - 160m > max 160m +// Too much memory used - 189m > max 188m +// The test is not deterministic so marking as "Manual", i.e. probably shouldn't be included in automated tests. +@Test(groups={"Integration", "Broken", "Manual"}) // because it's slow // Sept 2014 - there is a small leak, of 200 bytes per child created and destroyed; // but this goes away when the app is destroyed; it may be a benign record public void testHotStandbyDoesNotLeakLotsOfRebindsCreatingAndDestroyingAChildEntity() throws Exception { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d0dea6b3/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/ActivePartialRebindTest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/ActivePartialRebindTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/ActivePartialRebindTest.java index e66bf8b..dab461f 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/ActivePartialRebindTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/ActivePartialRebindTest.java @@ -79,9 +79,8 @@ public class ActivePartialRebindTest extends RebindTestFixtureWithApp { //Failing on Apache Jenkins with: //Expected leak of less than 5M; leak was: from 38m to 43m expected [true] but found [false] -//Perhaps we should create a separate group for these indeterministic (by design) tests and run them -//only manually. -@Test(groups={"Integration", "Broken"}) +//The test is not deterministic so marking as "Manual", i.e. probably shouldn't be included in automated tests. +@Test(groups={"Integration", "Broken", "Manual"}) public void testRebindCheckingMemoryLeak() throws Exception { TestEntity c1 = origApp.addChild(EntitySpec.create(TestEntity.class)); c1.config().set(TestEntity.CONF_NAME, Strings.makeRandomId(100)); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d0dea6b3/policy/src/test/java/org/apache/brooklyn/policy/ha/ConnectionFailureDetectorTest.java -- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/ha/ConnectionFailureDetectorTest.java
[2/2] brooklyn-server git commit: This closes #717
This closes #717 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/6bdad920 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/6bdad920 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/6bdad920 Branch: refs/heads/master Commit: 6bdad9200bf846fd7d43c9f5648da1b63a838028 Parents: a983574 d0dea6b Author: Aled SageAuthored: Mon Jun 12 11:15:12 2017 -0400 Committer: Aled Sage Committed: Mon Jun 12 11:15:12 2017 -0400 -- .../brooklyn/core/mgmt/ha/HotStandbyTest.java | 9 +++-- .../core/mgmt/rebind/ActivePartialRebindTest.java | 5 ++--- .../policy/ha/ConnectionFailureDetectorTest.java | 18 +- .../base/SoftwareProcessEntityFeedRebindTest.java | 5 - 4 files changed, 30 insertions(+), 7 deletions(-) --
[2/2] brooklyn-server git commit: This closes #713
This closes #713 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d7b8b0cc Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d7b8b0cc Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d7b8b0cc Branch: refs/heads/master Commit: d7b8b0cc050e1a8253c059b5bb574d230838d8b2 Parents: a81471d 968a69f Author: Aled SageAuthored: Wed May 31 11:21:58 2017 +0100 Committer: Aled Sage Committed: Wed May 31 11:21:58 2017 +0100 -- .../org/apache/brooklyn/location/jclouds/JcloudsLocation.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --
[1/2] brooklyn-server git commit: Fix for BROOKLYN-510
Repository: brooklyn-server Updated Branches: refs/heads/master a81471d15 -> d7b8b0cc0 Fix for BROOKLYN-510 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/968a69f6 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/968a69f6 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/968a69f6 Branch: refs/heads/master Commit: 968a69f6ba4bef85b1f628be69ccf0898445ff9a Parents: 947d5ae Author: Duncan GodwinAuthored: Tue May 30 17:43:24 2017 +0100 Committer: Duncan Godwin Committed: Tue May 30 17:43:24 2017 +0100 -- .../org/apache/brooklyn/location/jclouds/JcloudsLocation.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/968a69f6/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java -- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java index e91b588..0c3a637 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java @@ -47,6 +47,7 @@ import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nullable; import javax.xml.ws.WebServiceException; +import com.google.common.primitives.Ints; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.location.MachineLocation; @@ -936,8 +937,7 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im } else { LOG.warn("Using DEPRECATED flag OPEN_IPTABLES (will not be supported in future versions) for {} at {}", machineLocation, this); -@SuppressWarnings("unchecked") -Iterable inboundPorts = (Iterable) setup.get(INBOUND_PORTS); +Iterable inboundPorts = Ints.asList(template.getOptions().getInboundPorts()); if (inboundPorts == null || Iterables.isEmpty(inboundPorts)) { LOG.info("No ports to open in iptables (no inbound ports) for {} at {}", machineLocation, this);
[2/2] brooklyn-server git commit: This closes #708
This closes #708 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/dd6d9b78 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/dd6d9b78 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/dd6d9b78 Branch: refs/heads/master Commit: dd6d9b78bba3d45ca63ce84349b481cef37efb66 Parents: 280d0ce a5a20ac Author: Aled SageAuthored: Tue May 30 09:57:41 2017 +0100 Committer: Aled Sage Committed: Tue May 30 09:57:41 2017 +0100 -- .../java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[2/2] brooklyn-server git commit: This closes #705
This closes #705 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/fe6e370e Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/fe6e370e Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/fe6e370e Branch: refs/heads/master Commit: fe6e370e05469ad29380ca63db9ca64cf8e15697 Parents: 6c7751d b845e41 Author: Aled SageAuthored: Mon May 29 12:50:33 2017 +0100 Committer: Aled Sage Committed: Mon May 29 12:50:33 2017 +0100 -- .../jclouds/AbstractJcloudsStubbedUnitTest.java | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) --