You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2015/11/23 19:10:36 UTC
[1/2] incubator-brooklyn git commit: BROOKLYN-193 Test skipping
rebind failures for an entity config value
Repository: incubator-brooklyn
Updated Branches:
refs/heads/master cf4d77b1d -> faf08c116
BROOKLYN-193 Test skipping rebind failures for an entity config value
- Exposed exceptions in RebindTestUtils
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/136663a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/136663a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/136663a4
Branch: refs/heads/master
Commit: 136663a4b3f915763f1c0fff0abc80c7cb32dfea
Parents: 15faad3
Author: Valentin Aitken <va...@cloudsoftcorp.com>
Authored: Mon Nov 23 02:50:40 2015 +0200
Committer: Valentin Aitken <va...@cloudsoftcorp.com>
Committed: Mon Nov 23 14:55:58 2015 +0200
----------------------------------------------------------------------
.../RebindManagerExceptionHandlerTest.java | 86 ++++++++++++++++++++
1 file changed, 86 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/136663a4/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerExceptionHandlerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerExceptionHandlerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerExceptionHandlerTest.java
new file mode 100644
index 0000000..d50ab55
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerExceptionHandlerTest.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.core.mgmt.rebind;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.brooklyn.api.entity.EntitySpec;
+import org.apache.brooklyn.api.mgmt.ManagementContext;
+import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
+import org.apache.brooklyn.core.internal.BrooklynProperties;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.core.test.entity.TestApplication;
+import org.apache.brooklyn.core.test.entity.TestApplicationNoEnrichersImpl;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.test.EntityTestUtils;
+import org.apache.brooklyn.util.exceptions.Exceptions;
+import org.testng.annotations.Test;
+
+public class RebindManagerExceptionHandlerTest extends RebindTestFixtureWithApp {
+
+ @Test(expectedExceptions = {IllegalStateException.class, IllegalArgumentException.class})
+ public void testAddConfigFailure() throws Throwable {
+ origApp.createAndManageChild(EntitySpec.create(TestEntity.class)
+ .configure("test.confMapThing", ImmutableMap.of("keyWithMapValue", ImmutableMap.of("minRam", 4))));
+
+ try {
+ RebindTestUtils.waitForPersisted(origApp);
+ RebindOptions rebindOptions = RebindOptions.create();
+ // Use the original context with empty properties so the test doesn't depend on the local properties file
+ rebindOptions.newManagementContext = origManagementContext;
+ rebind(rebindOptions);
+ } catch (Exception e) {
+ throw Exceptions.getFirstInteresting(e);
+ }
+ }
+
+ @Test
+ public void testAddConfigContinue() throws Throwable {
+ ManagementContext m = createManagementContextWithAddConfigContinue();
+ origApp = ApplicationBuilder.newManagedApp(EntitySpec.create(TestApplication.class, TestApplicationNoEnrichersImpl.class), m);
+ origApp.createAndManageChild(EntitySpec.create(TestEntity.class)
+ .configure("test.confMapThing", ImmutableMap.of("keyWithMapValue", ImmutableMap.of("minRam", 4))));
+
+ RebindTestUtils.waitForPersisted(origApp);
+ RebindOptions rebindOptions = RebindOptions.create();
+ rebindOptions.newManagementContext = m;
+ TestApplication rebindedApp = rebind(rebindOptions);
+ EntityTestUtils.assertConfigEquals(rebindedApp, TestEntity.CONF_MAP_THING, null);
+ }
+
+ private LocalManagementContext createManagementContextWithAddConfigContinue() {
+ BrooklynProperties bp = BrooklynProperties.Factory.newEmpty();
+ bp.putIfAbsent("rebind.failureMode.addConfig", "continue");
+ return RebindTestUtils.managementContextBuilder(mementoDir, classLoader)
+ .properties(bp)
+ .persistPeriodMillis(getPersistPeriodMillis())
+ .forLive(useLiveManagementContext())
+ .emptyCatalog(useEmptyCatalog())
+ .buildStarted();
+ }
+
+ @Override
+ protected LocalManagementContext createOrigManagementContext() {
+ return RebindTestUtils.managementContextBuilder(mementoDir, classLoader)
+ .properties(BrooklynProperties.Factory.newEmpty())
+ .persistPeriodMillis(getPersistPeriodMillis())
+ .forLive(useLiveManagementContext())
+ .emptyCatalog(useEmptyCatalog())
+ .buildStarted();
+ }
+}
[2/2] incubator-brooklyn git commit: This closes #1054
Posted by sj...@apache.org.
This closes #1054
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/faf08c11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/faf08c11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/faf08c11
Branch: refs/heads/master
Commit: faf08c1167d7161858a4ce6a4c8e31d344e0681a
Parents: cf4d77b 136663a
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Mon Nov 23 18:09:58 2015 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Mon Nov 23 18:09:58 2015 +0000
----------------------------------------------------------------------
.../RebindManagerExceptionHandlerTest.java | 86 ++++++++++++++++++++
1 file changed, 86 insertions(+)
----------------------------------------------------------------------