http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/core/src/test/java/org/apache/brooklyn/effector/core/EffectorSayHiTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/effector/core/EffectorSayHiTest.java b/core/src/test/java/org/apache/brooklyn/effector/core/EffectorSayHiTest.java deleted file mode 100644 index 828cbd7..0000000 --- a/core/src/test/java/org/apache/brooklyn/effector/core/EffectorSayHiTest.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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.effector.core; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.brooklyn.api.effector.Effector; -import org.apache.brooklyn.api.effector.ParameterType; -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.api.mgmt.ExecutionContext; -import org.apache.brooklyn.api.mgmt.Task; -import org.apache.brooklyn.core.annotation.EffectorParam; -import org.apache.brooklyn.core.entity.AbstractEntity; -import org.apache.brooklyn.core.entity.trait.Startable; -import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; -import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; -import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; -import org.apache.brooklyn.effector.core.MethodEffector; -import org.apache.brooklyn.util.collections.MutableMap; -import org.apache.brooklyn.util.core.task.BasicTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; - -/** - * Test the operation of the {@link Effector} implementations. - * - * TODO clarify test purpose - */ -public class EffectorSayHiTest extends BrooklynAppUnitTestSupport { - - //TODO test edge/error conditions - //(missing parameters, wrong number of params, etc) - - private static final Logger log = LoggerFactory.getLogger(EffectorSayHiTest.class); - - private MyEntity e; - - @BeforeMethod(alwaysRun=true) - @Override - public void setUp() throws Exception { - super.setUp(); - e = app.createAndManageChild(EntitySpec.create(MyEntity.class)); - } - - @Test - public void testFindEffectorMetaData() { - assertEquals("sayHi1", e.SAY_HI_1.getName()); - assertEquals("says hello", e.SAY_HI_1.getDescription()); - - assertEquals(ImmutableList.of("name", "greeting"), getParameterNames(e.SAY_HI_1)); - assertEquals(MutableMap.of("name", null, "greeting", "what to say"), getParameterDescriptions(e.SAY_HI_1)); - } - - @Test - public void testFindTraitEffectors() { - assertEquals(ImmutableList.of("locations"), getParameterNames(Startable.START)); - } - - @Test - public void testInvokeEffectors1() throws Exception { - assertEquals("hi Bob", e.sayHi1("Bob", "hi")); - - assertEquals("hi Bob", e.SAY_HI_1.call(e, ImmutableMap.of("name", "Bob", "greeting", "hi")) ); - assertEquals("hi Bob", e.invoke(e.SAY_HI_1, ImmutableMap.of("name", "Bob", "greeting", "hi")).get() ); - - // and with default greeting param value - assertEquals("hi Bob", e.SAY_HI_1.call(e, ImmutableMap.of("name", "Bob", "greeting", "hi")) ); - assertEquals("hello Bob", e.invoke(e.SAY_HI_1, ImmutableMap.of("name", "Bob")).get() ); - } - - @Test - public void testCanRetrieveTaskForEffector() { - e.sayHi1("Bob", "hi"); - - Set<Task<?>> tasks = mgmt.getExecutionManager().getTasksWithAllTags(ImmutableList.of( - BrooklynTaskTags.tagForContextEntity(e),ManagementContextInternal.EFFECTOR_TAG)); - assertEquals(tasks.size(), 1); - assertTrue(tasks.iterator().next().getDescription().contains("sayHi1")); - } - - @Test - public void testDelegatedNestedEffectorNotRepresentedAsTask() { - e.delegateSayHi1("Bob", "hi"); - - Set<Task<?>> tasks = mgmt.getExecutionManager().getTasksWithAllTags(ImmutableList.of( - BrooklynTaskTags.tagForContextEntity(e),ManagementContextInternal.EFFECTOR_TAG)); - assertEquals(tasks.size(), 1); - assertTrue(tasks.iterator().next().getDescription().contains("delegateSayHi1")); - assertFalse(tasks.iterator().next().getDescription().contains("sayHi1")); - } - - @Test - public void testCanExcludeNonEffectorTasks() throws Exception { - ExecutionContext executionContext = mgmt.getExecutionContext(e); - executionContext.submit(new BasicTask<Void>(new Runnable() { public void run() {} })); - - Set<Task<?>> effectTasks = mgmt.getExecutionManager().getTasksWithAllTags(ImmutableList.of( - BrooklynTaskTags.tagForContextEntity(e),ManagementContextInternal.EFFECTOR_TAG)); - assertEquals(effectTasks.size(), 0); - } - - public interface CanSayHi { - static MethodEffector<String> SAY_HI_1 = new MethodEffector<String>(CanSayHi.class, "sayHi1"); - static MethodEffector<String> DELEGATE_SAY_HI_1 = new MethodEffector<String>(CanSayHi.class, "delegateSayHi1"); - - @org.apache.brooklyn.core.annotation.Effector(description="says hello") - public String sayHi1( - @EffectorParam(name="name") String name, - @EffectorParam(name="greeting", defaultValue="hello", description="what to say") String greeting); - - @org.apache.brooklyn.core.annotation.Effector(description="delegate says hello") - public String delegateSayHi1( - @EffectorParam(name="name") String name, - @EffectorParam(name="greeting") String greeting); - } - - @ImplementedBy(MyEntityImpl.class) - public interface MyEntity extends Entity, CanSayHi { - } - - public static class MyEntityImpl extends AbstractEntity implements MyEntity { - @Override - public String sayHi1(String name, String greeting) { - return greeting+" "+name; - } - @Override - public String delegateSayHi1(String name, String greeting) { - return sayHi1(name, greeting); - } - } - - private List<String> getParameterNames(Effector<?> effector) { - return ImmutableList.copyOf(getParameterDescriptions(effector).keySet()); - } - - private Map<String, String> getParameterDescriptions(Effector<?> effector) { - Map<String,String> result = Maps.newLinkedHashMap(); - for (ParameterType<?> parameter : effector.getParameters()) { - result.put(parameter.getName(), parameter.getDescription()); - } - return result; - } -}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/core/src/test/java/org/apache/brooklyn/effector/core/EffectorTaskTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/effector/core/EffectorTaskTest.java b/core/src/test/java/org/apache/brooklyn/effector/core/EffectorTaskTest.java deleted file mode 100644 index 7d8a4f5..0000000 --- a/core/src/test/java/org/apache/brooklyn/effector/core/EffectorTaskTest.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - * 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.effector.core; - -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.brooklyn.api.effector.Effector; -import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.entity.EntitySpec; -import org.apache.brooklyn.api.mgmt.HasTaskChildren; -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.EntityInternal; -import org.apache.brooklyn.core.entity.trait.Startable; -import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; -import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; -import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.EffectorTasks; -import org.apache.brooklyn.effector.core.EffectorWithBody; -import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.effector.core.EffectorTasks.EffectorTaskFactory; -import org.apache.brooklyn.util.collections.MutableMap; -import org.apache.brooklyn.util.core.config.ConfigBag; -import org.apache.brooklyn.util.core.task.DynamicSequentialTask; -import org.apache.brooklyn.util.core.task.DynamicTasks; -import org.apache.brooklyn.util.core.task.TaskBuilder; -import org.apache.brooklyn.util.core.task.Tasks; -import org.apache.brooklyn.util.exceptions.Exceptions; -import org.testng.Assert; -import org.testng.annotations.Test; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; - -public class EffectorTaskTest extends BrooklynAppUnitTestSupport { - - // ----------- syntax 1 -- effector with body in a class - - public static final Effector<Integer> DOUBLE_1 = Effectors.effector(Integer.class, "double") - .description("doubles the given number") - .parameter(Integer.class, "numberToDouble") - .impl(new EffectorBody<Integer>() { - @Override - public Integer call(ConfigBag parameters) { - // do a sanity check - Assert.assertNotNull(entity()); - - // finally double the input - return 2*(Integer)parameters.getStringKey("numberToDouble"); - } - }) - .build(); - - public static class DoublingEntity extends AbstractEntity { - public static final Effector<Integer> DOUBLE = EffectorTaskTest.DOUBLE_1; - } - - @Test - public void testSyntaxOneDouble1() throws Exception { - // just use "dynamic" support of effector - Assert.assertEquals(app.invoke(DOUBLE_1, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - @Test - public void testSyntaxOneTaggedCorrectly() throws Exception { - Task<Integer> t = app.invoke(DOUBLE_1, MutableMap.of("numberToDouble", 3)); - t.get(); - checkTags(t, app, DOUBLE_1, false); - } - - @Test - // also assert it works when the effector is defined on an entity - public void testSimpleEffectorOnEntity() throws Exception { - Entity doubler = app.createAndManageChild(EntitySpec.create(Entity.class, DoublingEntity.class)); - - Assert.assertEquals(doubler.invoke(DOUBLE_1, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - @Test - // also assert it works when an abstract effector name is passed in to the entity - public void testSimpleEffectorNameMatching() throws Exception { - Entity doubler = app.createAndManageChild(EntitySpec.create(Entity.class, DoublingEntity.class)); - - Assert.assertEquals(doubler.invoke(Effectors.effector(Integer.class, "double").buildAbstract(), MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - - // ----------- syntax 2 -- effector with body built with fluent API - - public static EffectorTaskFactory<Integer> times(final EffectorTaskFactory<Integer> x, final int y) { - return new EffectorTaskFactory<Integer>() { - @Override - public Task<Integer> newTask(final Entity entity, final Effector<Integer> effector, final ConfigBag parameters) { - return TaskBuilder.<Integer>builder().name("times").body(new Callable<Integer>() { public Integer call() { - return DynamicTasks.get( x.newTask(entity, effector, parameters) )*y; - } }).build(); - } - }; - } - - public static final Effector<Integer> DOUBLE_2 = Effectors.effector(Integer.class, "double") - .description("doubles the given number") - .parameter(Integer.class, "numberToDouble") - .impl(times(EffectorTasks.parameter(Integer.class, "numberToDouble"), 2)) - .build(); - - @Test - public void testSyntaxTwoDouble2() throws Exception { - Assert.assertEquals(app.invoke(DOUBLE_2, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - @Test - public void testEffectorImplTaggedCorrectly() throws Exception { - Task<Integer> t = app.invoke(DOUBLE_2, MutableMap.of("numberToDouble", 3)); - t.get(); - checkTags(t, app, DOUBLE_2, true); - } - - public static final Effector<Integer> DOUBLE_CALL_ABSTRACT = Effectors.effector(Integer.class, "double_call") - .description("doubles the given number") - .parameter(Integer.class, "numberToDouble") - .buildAbstract(); - public static final Effector<Integer> DOUBLE_CALL = Effectors.effector(DOUBLE_CALL_ABSTRACT) - .impl(new EffectorBody<Integer>() { - @Override - public Integer call(ConfigBag parameters) { - final Entity parent = entity(); - final Entity child = Iterables.getOnlyElement(entity().getChildren()); - - final Effector<Integer> DOUBLE_CHECK_ABSTRACT = Effectors.effector(Integer.class, "double_check") - .description("doubles the given number and checks tags, assuming double exists as an effector here") - .parameter(Integer.class, "numberToDouble") - .buildAbstract(); - Effector<Integer> DOUBLE_CHECK = Effectors.effector(DOUBLE_CHECK_ABSTRACT) - .impl(new EffectorBody<Integer>() { - @Override - public Integer call(ConfigBag parameters) { - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), child, null, false)); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), child, DOUBLE_CHECK_ABSTRACT, false)); - Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(Tasks.current(), child, DOUBLE_1, false)); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, null, true)); - Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, null, false)); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, DOUBLE_CALL_ABSTRACT, true)); - Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(Tasks.current(), parent, DOUBLE_1, true)); - - return entity().invoke(DOUBLE_1, parameters.getAllConfig()).getUnchecked(); - } - }).build(); - - return child.invoke(DOUBLE_CHECK, parameters.getAllConfig()).getUnchecked(); - } - }).build(); - - - @Test - // also assert it works when the effector is defined on an entity - public void testNestedEffectorTag() throws Exception { - app.createAndManageChild(EntitySpec.create(Entity.class, DoublingEntity.class)); - Assert.assertEquals(app.invoke(DOUBLE_CALL, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - - private void checkTags(Task<Integer> t, Entity entity, Effector<?> eff, boolean shouldHaveChild) { - Assert.assertEquals(BrooklynTaskTags.getContextEntity(t), app); - Assert.assertTrue(t.getTags().contains(BrooklynTaskTags.EFFECTOR_TAG), "missing effector tag; had: "+t.getTags()); - Assert.assertTrue(t.getDescription().contains(eff.getName()), "description missing effector name: "+t.getDescription()); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(t, entity, eff, false)); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(t, null, null, false)); - Assert.assertFalse(BrooklynTaskTags.isInEffectorTask(t, entity, Startable.START, false)); - - if (shouldHaveChild) { - Task<?> subtask = ((HasTaskChildren)t).getChildren().iterator().next(); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(subtask, entity, eff, false)); - Assert.assertTrue(BrooklynTaskTags.isInEffectorTask(subtask, null, null, false)); - } - } - - // TEST parameter task missing - - // ----------------- syntax for more complex -- an effector using subtasks - - public static Task<Integer> add(final int x, final int y) { - return TaskBuilder.<Integer>builder().name("add").body(new Callable<Integer>() { public Integer call() { return x+y; } }).build(); - } - - public static Task<Integer> add(final Task<Integer> x, final int y) { - return TaskBuilder.<Integer>builder().name("add").body(new Callable<Integer>() { public Integer call() { return DynamicTasks.get(x)+y; } }).build(); - } - - public static Task<Integer> addBasic(final Task<Integer> x, final int y) { - return TaskBuilder.<Integer>builder().name("add (not dynamic)").dynamic(false).body(new Callable<Integer>() { public Integer call() { - Preconditions.checkState(x.isSubmitted()); - return x.getUnchecked()+y; - } }).build(); - } - - public static Task<Integer> times(final int x, final int y) { - return TaskBuilder.<Integer>builder().name("times").body(new Callable<Integer>() { public Integer call() { return x*y; } }).build(); - } - - public static Task<Integer> times(final Task<Integer> x, final int y) { - return TaskBuilder.<Integer>builder().name("times").body(new Callable<Integer>() { public Integer call() { return DynamicTasks.get(x)*y; } }).build(); - } - - public static final Effector<Integer> TWO_X_PLUS_ONE = Effectors.effector(Integer.class, "twoXPlusOne") - .description("doubles the given number and adds one") - .parameter(Integer.class, "numberToStartWith") - .impl(new EffectorBody<Integer>() { - public Integer call(ConfigBag parameters) { - int input = (Integer)parameters.getStringKey("numberToStartWith"); - queue( add(times(input, 2), 1) ); - return last(Integer.class); - } - }) - .build(); - - public static final Effector<Integer> TWO_X_PLUS_ONE_BASIC = Effectors.effector(Integer.class, "twoXPlusOne_Basic") - .description("doubles the given number and adds one, as a basic task") - .parameter(Integer.class, "numberToStartWith") - .impl(new EffectorBody<Integer>() { - public Integer call(ConfigBag parameters) { - int input = (Integer)parameters.getStringKey("numberToStartWith"); - // note the subtasks must be queued explicitly with a basic task - // (but with the DynamicSequentialTask they can be resolved by the task itself; see above) - Task<Integer> product = queue(times(input, 2)); - queue( addBasic(product, 1) ); - return last(Integer.class); - } - }) - .build(); - - // TODO a chaining style approach - - public static class Txp1Entity extends AbstractEntity { - public static final Effector<Integer> TWO_X_P_1 = EffectorTaskTest.TWO_X_PLUS_ONE; - } - - /** the composed effector should allow us to inspect its children */ - @Test - public void testComposedEffector() throws Exception { - Entity txp1 = app.createAndManageChild(EntitySpec.create(Entity.class, Txp1Entity.class)); - - Task<Integer> e = txp1.invoke(TWO_X_PLUS_ONE, MutableMap.of("numberToStartWith", 3)); - Assert.assertTrue(e instanceof DynamicSequentialTask); - Assert.assertEquals(e.get(), (Integer)7); - Assert.assertEquals( Iterables.size( ((HasTaskChildren)e).getChildren() ), 1); - Task<?> child = ((HasTaskChildren)e).getChildren().iterator().next(); - Assert.assertEquals( Iterables.size( ((HasTaskChildren)child).getChildren() ), 1); - } - - /** the composed effector should allow us to inspect its children */ - @Test - public void testComposedEffectorBasic() throws Exception { - Entity txp1 = app.createAndManageChild(EntitySpec.create(Entity.class, Txp1Entity.class)); - - Task<Integer> e = txp1.invoke(TWO_X_PLUS_ONE_BASIC, MutableMap.of("numberToStartWith", 3)); - Assert.assertTrue(e instanceof DynamicSequentialTask); - Assert.assertEquals(e.get(), (Integer)7); - Assert.assertEquals( Iterables.size( ((HasTaskChildren)e).getChildren() ), 2); - } - - // --------- defining - - @Test - public void testEffectorWithBodyWorksEvenIfNotOnEntity() throws Exception { - Entity doubler = app.createAndManageChild(EntitySpec.create(TestEntity.class)); - - Assert.assertEquals(doubler.invoke(DOUBLE_1, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - public static final Effector<Integer> DOUBLE_BODYLESS = Effectors.effector(Integer.class, "double") - .description("doubles the given number") - .parameter(Integer.class, "numberToDouble") - .buildAbstract(); - - @Test - public void testEffectorWithoutBodyFails() throws Exception { - Entity doubler = app.createAndManageChild(EntitySpec.create(TestEntity.class)); - - boolean failed = false; - try { - doubler.invoke(DOUBLE_BODYLESS, MutableMap.of("numberToDouble", 3)); - } catch (Exception e) { - failed = true; - } - if (!failed) Assert.fail("doubling should have failed because it had no body"); - } - - @Test - public void testEffectorBodyAdded() throws Exception { - EntityInternal doubler = (EntityInternal) app.createAndManageChild(EntitySpec.create(TestEntity.class)); - - // not yet present - Assert.assertNull( doubler.getEffector("double") ); - - // add it - doubler.getMutableEntityType().addEffector(DOUBLE_BODYLESS, new EffectorBody<Integer>() { - @Override - public Integer call(ConfigBag parameters) { - int input = (Integer)parameters.getStringKey("numberToDouble"); - return queue(times(input, 2)).getUnchecked(); - } - }); - // now it is present - Assert.assertNotNull( doubler.getEffector("double") ); - - Assert.assertEquals(doubler.invoke(DOUBLE_BODYLESS, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - @Test - public void testEffectorBodyAddedImplicitlyButBodylessSignatureInvoked() throws Exception { - EntityInternal doubler = (EntityInternal) app.createAndManageChild(EntitySpec.create(TestEntity.class)); - - // add it - doubler.getMutableEntityType().addEffector(DOUBLE_1); - - // invoke it, but using something with equivalent name (and signature -- though only name is used currently) - // ensures that the call picks up the body by looking in the actual entity - Assert.assertEquals(doubler.invoke(DOUBLE_BODYLESS, MutableMap.of("numberToDouble", 3)).get(), (Integer)6); - } - - @Test(dependsOnMethods={"testEffectorBodyAdded"}) - public void testEntityNotPermanentlyChanged() throws Exception { - EntityInternal doubler = (EntityInternal) app.createAndManageChild(EntitySpec.create(TestEntity.class)); - // ensures that independent creations of the class previously modified do not have this effector - Assert.assertNull( doubler.getEffector("double") ); - } - - // --- overriding by using statics --------- - - public static class BadDoublingEntity extends DoublingEntity { - public static final Effector<Integer> DOUBLE = Effectors.effector(DoublingEntity.DOUBLE). - impl( ((EffectorWithBody<Integer>)TWO_X_PLUS_ONE).getBody() ).build(); - } - - @Test - // also assert it works when the entity is defined on an entity - public void testOverriddenEffectorOnEntity() throws Exception { - Entity doubler = app.createAndManageChild(EntitySpec.create(Entity.class, BadDoublingEntity.class)); - - Assert.assertEquals(doubler.invoke(DoublingEntity.DOUBLE, MutableMap.of("numberToDouble", 3, "numberToStartWith", 3)).get(), (Integer)7); - } - - public static final Effector<Void> DUMMY = Effectors.effector(Void.class, "dummy") - .impl(new EffectorBody<Void>() { - @Override - public Void call(ConfigBag parameters) { - return null; - } - }) - .build(); - - public static final Effector<Void> STALL = Effectors.effector(Void.class, "stall") - .parameter(AtomicBoolean.class, "lock") - .impl(new EffectorBody<Void>() { - @Override - public Void call(ConfigBag parameters) { - AtomicBoolean lock = (AtomicBoolean)parameters.getStringKey("lock"); - synchronized(lock) { - if (!lock.get()) { - try { - lock.wait(); - } catch (InterruptedException e) { - Exceptions.propagate(e); - } - } - } - return null; - } - }) - .build(); - - public static final Effector<Void> CONTEXT = Effectors.effector(Void.class, "stall_caller") - .parameter(AtomicBoolean.class, "lock") - .impl(new EffectorBody<Void>() { - @Override - public Void call(ConfigBag parameters) { - Entity child = Iterables.getOnlyElement(entity().getChildren()); - AtomicBoolean lock = new AtomicBoolean(); - Task<Void> dummyTask = null; - - try { - // Queue a (DST secondary) task which waits until notified, so that tasks queued later will get blocked - queue(Effectors.invocation(entity(), STALL, ImmutableMap.of("lock", lock))); - - // Start a new task - submitted directly to child's ExecutionContext, as well as added as a - // DST secondary of the current effector. - dummyTask = child.invoke(DUMMY, ImmutableMap.<String, Object>of()); - dummyTask.getUnchecked(); - - // Execution completed in the child's ExecutionContext, but still queued as a secondary. - // Destroy the child entity so that no subsequent tasks can be executed in its context. - Entities.destroy(child); - } finally { - // Let STALL complete - synchronized(lock) { - lock.set(true); - lock.notifyAll(); - } - // At this point DUMMY will be unblocked and the DST will try to execute it as a secondary. - // Submission will be ignored because DUMMY already executed. - // If it's not ignored then submission will fail because entity is already unmanaged. - } - return null; - } - }) - .build(); - - - @Test - public void testNestedEffectorExecutedAsSecondaryTask() throws Exception { - app.createAndManageChild(EntitySpec.create(TestEntity.class)); - Task<Void> effTask = app.invoke(CONTEXT, ImmutableMap.<String, Object>of()); - effTask.get(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/core/src/test/java/org/apache/brooklyn/effector/core/ssh/SshEffectorTasksTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/effector/core/ssh/SshEffectorTasksTest.java b/core/src/test/java/org/apache/brooklyn/effector/core/ssh/SshEffectorTasksTest.java deleted file mode 100644 index 597d267..0000000 --- a/core/src/test/java/org/apache/brooklyn/effector/core/ssh/SshEffectorTasksTest.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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.effector.core.ssh; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; - -import org.apache.brooklyn.api.location.LocationSpec; -import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.api.mgmt.TaskAdaptable; -import org.apache.brooklyn.api.mgmt.TaskFactory; -import org.apache.brooklyn.core.entity.Entities; -import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; -import org.apache.brooklyn.util.core.task.ssh.SshFetchTaskWrapper; -import org.apache.brooklyn.util.core.task.ssh.SshPutTaskWrapper; -import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper; -import org.apache.brooklyn.util.exceptions.PropagatedRuntimeException; -import org.apache.brooklyn.util.net.Urls; -import org.apache.commons.io.FileUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation; -import org.apache.brooklyn.location.ssh.SshMachineLocation; - -import com.google.common.io.Files; - -public class SshEffectorTasksTest { - - private static final Logger log = LoggerFactory.getLogger(SshEffectorTasksTest.class); - - TestApplication app; - ManagementContext mgmt; - SshMachineLocation host; - File tempDir; - - boolean failureExpected; - - @BeforeMethod(alwaysRun=true) - public void setup() throws Exception { - app = TestApplication.Factory.newManagedInstanceForTests(); - mgmt = app.getManagementContext(); - - LocalhostMachineProvisioningLocation lhc = mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)); - host = lhc.obtain(); - app.start(Arrays.asList(host)); - clearExpectedFailure(); - tempDir = Files.createTempDir(); - } - - @AfterMethod(alwaysRun=true) - public void tearDown() throws Exception { - if (mgmt != null) Entities.destroyAll(mgmt); - mgmt = null; - FileUtils.deleteDirectory(tempDir); - checkExpectedFailure(); - } - - protected void checkExpectedFailure() { - if (failureExpected) { - clearExpectedFailure(); - Assert.fail("Test should have thrown an exception but it did not."); - } - } - - protected void clearExpectedFailure() { - failureExpected = false; - } - - protected void setExpectingFailure() { - failureExpected = true; - } - - public <T extends TaskAdaptable<?>> T submit(final TaskFactory<T> taskFactory) { - return Entities.submit(app, taskFactory); - } - - // ------------------- basic ssh - - @Test(groups="Integration") - public void testSshEchoHello() { - ProcessTaskWrapper<Integer> t = submit(SshEffectorTasks.ssh("sleep 1 ; echo hello world")); - Assert.assertFalse(t.isDone()); - Assert.assertEquals(t.get(), (Integer)0); - Assert.assertEquals(t.getTask().getUnchecked(), (Integer)0); - Assert.assertEquals(t.getStdout().trim(), "hello world"); - } - - @Test(groups="Integration") - public void testSshPut() throws IOException { - String fn = Urls.mergePaths(tempDir.getPath(), "f1"); - SshPutTaskWrapper t = submit(SshEffectorTasks.put(fn).contents("hello world")); - t.block(); - Assert.assertEquals(FileUtils.readFileToString(new File(fn)), "hello world"); - // and make sure this doesn't throw - Assert.assertTrue(t.isDone()); - Assert.assertTrue(t.isSuccessful()); - Assert.assertEquals(t.get(), null); - Assert.assertEquals(t.getExitCode(), (Integer)0); - } - - @Test(groups="Integration") - public void testSshFetch() throws IOException { - String fn = Urls.mergePaths(tempDir.getPath(), "f2"); - FileUtils.write(new File(fn), "hello fetched world"); - - SshFetchTaskWrapper t = submit(SshEffectorTasks.fetch(fn)); - t.block(); - - Assert.assertTrue(t.isDone()); - Assert.assertEquals(t.get(), "hello fetched world"); - } - - // ----------------- pid stuff - - @Test(groups="Integration") - public void testNonRunningPid() { - ProcessTaskWrapper<Integer> t = submit(SshEffectorTasks.codePidRunning(99999)); - Assert.assertNotEquals(t.getTask().getUnchecked(), (Integer)0); - Assert.assertNotEquals(t.getExitCode(), (Integer)0); - ProcessTaskWrapper<Boolean> t2 = submit(SshEffectorTasks.isPidRunning(99999)); - Assert.assertFalse(t2.getTask().getUnchecked()); - } - - @Test(groups="Integration") - public void testNonRunningPidRequired() { - ProcessTaskWrapper<?> t = submit(SshEffectorTasks.requirePidRunning(99999)); - setExpectingFailure(); - try { - t.getTask().getUnchecked(); - } catch (Exception e) { - log.info("The error if required PID is not found is: "+e); - clearExpectedFailure(); - Assert.assertTrue(e.toString().contains("Process with PID"), "Expected nice clue in error but got: "+e); - } - checkExpectedFailure(); - } - - public static Integer getMyPid() { - try { - java.lang.management.RuntimeMXBean runtime = - java.lang.management.ManagementFactory.getRuntimeMXBean(); - java.lang.reflect.Field jvm = runtime.getClass().getDeclaredField("jvm"); - jvm.setAccessible(true); -// sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm.get(runtime); - Object mgmt = jvm.get(runtime); - java.lang.reflect.Method pid_method = - mgmt.getClass().getDeclaredMethod("getProcessId"); - pid_method.setAccessible(true); - - return (Integer) pid_method.invoke(mgmt); - } catch (Exception e) { - throw new PropagatedRuntimeException("Test depends on (fragile) getMyPid method which does not work here", e); - } - } - - @Test(groups="Integration") - public void testRunningPid() { - ProcessTaskWrapper<Integer> t = submit(SshEffectorTasks.codePidRunning(getMyPid())); - Assert.assertEquals(t.getTask().getUnchecked(), (Integer)0); - ProcessTaskWrapper<Boolean> t2 = submit(SshEffectorTasks.isPidRunning(getMyPid())); - Assert.assertTrue(t2.getTask().getUnchecked()); - } - - @Test(groups="Integration") - public void testRunningPidFromFile() throws IOException { - File f = File.createTempFile("testBrooklynPid", ".pid"); - Files.write( (""+getMyPid()).getBytes(), f ); - ProcessTaskWrapper<Integer> t = submit(SshEffectorTasks.codePidFromFileRunning(f.getPath())); - Assert.assertEquals(t.getTask().getUnchecked(), (Integer)0); - ProcessTaskWrapper<Boolean> t2 = submit(SshEffectorTasks.isPidFromFileRunning(f.getPath())); - Assert.assertTrue(t2.getTask().getUnchecked()); - } - - @Test(groups="Integration") - public void testRequirePidFromFileOnFailure() throws IOException { - File f = File.createTempFile("testBrooklynPid", ".pid"); - Files.write( "99999".getBytes(), f ); - ProcessTaskWrapper<?> t = submit(SshEffectorTasks.requirePidFromFileRunning(f.getPath())); - - setExpectingFailure(); - try { - t.getTask().getUnchecked(); - } catch (Exception e) { - log.info("The error if required PID is not found is: "+e); - clearExpectedFailure(); - Assert.assertTrue(e.toString().contains("Process with PID"), "Expected nice clue in error but got: "+e); - Assert.assertEquals(t.getExitCode(), (Integer)1); - } - checkExpectedFailure(); - } - - @Test(groups="Integration") - public void testRequirePidFromFileOnFailureNoSuchFile() throws IOException { - ProcessTaskWrapper<?> t = submit(SshEffectorTasks.requirePidFromFileRunning("/path/does/not/exist/SADVQW")); - - setExpectingFailure(); - try { - t.getTask().getUnchecked(); - } catch (Exception e) { - log.info("The error if required PID is not found is: "+e); - clearExpectedFailure(); - Assert.assertTrue(e.toString().contains("Process with PID"), "Expected nice clue in error but got: "+e); - Assert.assertEquals(t.getExitCode(), (Integer)1); - } - checkExpectedFailure(); - } - - @Test(groups="Integration") - public void testRequirePidFromFileOnFailureTooManyFiles() throws IOException { - ProcessTaskWrapper<?> t = submit(SshEffectorTasks.requirePidFromFileRunning("/*")); - - setExpectingFailure(); - try { - t.getTask().getUnchecked(); - } catch (Exception e) { - log.info("The error if required PID is not found is: "+e); - clearExpectedFailure(); - Assert.assertTrue(e.toString().contains("Process with PID"), "Expected nice clue in error but got: "+e); - Assert.assertEquals(t.getExitCode(), (Integer)2); - } - checkExpectedFailure(); - } - - @Test(groups="Integration") - public void testRequirePidFromFileOnSuccess() throws IOException { - File f = File.createTempFile("testBrooklynPid", ".pid"); - Files.write( (""+getMyPid()).getBytes(), f ); - ProcessTaskWrapper<?> t = submit(SshEffectorTasks.requirePidFromFileRunning(f.getPath())); - - t.getTask().getUnchecked(); - } - - @Test(groups="Integration") - public void testRequirePidFromFileOnSuccessAcceptsWildcards() throws IOException { - File f = File.createTempFile("testBrooklynPid", ".pid"); - Files.write( (""+getMyPid()).getBytes(), f ); - ProcessTaskWrapper<?> t = submit(SshEffectorTasks.requirePidFromFileRunning(f.getPath()+"*")); - - t.getTask().getUnchecked(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationTest.java b/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationTest.java index dec55ec..1aa71f1 100644 --- a/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationTest.java +++ b/core/src/test/java/org/apache/brooklyn/location/ssh/SshMachineLocationTest.java @@ -43,6 +43,9 @@ import org.apache.brooklyn.api.location.MachineDetails; import org.apache.brooklyn.api.location.MachineLocation; import org.apache.brooklyn.api.location.PortRange; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.EffectorTaskTest; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; @@ -54,9 +57,6 @@ import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.core.location.PortRanges; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.EffectorTaskTest; -import org.apache.brooklyn.effector.core.Effectors; import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.collections.MutableMap; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/core/src/test/java/org/apache/brooklyn/util/core/task/ssh/SshTasksTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/util/core/task/ssh/SshTasksTest.java b/core/src/test/java/org/apache/brooklyn/util/core/task/ssh/SshTasksTest.java index 6b6c0b1..cb0e50c 100644 --- a/core/src/test/java/org/apache/brooklyn/util/core/task/ssh/SshTasksTest.java +++ b/core/src/test/java/org/apache/brooklyn/util/core/task/ssh/SshTasksTest.java @@ -23,10 +23,10 @@ import java.io.IOException; import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasksTest; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasksTest; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java ---------------------------------------------------------------------- diff --git a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java index e7e1df9..bc3671f 100644 --- a/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java +++ b/examples/simple-nosql-cluster/src/main/java/org/apache/brooklyn/demo/CumulusRDFApplication.java @@ -36,6 +36,9 @@ import org.apache.brooklyn.api.sensor.SensorEvent; import org.apache.brooklyn.api.sensor.SensorEventListener; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.AbstractApplication; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; @@ -44,9 +47,6 @@ import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.PortRanges; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.java.UsesJava; import org.apache.brooklyn.entity.java.UsesJmx; import org.apache.brooklyn.entity.nosql.cassandra.CassandraDatacenter; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/policy/src/main/java/org/apache/brooklyn/policy/loadbalancing/Movable.java ---------------------------------------------------------------------- diff --git a/policy/src/main/java/org/apache/brooklyn/policy/loadbalancing/Movable.java b/policy/src/main/java/org/apache/brooklyn/policy/loadbalancing/Movable.java index 1c6e75a..bec64cc 100644 --- a/policy/src/main/java/org/apache/brooklyn/policy/loadbalancing/Movable.java +++ b/policy/src/main/java/org/apache/brooklyn/policy/loadbalancing/Movable.java @@ -23,7 +23,7 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.annotation.Effector; import org.apache.brooklyn.core.annotation.EffectorParam; import org.apache.brooklyn.core.config.BasicConfigKey; -import org.apache.brooklyn.effector.core.MethodEffector; +import org.apache.brooklyn.core.effector.MethodEffector; import org.apache.brooklyn.sensor.core.BasicAttributeSensor; import org.apache.brooklyn.util.core.flags.SetFromFlag; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/MockContainerEntity.java ---------------------------------------------------------------------- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/MockContainerEntity.java b/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/MockContainerEntity.java index b11640d..e5b826d 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/MockContainerEntity.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/MockContainerEntity.java @@ -26,8 +26,8 @@ import org.apache.brooklyn.api.entity.ImplementedBy; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.annotation.EffectorParam; import org.apache.brooklyn.core.config.BasicConfigKey; +import org.apache.brooklyn.core.effector.MethodEffector; import org.apache.brooklyn.core.entity.trait.Startable; -import org.apache.brooklyn.effector.core.MethodEffector; import org.apache.brooklyn.entity.group.AbstractGroup; import org.apache.brooklyn.util.core.flags.SetFromFlag; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java ---------------------------------------------------------------------- diff --git a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java index 58ec93f..ace9a62 100644 --- a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java +++ b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java @@ -33,13 +33,13 @@ import org.slf4j.LoggerFactory; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.api.effector.Effector; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.entity.stock.EffectorStartableImpl; import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.entity.database.postgresql.PostgreSqlNode; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.sensor.core.DependentConfiguration; import org.apache.brooklyn.sensor.feed.ssh.SshFeed; import org.apache.brooklyn.sensor.feed.ssh.SshPollConfig; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java ---------------------------------------------------------------------- diff --git a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java index 198d139..5a404a1 100644 --- a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java +++ b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltLifecycleEffectorTasks.java @@ -20,10 +20,10 @@ package org.apache.brooklyn.entity.salt; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.location.MachineLocation; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.server.BrooklynServerConfig; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks; import org.apache.brooklyn.util.core.task.DynamicTasks; import org.apache.brooklyn.util.core.task.Tasks; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltTasks.java ---------------------------------------------------------------------- diff --git a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltTasks.java b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltTasks.java index c00e48b..d6bacfa 100644 --- a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltTasks.java +++ b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/salt/SaltTasks.java @@ -28,14 +28,13 @@ import java.util.Map; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.mgmt.TaskFactory; +import org.apache.brooklyn.core.effector.EffectorTasks; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.core.task.DynamicTasks; import org.apache.brooklyn.util.core.task.Tasks; import org.apache.brooklyn.util.core.text.TemplateProcessor; - -import org.apache.brooklyn.effector.core.EffectorTasks; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.net.Urls; import org.apache.brooklyn.util.ssh.BashCommands; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java ---------------------------------------------------------------------- diff --git a/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java b/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java index b25c92f..8dfaaeb 100644 --- a/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java +++ b/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java @@ -22,6 +22,8 @@ import java.util.Random; import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.PortRange; +import org.apache.brooklyn.core.effector.EffectorTasks; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.location.PortRanges; import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper; @@ -38,8 +40,6 @@ import org.testng.annotations.Test; import org.apache.brooklyn.entity.database.VogellaExampleAccess; import org.apache.brooklyn.entity.database.postgresql.PostgreSqlIntegrationTest; import org.apache.brooklyn.entity.database.postgresql.PostgreSqlNode; -import org.apache.brooklyn.effector.core.EffectorTasks; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.util.time.Duration; import com.google.common.collect.ImmutableList; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynCluster.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynCluster.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynCluster.java index daf7369..f00b4db 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynCluster.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynCluster.java @@ -26,7 +26,7 @@ import org.apache.brooklyn.api.entity.ImplementedBy; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; -import org.apache.brooklyn.effector.core.Effectors; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.entity.brooklynnode.effector.BrooklynNodeUpgradeEffectorBody; import org.apache.brooklyn.entity.group.DynamicCluster; import org.apache.brooklyn.sensor.core.Sensors; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java index 1ca17fc..0a99d1f 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynEntityMirrorImpl.java @@ -25,13 +25,13 @@ import java.util.concurrent.Callable; import javax.annotation.Nullable; import org.apache.brooklyn.api.effector.Effector; +import org.apache.brooklyn.core.effector.EffectorBody; import org.apache.brooklyn.core.entity.AbstractEntity; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityDynamicType; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.entity.lifecycle.ServiceStateLogic; -import org.apache.brooklyn.effector.core.EffectorBody; import org.apache.brooklyn.sensor.core.Sensors; import org.apache.brooklyn.sensor.feed.http.HttpFeed; import org.apache.brooklyn.sensor.feed.http.HttpPollConfig; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNode.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNode.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNode.java index bd8cf9b..2dd9067 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNode.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNode.java @@ -33,8 +33,8 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.BrooklynVersion; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.config.MapConfigKey; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; -import org.apache.brooklyn.effector.core.Effectors; import org.apache.brooklyn.entity.java.UsesJava; import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.sensor.core.BasicAttributeSensor; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeImpl.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeImpl.java index f1fd071..c1dd4ed 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeImpl.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeImpl.java @@ -33,6 +33,8 @@ import org.apache.brooklyn.api.mgmt.TaskAdaptable; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.render.RendererHints; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; @@ -42,8 +44,6 @@ import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.Locations; import org.apache.brooklyn.core.location.access.BrooklynAccessUtils; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; import org.apache.brooklyn.entity.brooklynnode.EntityHttpClient.ResponseCodePredicates; import org.apache.brooklyn.entity.brooklynnode.effector.BrooklynNodeUpgradeEffectorBody; import org.apache.brooklyn.entity.brooklynnode.effector.SetHighAvailabilityModeEffectorBody; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java index 6962767..e862df8 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/BrooklynNodeSshDriver.java @@ -29,9 +29,9 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.drivers.downloads.DownloadSubstituters; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode.ExistingFileBehaviour; import org.apache.brooklyn.entity.java.JavaSoftwareProcessSshDriver; import org.apache.brooklyn.location.ssh.SshMachineLocation; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/RemoteEffectorBuilder.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/RemoteEffectorBuilder.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/RemoteEffectorBuilder.java index a031930..cf68641 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/RemoteEffectorBuilder.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/RemoteEffectorBuilder.java @@ -23,8 +23,8 @@ import java.util.Collection; import java.util.Map; import org.apache.brooklyn.api.effector.Effector; -import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.effector.core.Effectors.EffectorBuilder; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.effector.Effectors.EffectorBuilder; import org.apache.brooklyn.entity.brooklynnode.BrooklynEntityMirrorImpl.RemoteEffector; import org.apache.brooklyn.util.core.http.HttpToolResponse; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynClusterUpgradeEffectorBody.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynClusterUpgradeEffectorBody.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynClusterUpgradeEffectorBody.java index 3800855..319d5ba 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynClusterUpgradeEffectorBody.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynClusterUpgradeEffectorBody.java @@ -31,12 +31,12 @@ import org.apache.brooklyn.api.entity.Group; import org.apache.brooklyn.api.mgmt.TaskAdaptable; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.EntityPredicates; import org.apache.brooklyn.core.entity.EntityTasks; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster.SelectMasterEffector; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynNodeUpgradeEffectorBody.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynNodeUpgradeEffectorBody.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynNodeUpgradeEffectorBody.java index b1cb9be..c9f7dd7 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynNodeUpgradeEffectorBody.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/BrooklynNodeUpgradeEffectorBody.java @@ -29,12 +29,12 @@ import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.config.MapConfigKey; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.EntityTasks; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.BrooklynNodeDriver; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SelectMasterEffectorBody.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SelectMasterEffectorBody.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SelectMasterEffectorBody.java index 0ce0a91..bd05067 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SelectMasterEffectorBody.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SelectMasterEffectorBody.java @@ -27,9 +27,9 @@ import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.Group; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.EntityPredicates; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.BrooklynCluster.SelectMasterEffector; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityModeEffectorBody.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityModeEffectorBody.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityModeEffectorBody.java index 96d3e49..ca938e9 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityModeEffectorBody.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityModeEffectorBody.java @@ -21,8 +21,8 @@ package org.apache.brooklyn.entity.brooklynnode.effector; import org.apache.brooklyn.api.effector.Effector; import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode; import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.EntityHttpClient; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode.SetHighAvailabilityModeEffector; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityPriorityEffectorBody.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityPriorityEffectorBody.java b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityPriorityEffectorBody.java index 4fd1aa4..3560d49 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityPriorityEffectorBody.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/brooklynnode/effector/SetHighAvailabilityPriorityEffectorBody.java @@ -19,8 +19,8 @@ package org.apache.brooklyn.entity.brooklynnode.effector; import org.apache.brooklyn.api.effector.Effector; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; import org.apache.brooklyn.entity.brooklynnode.EntityHttpClient; import org.apache.brooklyn.entity.brooklynnode.BrooklynNode.SetHighAvailabilityPriorityEffector; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java index 03b7518..869d34d 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefLifecycleEffectorTasks.java @@ -23,10 +23,10 @@ import java.util.Map; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.location.MachineLocation; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; import org.apache.brooklyn.core.location.Machines; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.entity.software.base.lifecycle.MachineLifecycleEffectorTasks; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefSoloTasks.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefSoloTasks.java b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefSoloTasks.java index 327b70b..505f37e 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefSoloTasks.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefSoloTasks.java @@ -21,7 +21,7 @@ package org.apache.brooklyn.entity.chef; import java.util.Map; import org.apache.brooklyn.api.mgmt.TaskFactory; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.util.ssh.BashCommands; import com.google.common.annotations.Beta; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefTasks.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefTasks.java b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefTasks.java index c8a8b39..c1efa55 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefTasks.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/chef/ChefTasks.java @@ -23,8 +23,8 @@ import java.util.Map; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.mgmt.TaskAdaptable; import org.apache.brooklyn.api.mgmt.TaskFactory; -import org.apache.brooklyn.effector.core.EffectorTasks; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; +import org.apache.brooklyn.core.effector.EffectorTasks; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.util.collections.MutableMap; import org.apache.brooklyn.util.core.file.ArchiveTasks; import org.apache.brooklyn.util.core.file.ArchiveUtils.ArchiveType; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/chef/KnifeConvergeTaskFactory.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/chef/KnifeConvergeTaskFactory.java b/software/base/src/main/java/org/apache/brooklyn/entity/chef/KnifeConvergeTaskFactory.java index b66cd4e..c9d99b3 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/chef/KnifeConvergeTaskFactory.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/chef/KnifeConvergeTaskFactory.java @@ -29,7 +29,7 @@ import com.google.common.base.Strings; import com.google.common.net.HostAndPort; import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.effector.core.EffectorTasks; +import org.apache.brooklyn.core.effector.EffectorTasks; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.brooklyn.location.ssh.SshMachineLocation; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java b/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java index ce5f82d..c5720ca 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java @@ -28,11 +28,11 @@ import java.util.Map; import java.util.Set; import org.apache.brooklyn.api.entity.EntityLocal; +import org.apache.brooklyn.core.effector.EffectorTasks; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; -import org.apache.brooklyn.effector.core.EffectorTasks; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/java/JmxAttributeSensor.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/java/JmxAttributeSensor.java b/software/base/src/main/java/org/apache/brooklyn/entity/java/JmxAttributeSensor.java index 193f804..2886257 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/java/JmxAttributeSensor.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/java/JmxAttributeSensor.java @@ -27,7 +27,7 @@ import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; -import org.apache.brooklyn.effector.core.AddSensor; +import org.apache.brooklyn.core.effector.AddSensor; import org.apache.brooklyn.sensor.core.DependentConfiguration; import org.apache.brooklyn.sensor.core.HttpRequestSensor; import org.apache.brooklyn.sensor.feed.jmx.JmxAttributePollConfig; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntity.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntity.java b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntity.java index 58c56ea..d3a1254 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntity.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntity.java @@ -23,7 +23,7 @@ import org.apache.brooklyn.api.entity.ImplementedBy; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.core.annotation.Effector; import org.apache.brooklyn.core.annotation.EffectorParam; -import org.apache.brooklyn.effector.core.MethodEffector; +import org.apache.brooklyn.core.effector.MethodEffector; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; import org.apache.brooklyn.util.time.Duration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java index 1bb994d..72d7bef 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/machine/MachineEntityImpl.java @@ -23,8 +23,8 @@ import java.util.concurrent.TimeoutException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.location.Machines; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.software.base.AbstractSoftwareProcessSshDriver; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcessDriver; import org.apache.brooklyn.entity.software.base.EmptySoftwareProcessImpl; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPool.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPool.java b/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPool.java index 42a4665..3cf29e7 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPool.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPool.java @@ -34,9 +34,9 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.annotation.Effector; import org.apache.brooklyn.core.annotation.EffectorParam; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.MethodEffector; import org.apache.brooklyn.core.location.cloud.CloudLocationConfig; import org.apache.brooklyn.core.location.dynamic.LocationOwner; -import org.apache.brooklyn.effector.core.MethodEffector; import org.apache.brooklyn.entity.group.DynamicCluster; import org.apache.brooklyn.entity.machine.MachineEntity; import org.apache.brooklyn.sensor.core.Sensors; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPoolImpl.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPoolImpl.java b/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPoolImpl.java index 6089e3f..4307ff6 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPoolImpl.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/machine/pool/ServerPoolImpl.java @@ -33,6 +33,7 @@ import org.apache.brooklyn.api.policy.PolicySpec; import org.apache.brooklyn.api.sensor.AttributeSensor; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.Effectors; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.entity.lifecycle.Lifecycle; @@ -40,7 +41,6 @@ import org.apache.brooklyn.core.entity.trait.Startable; import org.apache.brooklyn.core.location.BasicLocationDefinition; import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.core.location.dynamic.DynamicLocation; -import org.apache.brooklyn.effector.core.Effectors; import org.apache.brooklyn.entity.group.AbstractMembershipTrackingPolicy; import org.apache.brooklyn.entity.group.DynamicClusterImpl; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java index a303f85..a64999c 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java @@ -30,12 +30,12 @@ import java.util.Set; import org.apache.brooklyn.api.entity.EntityLocal; import org.apache.brooklyn.api.entity.drivers.downloads.DownloadResolver; import org.apache.brooklyn.core.BrooklynLogging; +import org.apache.brooklyn.core.effector.EffectorTasks; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; -import org.apache.brooklyn.effector.core.EffectorTasks; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.software.base.lifecycle.NaiveScriptRunner; import org.apache.brooklyn.entity.software.base.lifecycle.ScriptHelper; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java index 0515166..24614af 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/lifecycle/MachineLifecycleEffectorTasks.java @@ -40,6 +40,9 @@ import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; import org.apache.brooklyn.core.config.Sanitizer; +import org.apache.brooklyn.core.effector.EffectorBody; +import org.apache.brooklyn.core.effector.Effectors; +import org.apache.brooklyn.core.effector.ssh.SshEffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.BrooklynConfigKeys; import org.apache.brooklyn.core.entity.Entities; @@ -53,9 +56,6 @@ import org.apache.brooklyn.core.location.Locations; import org.apache.brooklyn.core.location.Machines; import org.apache.brooklyn.core.location.cloud.CloudLocationConfig; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; -import org.apache.brooklyn.effector.core.EffectorBody; -import org.apache.brooklyn.effector.core.Effectors; -import org.apache.brooklyn.effector.core.ssh.SshEffectorTasks; import org.apache.brooklyn.entity.machine.MachineInitTasks; import org.apache.brooklyn.entity.machine.ProvidesProvisioningFlags; import org.apache.brooklyn.entity.software.base.SoftwareProcess; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/system_service/InitdServiceInstaller.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/system_service/InitdServiceInstaller.java b/software/base/src/main/java/org/apache/brooklyn/entity/system_service/InitdServiceInstaller.java index ce64518..c0de92d 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/system_service/InitdServiceInstaller.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/system_service/InitdServiceInstaller.java @@ -29,10 +29,10 @@ import org.apache.brooklyn.api.objs.HasShortName; import org.apache.brooklyn.api.sensor.Enricher; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.EffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.EntityInternal; import org.apache.brooklyn.core.location.cloud.names.AbstractCloudMachineNamer; -import org.apache.brooklyn.effector.core.EffectorTasks; import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.util.collections.MutableMap; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8dbb0e4b/software/base/src/main/java/org/apache/brooklyn/entity/system_service/SystemServiceEnricher.java ---------------------------------------------------------------------- diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/system_service/SystemServiceEnricher.java b/software/base/src/main/java/org/apache/brooklyn/entity/system_service/SystemServiceEnricher.java index 35187f8..6470a4b 100644 --- a/software/base/src/main/java/org/apache/brooklyn/entity/system_service/SystemServiceEnricher.java +++ b/software/base/src/main/java/org/apache/brooklyn/entity/system_service/SystemServiceEnricher.java @@ -27,11 +27,11 @@ import org.apache.brooklyn.api.mgmt.Task; import org.apache.brooklyn.api.sensor.Enricher; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.effector.EffectorTasks; import org.apache.brooklyn.core.entity.Attributes; import org.apache.brooklyn.core.entity.Entities; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags; import org.apache.brooklyn.core.mgmt.BrooklynTaskTags.WrappedStream; -import org.apache.brooklyn.effector.core.EffectorTasks; import org.apache.brooklyn.entity.software.base.SoftwareProcess; import org.apache.brooklyn.location.ssh.SshMachineLocation; import org.apache.brooklyn.sensor.enricher.AbstractEnricher;
