http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/proxying/BasicEntityTypeRegistryTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/proxying/BasicEntityTypeRegistryTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/BasicEntityTypeRegistryTest.java new file mode 100644 index 0000000..dfd0533 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/BasicEntityTypeRegistryTest.java @@ -0,0 +1,135 @@ +/* + * 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.entity.proxying; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.ImplementedBy; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.objs.BasicEntityTypeRegistry; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +public class BasicEntityTypeRegistryTest { + + private BasicEntityTypeRegistry registry; + + @BeforeMethod(alwaysRun=true) + public void setUp() { + registry = new BasicEntityTypeRegistry(); + } + + @AfterMethod + public void tearDown(){ + // nothing to tear down; no management context created + } + + @Test + public void testRegisterAllowsOverridingKey() { + registry.registerImplementation(MyEntity.class, MyEntityImpl.class); + registry.registerImplementation(MyEntity.class, MyEntityImpl2.class); + assertEquals(registry.getImplementedBy(MyEntity.class), MyEntityImpl2.class); + } + + @Test + public void testRegisterForbidsDuplicateValues() { + registry.registerImplementation(MyEntity.class, MyEntityImpl2.class); + try { + registry.registerImplementation(MyEntity2.class, MyEntityImpl2.class); + } catch (IllegalArgumentException e) { + if (!e.toString().contains("already registered against type")) throw e; + } + } + + @Test + public void testGetImplementionLooksUpAnnotations() { + assertEquals(registry.getImplementedBy(MyEntity.class), MyEntityImpl.class); + } + + @Test + public void testGetImplementionUsesRegistryFirst() { + registry.registerImplementation(MyEntity.class, MyEntityImpl2.class); + assertEquals(registry.getImplementedBy(MyEntity.class), MyEntityImpl2.class); + } + + @Test + public void testGetImplementionThrowsIfNoRegistryOrAnnotation() { + try { + Class<?> result = registry.getImplementedBy(MyEntityWithoutAnnotation.class); + fail("result="+result); + } catch (IllegalArgumentException e) { + if (!e.toString().contains("MyEntityWithoutAnnotation is not annotated")) throw e; + } + } + + @Test + public void testGetEntityTypeOfLooksUpAnnotation() { + assertEquals(registry.getEntityTypeOf(MyEntityImpl.class), MyEntity.class); + } + + @Test + public void testGetEntityTypeOfLooksUpRegistry() { + registry.registerImplementation(MyEntity.class, MyEntityImpl2.class); + assertEquals(registry.getEntityTypeOf(MyEntityImpl2.class), MyEntity.class); + } + + @Test + public void testGetEntityTypeOfThrowsIfNoRegistryOrAnnotation() { + try { + Class<?> result = registry.getEntityTypeOf(MyEntityImpl2.class); + fail("result="+result); + } catch (IllegalArgumentException e) { + if (!e.toString().matches(".*Interfaces of .* not annotated.*")) throw e; + } + } + + @Test + public void testGetEntityTypeOfLooksUpAnnotationOnIndirectlyImplementedClasses() { + assertEquals(registry.getEntityTypeOf(MyIndirectEntityImpl.class), MyIndirectEntity.class); + } + + public interface MyEntityWithoutAnnotation extends Entity { + } + + @ImplementedBy(MyEntityImpl.class) + public interface MyEntity extends Entity { + } + + public interface MyEntity2 extends Entity { + } + + public static class MyEntityImpl extends AbstractEntity implements MyEntity { + } + + public static class MyEntityImpl2 extends AbstractEntity implements MyEntity, MyEntity2 { + } + + @ImplementedBy(MyIndirectEntityImpl.class) + public interface MyIndirectEntity extends Entity { + } + + public interface MyIndirectEntitySub extends MyIndirectEntity { + } + + public static class MyIndirectEntityImpl extends AbstractEntity implements MyIndirectEntitySub { + } +}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityManagerTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityManagerTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityManagerTest.java new file mode 100644 index 0000000..315bec4 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityManagerTest.java @@ -0,0 +1,83 @@ +/* + * 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.entity.proxying; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.mgmt.EntityManager; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; +import org.apache.brooklyn.core.objs.proxy.EntityProxy; +import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; +import org.apache.brooklyn.core.test.entity.TestApplication; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.core.test.entity.TestEntityImpl; +import org.apache.brooklyn.test.Asserts; +import org.apache.brooklyn.util.collections.MutableMap; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.google.common.base.Predicates; +import com.google.common.collect.ImmutableList; + +public class EntityManagerTest extends BrooklynAppUnitTestSupport { + + private EntityManager entityManager; + + @BeforeMethod(alwaysRun=true) + @Override + public void setUp() throws Exception { + super.setUp(); + entityManager = mgmt.getEntityManager(); + } + + @Test + public void testCreateEntityUsingSpec() { + TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); + TestEntity child = entity.addChild(EntitySpec.create(TestEntity.class).displayName("mychildname")); + assertTrue(child instanceof EntityProxy, "child="+child); + assertFalse(child instanceof TestEntityImpl, "child="+child); + assertTrue(entity.getChildren().contains(child), "child="+child+"; children="+entity.getChildren()); + assertEquals(child.getDisplayName(), "mychildname"); + } + + @Test + public void testCreateEntityUsingMapAndType() { + TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); + TestEntity child = entity.addChild(EntitySpec.create(MutableMap.of("displayName", "mychildname"), TestEntity.class)); + assertTrue(child instanceof EntityProxy, "child="+child); + assertFalse(child instanceof TestEntityImpl, "child="+child); + assertTrue(entity.getChildren().contains(child), "child="+child+"; children="+entity.getChildren()); + assertEquals(child.getDisplayName(), "mychildname"); + } + + @Test + public void testGetEntities() { + TestApplication app2 = ApplicationBuilder.newManagedApp(TestApplication.class, mgmt); + TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); + TestEntity child = entity.createAndManageChild(EntitySpec.create(TestEntity.class)); + + Asserts.assertEqualsIgnoringOrder(entityManager.getEntitiesInApplication(app), ImmutableList.of(app, entity, child)); + Asserts.assertEqualsIgnoringOrder(entityManager.getEntities(), ImmutableList.of(app, entity, child, app2)); + Asserts.assertEqualsIgnoringOrder(entityManager.findEntities(Predicates.instanceOf(TestApplication.class)), ImmutableList.of(app, app2)); + Asserts.assertEqualsIgnoringOrder(entityManager.findEntitiesInApplication(app, Predicates.instanceOf(TestApplication.class)), ImmutableList.of(app)); + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityProxyTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityProxyTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityProxyTest.java new file mode 100644 index 0000000..48e2460 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/EntityProxyTest.java @@ -0,0 +1,171 @@ +/* + * 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.entity.proxying; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import java.util.Collection; +import java.util.Set; + +import org.apache.brooklyn.api.entity.Application; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.mgmt.EntityManager; +import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.StartableApplication; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; +import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; +import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; +import org.apache.brooklyn.core.objs.proxy.EntityProxy; +import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.util.collections.MutableMap; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; + +public class EntityProxyTest extends BrooklynAppUnitTestSupport { + + private TestEntity entity; + + @BeforeMethod(alwaysRun=true) + @Override + public void setUp() throws Exception { + super.setUp(); + entity = app.createAndManageChild(EntitySpec.create(TestEntity.class)); + } + + @Test + public void testBuiltAppGivesProxies() { + assertIsProxy(entity); + assertIsProxy(app); + } + + @Test + public void testGetChildrenAndParentsReturnsProxies() { + TestEntity child = (TestEntity) Iterables.get(app.getChildren(), 0); + Application parent = (Application) child.getParent(); + + assertIsProxy(child); + assertIsProxy(parent); + } + + @Test + public void testEffectorOnProxyIsRecorded() { + Object result = entity.identityEffector("abc"); + assertEquals(result, "abc"); + + Set<Task<?>> tasks = mgmt.getExecutionManager().getTasksWithAllTags( + ImmutableList.of(ManagementContextInternal.EFFECTOR_TAG, + BrooklynTaskTags.tagForContextEntity(entity))); + Task<?> task = Iterables.get(tasks, 0); + assertEquals(tasks.size(), 1, "tasks="+tasks); + assertTrue(task.getDescription().contains("identityEffector")); + } + + @Test + public void testEntityManagerQueriesGiveProxies() { + EntityManager entityManager = mgmt.getEntityManager(); + + Application retrievedApp = (Application) entityManager.getEntity(app.getId()); + TestEntity retrievedEntity = (TestEntity) entityManager.getEntity(entity.getId()); + + assertIsProxy(retrievedApp); + assertIsProxy(retrievedEntity); + + Collection<Entity> entities = entityManager.getEntities(); + for (Entity e : entities) { + assertIsProxy(e); + } + assertEquals(ImmutableSet.copyOf(entities), ImmutableSet.of(app, entity)); + } + + @Test + public void testCreateAndManageChild() { + TestEntity result = entity.createAndManageChild(EntitySpec.create(TestEntity.class)); + assertIsProxy(result); + assertIsProxy(Iterables.get(entity.getChildren(), 0)); + assertIsProxy(result.getParent()); + assertIsProxy(mgmt.getEntityManager().getEntity(result.getId())); + } + + @Test + public void testDisplayName() { + TestEntity result = entity.createAndManageChild(EntitySpec.create(TestEntity.class).displayName("Boo")); + assertIsProxy(result); + assertEquals(result.getDisplayName(), "Boo"); + } + + @Test + public void testCreateRespectsFlags() { + TestEntity entity2 = app.createAndManageChild(EntitySpec.create(TestEntity.class). + configure("confName", "boo")); + assertEquals(entity2.getConfig(TestEntity.CONF_NAME), "boo"); + } + + @Test + public void testCreateRespectsConfigKey() { + TestEntity entity2 = app.createAndManageChild(EntitySpec.create(TestEntity.class). + configure(TestEntity.CONF_NAME, "foo")); + assertEquals(entity2.getConfig(TestEntity.CONF_NAME), "foo"); + } + + @Test + public void testCreateRespectsConfInMap() { + TestEntity entity2 = app.createAndManageChild(EntitySpec.create(TestEntity.class). + configure(MutableMap.of(TestEntity.CONF_NAME, "bar"))); + assertEquals(entity2.getConfig(TestEntity.CONF_NAME), "bar"); + } + + @Test + public void testCreateRespectsFlagInMap() { + TestEntity entity2 = app.createAndManageChild(EntitySpec.create(TestEntity.class). + configure(MutableMap.of("confName", "baz"))); + assertEquals(entity2.getConfig(TestEntity.CONF_NAME), "baz"); + } + + @Test + public void testCreateInAppWithClassAndMap() { + StartableApplication app2 = null; + try { + ApplicationBuilder appB = new ApplicationBuilder() { + @Override + protected void doBuild() { + addChild(MutableMap.of("confName", "faz"), TestEntity.class); + } + }; + app2 = appB.manage(); + assertEquals(Iterables.getOnlyElement(app2.getChildren()).getConfig(TestEntity.CONF_NAME), "faz"); + } finally { + if (app2 != null) Entities.destroyAll(app2.getManagementContext()); + } + } + + private void assertIsProxy(Entity e) { + assertFalse(e instanceof AbstractEntity, "e="+e+";e.class="+(e != null ? e.getClass() : null)); + assertTrue(e instanceof EntityProxy, "e="+e+";e.class="+(e != null ? e.getClass() : null)); + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/proxying/InternalEntityFactoryTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/proxying/InternalEntityFactoryTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/InternalEntityFactoryTest.java new file mode 100644 index 0000000..9cb7060 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/proxying/InternalEntityFactoryTest.java @@ -0,0 +1,109 @@ +/* + * 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.entity.proxying; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertSame; +import static org.testng.Assert.assertTrue; + +import org.apache.brooklyn.api.entity.Application; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.core.entity.AbstractApplication; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; +import org.apache.brooklyn.core.objs.proxy.EntityProxy; +import org.apache.brooklyn.core.objs.proxy.InternalEntityFactory; +import org.apache.brooklyn.core.objs.proxy.InternalPolicyFactory; +import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; +import org.apache.brooklyn.core.test.entity.TestApplication; +import org.apache.brooklyn.core.test.entity.TestApplicationImpl; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.core.test.entity.TestEntityImpl; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +public class InternalEntityFactoryTest { + + private ManagementContextInternal managementContext; + private InternalEntityFactory factory; + + @BeforeMethod(alwaysRun=true) + public void setUp() throws Exception { + managementContext = new LocalManagementContextForTests(); + InternalPolicyFactory policyFactory = new InternalPolicyFactory(managementContext); + factory = new InternalEntityFactory(managementContext, managementContext.getEntityManager().getEntityTypeRegistry(), policyFactory); + } + + @AfterMethod(alwaysRun=true) + public void tearDown() throws Exception { + if (managementContext != null) Entities.destroyAll(managementContext); + } + + @Test + public void testCreatesEntity() throws Exception { + EntitySpec<TestApplication> spec = EntitySpec.create(TestApplication.class); + TestApplicationImpl app = (TestApplicationImpl) factory.createEntity(spec); + + Entity proxy = app.getProxy(); + assertTrue(proxy instanceof Application, "proxy="+app); + assertFalse(proxy instanceof TestApplicationImpl, "proxy="+app); + + assertEquals(proxy.getParent(), null); + assertSame(proxy.getApplication(), proxy); + } + + @Test + public void testCreatesProxy() throws Exception { + TestApplicationImpl app = new TestApplicationImpl(); + EntitySpec<Application> spec = EntitySpec.create(Application.class).impl(TestApplicationImpl.class); + Application proxy = factory.createEntityProxy(spec, app); + + assertFalse(proxy instanceof TestApplicationImpl, "proxy="+app); + assertTrue(proxy instanceof EntityProxy, "proxy="+app); + } + + @Test + public void testSetsEntityIsLegacyConstruction() throws Exception { + TestEntity legacy = new TestEntityImpl(); + assertTrue(legacy.isLegacyConstruction()); + + TestEntity entity = factory.createEntity(EntitySpec.create(TestEntity.class)); + assertFalse(entity.isLegacyConstruction()); + } + + @Test + public void testCreatesProxyImplementingAdditionalInterfaces() throws Exception { + MyApplicationImpl app = new MyApplicationImpl(); + EntitySpec<Application> spec = EntitySpec.create(Application.class).impl(MyApplicationImpl.class).additionalInterfaces(MyInterface.class); + Application proxy = factory.createEntityProxy(spec, app); + + assertFalse(proxy instanceof MyApplicationImpl, "proxy="+app); + assertTrue(proxy instanceof MyInterface, "proxy="+app); + assertTrue(proxy instanceof EntityProxy, "proxy="+app); + } + + public interface MyInterface { + } + + public static class MyApplicationImpl extends AbstractApplication implements MyInterface { + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntity.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntity.java b/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntity.java new file mode 100644 index 0000000..532eb4d --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntity.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.core.entity.trait; + +import java.util.List; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.ImplementedBy; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.util.core.flags.SetFromFlag; + +import com.google.common.base.Function; +import com.google.common.base.Functions; +import com.google.common.base.Predicate; +import com.google.common.collect.Lists; + +@ImplementedBy(FailingEntityImpl.class) +public interface FailingEntity extends TestEntity { + + @SetFromFlag("failInSubTask") + ConfigKey<Boolean> FAIL_IN_SUB_TASK = ConfigKeys.newBooleanConfigKey("failInSubTask", "Whether to throw exception in a sub-task (if true) or in current thread (if false)", false); + + @SetFromFlag("listener") + ConfigKey<EventListener> LISTENER = ConfigKeys.newConfigKey(EventListener.class, "listener", "Whether to throw exception on call to start", EventListener.NOOP); + + @SetFromFlag("failOnStart") + ConfigKey<Boolean> FAIL_ON_START = ConfigKeys.newBooleanConfigKey("failOnStart", "Whether to throw exception on call to start", false); + + @SetFromFlag("failOnStop") + ConfigKey<Boolean> FAIL_ON_STOP = ConfigKeys.newBooleanConfigKey("failOnStop", "Whether to throw exception on call to stop", false); + + @SetFromFlag("failOnRestart") + ConfigKey<Boolean> FAIL_ON_RESTART = ConfigKeys.newBooleanConfigKey("failOnRestart", "Whether to throw exception on call to restart", false); + + @SetFromFlag("failOnStartCondition") + ConfigKey<Predicate<? super FailingEntity>> FAIL_ON_START_CONDITION = (ConfigKey) ConfigKeys.newConfigKey(Predicate.class, "failOnStartCondition", "Whether to throw exception on call to start", null); + + @SetFromFlag("failOnStopCondition") + ConfigKey<Predicate<? super FailingEntity>> FAIL_ON_STOP_CONDITION = (ConfigKey) ConfigKeys.newConfigKey(Predicate.class, "failOnStopCondition", "Whether to throw exception on call to stop", null); + + @SetFromFlag("failOnRestartCondition") + ConfigKey<Predicate<? super FailingEntity>> FAIL_ON_RESTART_CONDITION = (ConfigKey) ConfigKeys.newConfigKey(Predicate.class, "failOnRestartCondition", "Whether to throw exception on call to restart", null); + + @SetFromFlag("exceptionClazz") + ConfigKey<Class<? extends RuntimeException>> EXCEPTION_CLAZZ = (ConfigKey) ConfigKeys.newConfigKey(Class.class, "exceptionClazz", "Type of exception to throw", IllegalStateException.class); + + @SetFromFlag("execOnFailure") + ConfigKey<Function<? super FailingEntity,?>> EXEC_ON_FAILURE = (ConfigKey) ConfigKeys.newConfigKey(Function.class, "execOnFailure", "Callback to execute before throwing an exception, on any failure", Functions.identity()); + + public interface EventListener { + public static final EventListener NOOP = new EventListener() { + @Override public void onEvent(Entity entity, String action, Object[] args) {} + }; + + public void onEvent(Entity entity, String action, Object[] args); + } + + public static class RecordingEventListener implements EventListener { + public final List<Object[]> events = Lists.newCopyOnWriteArrayList(); + + @Override + public void onEvent(Entity entity, String action, Object[] args) { + events.add(new Object[] {entity, action, args}); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntityImpl.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntityImpl.java b/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntityImpl.java new file mode 100644 index 0000000..e6cf002 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/trait/FailingEntityImpl.java @@ -0,0 +1,87 @@ +/* + * 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.entity.trait; + +import java.util.Collection; + +import org.apache.brooklyn.api.location.Location; +import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.test.entity.TestEntityImpl; +import org.apache.brooklyn.util.core.task.Tasks; +import org.apache.brooklyn.util.exceptions.Exceptions; +import org.testng.Assert; + +public class FailingEntityImpl extends TestEntityImpl implements FailingEntity { + + public FailingEntityImpl() { + } + + @Override + public void start(Collection<? extends Location> locs) { + getConfig(LISTENER).onEvent(this, "start", new Object[] {locs}); + if (getConfig(FAIL_ON_START) || (getConfig(FAIL_ON_START_CONDITION) != null && getConfig(FAIL_ON_START_CONDITION).apply(this))) { + callHistory.add("start"); + getConfig(EXEC_ON_FAILURE).apply(this); + throw fail("Simulating entity start failure for test"); + } + super.start(locs); + } + + @Override + public void stop() { + getConfig(LISTENER).onEvent(this, "stop", new Object[0]); + if (getConfig(FAIL_ON_STOP) || (getConfig(FAIL_ON_STOP_CONDITION) != null && getConfig(FAIL_ON_STOP_CONDITION).apply(this))) { + callHistory.add("stop"); + getConfig(EXEC_ON_FAILURE).apply(this); + throw fail("Simulating entity stop failure for test"); + } + super.stop(); + } + + @Override + public void restart() { + getConfig(LISTENER).onEvent(this, "restart", new Object[0]); + if (getConfig(FAIL_ON_RESTART) || (getConfig(FAIL_ON_RESTART_CONDITION) != null && getConfig(FAIL_ON_RESTART_CONDITION).apply(this))) { + callHistory.add("restart"); + getConfig(EXEC_ON_FAILURE).apply(this); + throw fail("Simulating entity restart failure for test"); + } + super.restart(); + } + + private RuntimeException fail(final String msg) { + if (getConfig(FAIL_IN_SUB_TASK)) { + Task<?> task = Tasks.builder().name(msg).body(new Runnable() { public void run() { throw newException(msg); } }).build(); + Entities.submit(this, task).getUnchecked(); + Assert.fail("Should have thrown exception on task.getUnchecked"); + throw new IllegalStateException("unreachable code"); + } else { + throw newException(msg); + } + } + + private RuntimeException newException(String msg) { + try { + return getConfig(EXCEPTION_CLAZZ).getConstructor(String.class).newInstance("Simulating entity stop failure for test"); + } catch (Exception e) { + throw Exceptions.propagate(e); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/entity/trait/StartableMethodsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/trait/StartableMethodsTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/trait/StartableMethodsTest.java new file mode 100644 index 0000000..edfaf36 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/trait/StartableMethodsTest.java @@ -0,0 +1,127 @@ +/* + * 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.entity.trait; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.trait.StartableMethods; +import org.apache.brooklyn.core.entity.trait.FailingEntity.RecordingEventListener; +import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.util.core.task.Tasks; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import org.apache.brooklyn.location.core.SimulatedLocation; + +import com.google.common.collect.ImmutableList; + +public class StartableMethodsTest extends BrooklynAppUnitTestSupport { + + private SimulatedLocation loc; + private TestEntity entity; + private TestEntity entity2; + private RecordingEventListener listener; + + @BeforeMethod(alwaysRun=true) + @Override + public void setUp() throws Exception { + super.setUp(); + loc = new SimulatedLocation(); + listener = new RecordingEventListener(); + } + + @Test + public void testStopSequentially() { + entity = app.createAndManageChild(EntitySpec.create(FailingEntity.class) + .configure(FailingEntity.LISTENER, listener)); + entity2 = app.createAndManageChild(EntitySpec.create(FailingEntity.class) + .configure(FailingEntity.LISTENER, listener)); + app.start(ImmutableList.of(loc)); + listener.events.clear(); + + StartableMethods.stopSequentially(ImmutableList.of(entity, entity2)); + + assertEquals(listener.events.get(0)[0], entity); + assertEquals(listener.events.get(1)[0], entity2); + } + + @Test + public void testStopSequentiallyContinuesOnFailure() { + try { + entity = app.createAndManageChild(EntitySpec.create(FailingEntity.class) + .configure(FailingEntity.FAIL_ON_STOP, true) + .configure(FailingEntity.LISTENER, listener)); + entity2 = app.createAndManageChild(EntitySpec.create(FailingEntity.class) + .configure(FailingEntity.LISTENER, listener)); + app.start(ImmutableList.of(loc)); + listener.events.clear(); + + try { + StartableMethods.stopSequentially(ImmutableList.of(entity, entity2)); + fail(); + } catch (Exception e) { + // success; expected exception to be propagated + } + + assertEquals(listener.events.get(0)[0], entity); + assertEquals(listener.events.get(1)[0], entity2); + } finally { + // get rid of entity that will fail on stop, so that tearDown won't encounter exception + Entities.unmanage(entity); + } + } + + @Test + public void testStopSequentiallyContinuesOnFailureInSubTask() throws Exception { + try { + entity = app.createAndManageChild(EntitySpec.create(FailingEntity.class) + .configure(FailingEntity.FAIL_ON_STOP, true) + .configure(FailingEntity.FAIL_IN_SUB_TASK, true) + .configure(FailingEntity.LISTENER, listener)); + entity2 = app.createAndManageChild(EntitySpec.create(FailingEntity.class) + .configure(FailingEntity.LISTENER, listener)); + app.start(ImmutableList.of(loc)); + listener.events.clear(); + + try { + Task<?> task = Tasks.builder().name("stopSequentially") + .body(new Runnable() { + @Override public void run() { + StartableMethods.stopSequentially(ImmutableList.of(entity, entity2)); + }}) + .build(); + Entities.submit(app, task).getUnchecked(); + fail(); + } catch (Exception e) { + // success; expected exception to be propagated + if (!(e.toString().contains("Error stopping"))) throw e; + } + + assertEquals(listener.events.get(0)[0], entity); + assertEquals(listener.events.get(1)[0], entity2); + } finally { + // get rid of entity that will fail on stop, so that tearDown won't encounter exception + Entities.unmanage(entity); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/AcmeEntitlementManagerTestFixture.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/AcmeEntitlementManagerTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/AcmeEntitlementManagerTestFixture.java index 9ad35e5..86dba94 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/AcmeEntitlementManagerTestFixture.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/AcmeEntitlementManagerTestFixture.java @@ -25,6 +25,8 @@ import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements; import org.apache.brooklyn.core.mgmt.entitlement.NotEntitledException; @@ -32,8 +34,6 @@ import org.apache.brooklyn.core.mgmt.entitlement.WebEntitlementContext; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntityAndItem; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.StringAndArgument; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.entity.stock.BasicApplication; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementsTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementsTest.java index f0a5e25..a22d45c 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementsTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntitlementsTest.java @@ -25,13 +25,13 @@ import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.api.mgmt.entitlement.EntitlementManager; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntityAndItem; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.StringAndArgument; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.entity.stock.BasicApplication; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntityEntitlementTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntityEntitlementTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntityEntitlementTest.java index d771915..933d117 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntityEntitlementTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/entitlement/EntityEntitlementTest.java @@ -22,6 +22,8 @@ import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements; import org.apache.brooklyn.core.mgmt.entitlement.NotEntitledException; @@ -29,8 +31,6 @@ import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.EntityAndItem; import org.apache.brooklyn.core.mgmt.entitlement.Entitlements.StringAndArgument; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.entity.stock.BasicApplication; import org.apache.brooklyn.util.core.config.ConfigBag; import org.apache.brooklyn.util.exceptions.Exceptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerInMemoryTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerInMemoryTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerInMemoryTest.java index 6970c2e..36e0fa2 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerInMemoryTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerInMemoryTest.java @@ -26,13 +26,13 @@ import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.NoMachinesAvailableException; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; +import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.persist.InMemoryObjectStore; import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.EntityInternal; import org.apache.brooklyn.util.collections.MutableList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java index 7dfe727..6f80a5c 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerSplitBrainTest.java @@ -35,6 +35,8 @@ 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.core.BrooklynFeatureEnablement; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl; import org.apache.brooklyn.core.mgmt.ha.ManagementPlaneSyncRecordPersisterToObjectStore; import org.apache.brooklyn.core.mgmt.ha.TestEntityFailingRebind.RebindException; @@ -47,8 +49,6 @@ import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore; import org.apache.brooklyn.core.mgmt.rebind.PersistenceExceptionHandlerImpl; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerTestFixture.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerTestFixture.java index 5130a58..732ab81 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerTestFixture.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerTestFixture.java @@ -33,6 +33,7 @@ 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.core.BrooklynVersion; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl; import org.apache.brooklyn.core.mgmt.ha.ManagementPlaneSyncRecordDeltaImpl; import org.apache.brooklyn.core.mgmt.ha.ManagementPlaneSyncRecordPersisterToObjectStore; @@ -45,7 +46,6 @@ import org.apache.brooklyn.core.mgmt.persist.PersistMode; import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore; import org.apache.brooklyn.core.mgmt.rebind.PersistenceExceptionHandlerImpl; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.time.Duration; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/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 89a0889..1ee7053 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 @@ -38,6 +38,7 @@ import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister; import org.apache.brooklyn.api.sensor.Feed; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl; import org.apache.brooklyn.core.mgmt.ha.ManagementPlaneSyncRecordPersisterToObjectStore; import org.apache.brooklyn.core.mgmt.internal.AbstractManagementContext; @@ -55,7 +56,6 @@ import org.apache.brooklyn.core.mgmt.rebind.RebindFeedTest.MyEntityWithNewFeedsE import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.test.EntityTestUtils; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/MasterChooserTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/MasterChooserTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/MasterChooserTest.java index 1ffbe1b..d3631ee 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/MasterChooserTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/MasterChooserTest.java @@ -26,10 +26,10 @@ import java.util.List; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeSyncRecord; import org.apache.brooklyn.core.BrooklynVersion; +import org.apache.brooklyn.core.entity.EntityFunctions; import org.apache.brooklyn.core.mgmt.ha.BasicMasterChooser.AlphabeticMasterChooser; import org.apache.brooklyn.core.mgmt.ha.BasicMasterChooser.ScoredRecord; import org.apache.brooklyn.core.mgmt.ha.dto.BasicManagementNodeSyncRecord; -import org.apache.brooklyn.entity.core.EntityFunctions; import org.apache.brooklyn.util.time.Duration; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/WarmStandbyTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/WarmStandbyTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/WarmStandbyTest.java index ab76e19..830f472 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/WarmStandbyTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/ha/WarmStandbyTest.java @@ -28,6 +28,7 @@ import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.api.mgmt.ha.ManagementPlaneSyncRecordPersister; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.ha.HighAvailabilityManagerImpl; import org.apache.brooklyn.core.mgmt.ha.ManagementPlaneSyncRecordPersisterToObjectStore; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; @@ -39,7 +40,6 @@ import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore; import org.apache.brooklyn.core.mgmt.rebind.PersistenceExceptionHandlerImpl; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.util.collections.MutableList; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.time.Duration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/AccessManagerTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/AccessManagerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/AccessManagerTest.java index 74dbe56..2698dcf 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/AccessManagerTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/AccessManagerTest.java @@ -26,12 +26,12 @@ import static org.testng.Assert.fail; 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.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.util.exceptions.Exceptions; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java index da9f614..d69294b 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/internal/EntityExecutionManagerTest.java @@ -34,6 +34,9 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.mgmt.ExecutionManager; import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityInternal; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags.WrappedEntity; @@ -43,9 +46,6 @@ import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityInternal; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.sensor.core.BasicAttributeSensor; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/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 d32dda1..1e5dda1 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 @@ -33,9 +33,9 @@ import org.apache.brooklyn.api.mgmt.SubscriptionHandle; import org.apache.brooklyn.api.mgmt.SubscriptionManager; import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.entity.group.BasicGroup; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiPathTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiPathTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiPathTest.java index 8fbb54e..6e0a248 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiPathTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiPathTest.java @@ -21,12 +21,12 @@ package org.apache.brooklyn.core.mgmt.osgi; import java.io.File; import java.io.IOException; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.server.BrooklynServerConfig; import org.apache.brooklyn.core.server.BrooklynServerPaths; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.util.os.Os; import org.apache.brooklyn.util.text.Identifiers; import org.osgi.framework.BundleException; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java index f5596cf..c03fba9 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/osgi/OsgiVersionMoreEntityTest.java @@ -42,6 +42,7 @@ import org.apache.brooklyn.core.catalog.internal.CatalogItemBuilder; import org.apache.brooklyn.core.catalog.internal.CatalogItemDtoAbstract; import org.apache.brooklyn.core.catalog.internal.CatalogTestUtils; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContext; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; @@ -50,7 +51,6 @@ import org.apache.brooklyn.core.objs.proxy.InternalPolicyFactory; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.apache.brooklyn.util.core.osgi.Osgis; import org.apache.brooklyn.util.guava.Maybe; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterInMemorySizeIntegrationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterInMemorySizeIntegrationTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterInMemorySizeIntegrationTest.java index 0c49d12..3f5c482 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterInMemorySizeIntegrationTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterInMemorySizeIntegrationTest.java @@ -22,10 +22,10 @@ import java.io.IOException; import java.util.concurrent.TimeoutException; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.mgmt.persist.ListeningObjectStore.RecordingTransactionListener; import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.EntityInternal; import org.apache.brooklyn.util.text.Identifiers; import org.apache.brooklyn.util.time.Duration; import org.apache.brooklyn.util.time.Time; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterTestFixture.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterTestFixture.java index a715d2e..f751bcb 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterTestFixture.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/BrooklynMementoPersisterTestFixture.java @@ -35,6 +35,8 @@ import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister; import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoRawData; import org.apache.brooklyn.api.policy.Policy; import org.apache.brooklyn.api.sensor.Enricher; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore; import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore; import org.apache.brooklyn.core.mgmt.rebind.PersistenceExceptionHandlerImpl; @@ -44,8 +46,6 @@ import org.apache.brooklyn.core.mgmt.rebind.RecordingRebindExceptionHandler; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.test.policy.TestPolicy; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.sensor.enricher.Enrichers; import org.testng.SkipException; import org.testng.annotations.AfterMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/FileBasedObjectStoreTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/FileBasedObjectStoreTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/FileBasedObjectStoreTest.java index 05ac078..fc681dc 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/FileBasedObjectStoreTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/FileBasedObjectStoreTest.java @@ -26,10 +26,10 @@ import java.io.File; import java.io.FileNotFoundException; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.persist.FileBasedObjectStore; import org.apache.brooklyn.core.mgmt.persist.PersistMode; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.util.io.FileUtil; import org.apache.brooklyn.util.os.Os; import org.testng.annotations.AfterMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java index d95cc0a..30fe628 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializerTest.java @@ -54,13 +54,13 @@ import org.apache.brooklyn.api.sensor.Feed; import org.apache.brooklyn.core.catalog.internal.CatalogItemBuilder; import org.apache.brooklyn.core.catalog.internal.CatalogItemDtoAbstract; import org.apache.brooklyn.core.catalog.internal.CatalogTestUtils; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources; import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest; import org.apache.brooklyn.core.mgmt.persist.XmlMementoSerializer; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.entity.group.DynamicCluster; import com.google.common.base.Objects; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/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 8ed0df9..bf74df9 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 @@ -21,11 +21,11 @@ package org.apache.brooklyn.core.mgmt.rebind; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.objs.BrooklynObject; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.AbstractEntity; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityInternal; import org.apache.brooklyn.util.text.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/CheckpointEntityTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/CheckpointEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/CheckpointEntityTest.java index 44b9dfd..dae43a7 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/CheckpointEntityTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/CheckpointEntityTest.java @@ -27,9 +27,9 @@ import javax.annotation.Nullable; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.mgmt.rebind.RebindEntityTest.MyEntity; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityInternal; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java index 255a146..26e087c 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java @@ -36,12 +36,12 @@ import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.core.catalog.internal.CatalogInitialization; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.AbstractApplication; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityInternal; +import org.apache.brooklyn.core.entity.StartableApplication; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; -import org.apache.brooklyn.entity.core.AbstractApplication; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityInternal; -import org.apache.brooklyn.entity.core.StartableApplication; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.sensor.core.Sensors; import org.apache.brooklyn.test.TestResourceUnavailableException; import org.apache.brooklyn.util.core.javalang.UrlClassLoader; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindDynamicGroupTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindDynamicGroupTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindDynamicGroupTest.java index 380eb6c..7232e52 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindDynamicGroupTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindDynamicGroupTest.java @@ -24,8 +24,8 @@ import java.util.Collection; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.rebind.RebindEntityTest.MyEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.entity.group.DynamicGroup; import org.apache.brooklyn.test.Asserts; import org.testng.annotations.Test; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java index c44c9ca..b0e5b7b 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEnricherTest.java @@ -34,12 +34,12 @@ import org.apache.brooklyn.api.sensor.Enricher; import org.apache.brooklyn.api.sensor.EnricherSpec; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityInternal; +import org.apache.brooklyn.core.entity.EntityPredicates; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.test.entity.TestEntityImpl; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityInternal; -import org.apache.brooklyn.entity.core.EntityPredicates; import org.apache.brooklyn.entity.group.DynamicCluster; import org.apache.brooklyn.sensor.core.Sensors; import org.apache.brooklyn.sensor.enricher.AbstractEnricher; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java index a3cff85..ea02b23 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java @@ -54,18 +54,18 @@ import org.apache.brooklyn.api.sensor.SensorEventListener; import org.apache.brooklyn.api.sensor.AttributeSensor.SensorPersistenceMode; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.BasicConfigKey; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityPredicates; +import org.apache.brooklyn.core.entity.trait.Resizable; +import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.rebind.BasicEntityRebindSupport; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.test.entity.TestEntityImpl; -import org.apache.brooklyn.entity.core.AbstractEntity; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityPredicates; import org.apache.brooklyn.entity.group.AbstractGroupImpl; import org.apache.brooklyn.entity.group.BasicGroup; -import org.apache.brooklyn.entity.trait.Resizable; -import org.apache.brooklyn.entity.trait.Startable; import org.apache.brooklyn.sensor.core.BasicAttributeSensor; import org.apache.brooklyn.sensor.core.BasicSensorEvent; import org.apache.brooklyn.sensor.core.DependentConfiguration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFailuresTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFailuresTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFailuresTest.java index c5cd0da..b43d62b 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFailuresTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFailuresTest.java @@ -42,12 +42,12 @@ import org.apache.brooklyn.api.sensor.EnricherSpec; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.config.ConfigMap; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.EntityFunctions; +import org.apache.brooklyn.core.entity.EntityPredicates; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.rebind.RebindEntityTest.MyEntity; import org.apache.brooklyn.core.mgmt.rebind.RebindEntityTest.MyEntityImpl; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.core.EntityFunctions; -import org.apache.brooklyn.entity.core.EntityPredicates; import org.apache.brooklyn.policy.core.AbstractPolicy; import org.apache.brooklyn.sensor.enricher.AbstractEnricher; import org.apache.brooklyn.util.core.flags.SetFromFlag; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java index f27bf65..cdfd87d 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindFeedTest.java @@ -30,10 +30,10 @@ import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.Feed; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.internal.BrooklynGarbageCollector; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.test.entity.TestEntityImpl.TestEntityWithoutEnrichers; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.sensor.core.Sensors; import org.apache.brooklyn.sensor.feed.function.FunctionFeed; import org.apache.brooklyn.sensor.feed.function.FunctionPollConfig; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindGroupTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindGroupTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindGroupTest.java index cab3f10..f1e111f 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindGroupTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindGroupTest.java @@ -25,8 +25,8 @@ import java.util.List; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.entity.ImplementedBy; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.entity.group.AbstractGroup; import org.apache.brooklyn.entity.group.AbstractGroupImpl; import org.apache.brooklyn.entity.group.BasicGroup; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerSorterTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerSorterTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerSorterTest.java index b0d047f..6387b81 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerSorterTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerSorterTest.java @@ -31,11 +31,11 @@ import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.api.mgmt.rebind.mementos.EntityMemento; import org.apache.brooklyn.api.mgmt.rebind.mementos.TreeNode; import org.apache.brooklyn.api.objs.Identifiable; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl; import org.apache.brooklyn.core.mgmt.rebind.dto.MementosGenerators; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.util.collections.MutableSet; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java index 55386b8..70003a0 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java @@ -35,10 +35,10 @@ import org.apache.brooklyn.api.policy.PolicySpec; import org.apache.brooklyn.api.sensor.EnricherSpec; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.rebind.RebindEnricherTest.MyEnricher; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.Entities; import org.apache.brooklyn.entity.group.BasicGroup; import org.apache.brooklyn.policy.core.AbstractPolicy; import org.apache.brooklyn.sensor.enricher.AbstractEnricher; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java index d75e563..df2e658 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java @@ -41,15 +41,15 @@ import org.apache.brooklyn.api.mgmt.rebind.RebindExceptionHandler; import org.apache.brooklyn.api.mgmt.rebind.RebindManager; import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoManifest; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityFunctions; +import org.apache.brooklyn.core.entity.StartableApplication; +import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore; import org.apache.brooklyn.core.mgmt.persist.FileBasedObjectStore; import org.apache.brooklyn.core.mgmt.persist.PersistMode; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.core.EntityFunctions; -import org.apache.brooklyn.entity.core.StartableApplication; -import org.apache.brooklyn.entity.trait.Startable; import org.apache.brooklyn.util.core.task.BasicExecutionManager; import org.apache.brooklyn.util.os.Os; import org.apache.brooklyn.util.repeat.Repeater; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixtureWithApp.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixtureWithApp.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixtureWithApp.java index 3ad1bbc..554d73d 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixtureWithApp.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixtureWithApp.java @@ -19,9 +19,9 @@ package org.apache.brooklyn.core.mgmt.rebind; import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestApplicationNoEnrichersImpl; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; public class RebindTestFixtureWithApp extends RebindTestFixture<TestApplication> { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java b/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java index b989d74..e08d32b 100644 --- a/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java @@ -22,9 +22,9 @@ import static org.testng.Assert.assertEquals; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.mgmt.SubscriptionHandle; +import org.apache.brooklyn.core.entity.RecordingSensorEventListener; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.entity.core.RecordingSensorEventListener; import org.apache.brooklyn.location.core.SimulatedLocation; import org.apache.brooklyn.policy.core.AbstractPolicy; import org.apache.brooklyn.sensor.core.BasicSensorEvent; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java b/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java index 74e86a4..c0b864d 100644 --- a/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java @@ -25,14 +25,14 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.api.sensor.SensorEventListener; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.server.entity.BrooklynMetrics; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; 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.core.test.entity.TestEntityNoEnrichersImpl; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.time.Duration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c27cf1d0/core/src/test/java/org/apache/brooklyn/core/test/BrooklynAppLiveTestSupport.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/test/BrooklynAppLiveTestSupport.java b/core/src/test/java/org/apache/brooklyn/core/test/BrooklynAppLiveTestSupport.java index 3d035ca..d165eda 100644 --- a/core/src/test/java/org/apache/brooklyn/core/test/BrooklynAppLiveTestSupport.java +++ b/core/src/test/java/org/apache/brooklyn/core/test/BrooklynAppLiveTestSupport.java @@ -18,12 +18,12 @@ */ package org.apache.brooklyn.core.test; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.internal.BrooklynProperties; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.entity.core.Entities; -import org.apache.brooklyn.entity.factory.ApplicationBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod;
