brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Parameterize stop effector
Date Tue, 09 Dec 2014 14:18:53 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/375#discussion_r21530134
  
    --- Diff: software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
---
    @@ -207,7 +214,55 @@ public void testBasicSoftwareProcessRestarts() throws Exception {
                 ConfigBag.newInstance().configure(RestartSoftwareParameters.RESTART_MACHINE_TYPED,
RestartMachineMode.TRUE)));
             t2.asTask().get();
             
    -        Assert.assertFalse(d.isRunning());
    +        assertFalse(d.isRunning());
    +    }
    +
    +    @Test
    +    public void testBasicSoftwareProcessStopsEverything() throws Exception {
    +        MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class));
    +        entity.start(ImmutableList.of(loc));
    +        SimulatedDriver d = (SimulatedDriver) entity.getDriver();
    +        Location machine = Iterables.getOnlyElement(entity.getLocations());
    +
    +        d.events.clear();
    +        entity.stop();
    +        assertEquals(d.events, ImmutableList.of("stop"));
    +        assertEquals(entity.getLocations().size(), 0);
    +        assertTrue(loc.getAvailable().contains(machine));
    +    }
    +
    +    @Test
    +    public void testBasicSoftwareProcessStopEverythingExplicitly() throws Exception {
    +        MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class));
    +        entity.start(ImmutableList.of(loc));
    +        SimulatedDriver d = (SimulatedDriver) entity.getDriver();
    +        Location machine = Iterables.getOnlyElement(entity.getLocations());
    +        d.events.clear();
    +
    +        TaskAdaptable<Void> t1 = Entities.submit(entity, Effectors.invocation(entity,
Startable.STOP,
    --- End diff --
    
    This is fine, but for future reference there is also a `Entities.invokeEffector(...)`
that executes the task for you, and returns the submitted task.


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

Mime
View raw message