Search in sources :

Example 16 with Path

use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.

the class DummyBatchingProgressMonitor method importFromFileSystem.

@Override
public void importFromFileSystem(String importPath) {
    IllegalArgumentAssertion.assertNotNull(importPath, "importPath");
    Path importBase = Paths.get(importPath);
    importExportHandler.importFromFileSystem(importBase);
    importExportHandler.importZipAndArtifacts(importBase.getParent());
    LOGGER.info("Profiles imported from " + importPath);
    initialVersionsAvailable.countDown();
}
Also used : Path(java.nio.file.Path) ZkPath(io.fabric8.zookeeper.ZkPath)

Example 17 with Path

use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.

the class ZooKeeperGroupTest method testMaster_withStaleNodes1.

@Test
public void testMaster_withStaleNodes1() throws Exception {
    // stale
    putChildData(group, PATH + "/001", "container1");
    putChildData(group, PATH + "/002", "container1");
    // stale
    putChildData(group, PATH + "/003", "container2");
    // stale
    putChildData(group, PATH + "/004", "container3");
    putChildData(group, PATH + "/005", "container2");
    putChildData(group, PATH + "/006", "container3");
    NodeState master = group.master();
    assertThat(master, notNullValue());
    assertThat(master.getContainer(), equalTo("container1"));
}
Also used : NodeState(io.fabric8.groups.NodeState) Test(org.junit.Test)

Example 18 with Path

use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.

the class ZooKeeperGroupTest method testMaster.

@Test
public void testMaster() throws Exception {
    putChildData(group, PATH + "/001", "container1");
    putChildData(group, PATH + "/002", "container2");
    putChildData(group, PATH + "/003", "container3");
    NodeState master = group.master();
    assertThat(master, notNullValue());
    assertThat(master.getContainer(), equalTo("container1"));
}
Also used : NodeState(io.fabric8.groups.NodeState) Test(org.junit.Test)

Example 19 with Path

use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.

the class ZooKeeperGroupTest method testMaster_withStaleNodes2.

@Test
public void testMaster_withStaleNodes2() throws Exception {
    // stale
    putChildData(group, PATH + "/001", "container1");
    putChildData(group, PATH + "/002", "container2");
    putChildData(group, PATH + "/003", "container1");
    // stale
    putChildData(group, PATH + "/004", "container3");
    putChildData(group, PATH + "/005", "container3");
    NodeState master = group.master();
    assertThat(master, notNullValue());
    assertThat(master.getContainer(), equalTo("container2"));
}
Also used : NodeState(io.fabric8.groups.NodeState) Test(org.junit.Test)

Example 20 with Path

use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.

the class ZooKeeperGroupTest method putChildData.

private static void putChildData(ZooKeeperGroup<NodeState> group, String path, String container) throws Exception {
    NodeState node = new NodeState("test", container);
    ByteArrayOutputStream data = new ByteArrayOutputStream();
    new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES).writeValue(data, node);
    ChildData<NodeState> child = new ChildData<>(path, new Stat(), data.toByteArray(), node);
    group.currentData.put(path, child);
}
Also used : NodeState(io.fabric8.groups.NodeState) Stat(org.apache.zookeeper.data.Stat) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

Test (org.junit.Test)45 File (java.io.File)41 IOException (java.io.IOException)34 ArrayList (java.util.ArrayList)18 PathTestUtil.createTmpFile (io.fabric8.maven.docker.util.PathTestUtil.createTmpFile)17 HashMap (java.util.HashMap)12 ResourceConfig (io.fabric8.maven.core.config.ResourceConfig)11 VolumeConfig (io.fabric8.maven.core.config.VolumeConfig)11 Path (java.nio.file.Path)11 FabricService (io.fabric8.api.FabricService)10 RuntimeProperties (io.fabric8.api.RuntimeProperties)9 Properties (java.util.Properties)9 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)8 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)8 InputStream (java.io.InputStream)8 Path (javax.ws.rs.Path)8 HttpProxyRule (io.fabric8.gateway.model.HttpProxyRule)7 NodeState (io.fabric8.groups.NodeState)7 URISyntaxException (java.net.URISyntaxException)7 List (java.util.List)6