Search in sources :

Example 11 with ContainerImpl

use of io.fabric8.internal.ContainerImpl in project fabric8 by jboss-fuse.

the class ContainerLifecycleCommandsTest method testStopAllMatchingContainers.

@Test
public void testStopAllMatchingContainers() throws Exception {
    // should preserve order
    containers("c1", "c3", "c2");
    ContainerImpl c1 = newContainer("c1");
    ContainerImpl c2 = newContainer("c2");
    ContainerImpl c3 = newContainer("c3");
    expect(this.fabricService.adapt(CuratorFramework.class)).andReturn(this.curatorFramework).anyTimes();
    expect(this.fabricService.getContainers()).andReturn(new Container[] { c1, c3, c2 });
    this.fabricService.stopContainer(c1, false);
    expect(this.fabricService.adapt(CuratorFramework.class)).andReturn(this.curatorFramework).anyTimes();
    expect(this.fabricService.getContainers()).andReturn(new Container[] { c1, c3, c2 });
    this.fabricService.stopContainer(c3, false);
    expect(this.fabricService.adapt(CuratorFramework.class)).andReturn(this.curatorFramework).anyTimes();
    expect(this.fabricService.getContainers()).andReturn(new Container[] { c1, c3, c2 });
    this.fabricService.stopContainer(c2, false);
    replay(this.fabricService, this.commandSession);
    this.stop.execute(this.commandSession);
    verify(this.fabricService);
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ContainerImpl(io.fabric8.internal.ContainerImpl) Test(org.junit.Test)

Aggregations

ContainerImpl (io.fabric8.internal.ContainerImpl)11 Container (io.fabric8.api.Container)6 Test (org.junit.Test)6 FabricService (io.fabric8.api.FabricService)4 DataStore (io.fabric8.api.DataStore)3 FabricException (io.fabric8.api.FabricException)2 HashMap (java.util.HashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 CuratorFramework (org.apache.curator.framework.CuratorFramework)2 Before (org.junit.Before)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ContainerProvider (io.fabric8.api.ContainerProvider)1 CreateContainerBasicMetadata (io.fabric8.api.CreateContainerBasicMetadata)1 CreateContainerBasicOptions (io.fabric8.api.CreateContainerBasicOptions)1 CreateContainerMetadata (io.fabric8.api.CreateContainerMetadata)1 CreateContainerOptions (io.fabric8.api.CreateContainerOptions)1 CreationStateListener (io.fabric8.api.CreationStateListener)1 NameValidator (io.fabric8.api.NameValidator)1 NullCreationStateListener (io.fabric8.api.NullCreationStateListener)1 PlaceholderResolver (io.fabric8.api.PlaceholderResolver)1