Package org.apache.s4.comm.tools

Examples of org.apache.s4.comm.tools.TaskSetup


                } else {
                    clusterConfigs = Collections.emptyList();
                }
            }
            for (ClusterConfig config : clusterConfigs) {
                TaskSetup taskSetup = new TaskSetup("localhost:" + zkArgs.zkPort);
                taskSetup.clean(config.clusterName);
                taskSetup.setup(config.clusterName, config.nbTasks, config.firstListeningPort);
                logger.info("Defined S4 cluster [{}] with [{}] tasks with first listening port [{}]", new String[] {
                        config.clusterName, String.valueOf(config.nbTasks), String.valueOf(config.firstListeningPort) });
            }

        } catch (Exception e) {
View Full Code Here


    }

    private void initializeS4Node() throws ConfigurationException, IOException, InterruptedException, KeeperException {
        // 1. start s4 nodes. Check that no app is deployed.
        TaskSetup taskSetup = new TaskSetup("localhost:" + CommTestUtils.ZK_PORT);
        taskSetup.clean("s4");
        taskSetup.setup(PRODUCER_CLUSTER, 1, 1300);

        TaskSetup taskSetup2 = new TaskSetup("localhost:" + CommTestUtils.ZK_PORT);
        taskSetup2.setup(CONSUMER_CLUSTER, 1, 1400);

        zkClient = new ZkClient("localhost:" + CommTestUtils.ZK_PORT);
        zkClient.setZkSerializer(new ZNRecordSerializer());
        List<String> processes = zkClient.getChildren("/s4/clusters/" + PRODUCER_CLUSTER + "/process");
        Assert.assertTrue(processes.size() == 0);
View Full Code Here

public class AssignmentsFromZKTest2 extends ZkBasedTest {

    @Test
    public void testAssignmentFor2Clusters() throws Exception {
        Thread.sleep(2000);
        TaskSetup taskSetup = new TaskSetup(CommTestUtils.ZK_STRING);
        final String topologyNames = "cluster2, cluster3";
        AssignmentsFromZKTest1.testAssignment(taskSetup, topologyNames);
    }
View Full Code Here

*/
public class AssignmentsFromZKTest1 extends ZkBasedTest {

    @Test
    public void testAssignmentFor1Cluster() throws Exception {
        TaskSetup taskSetup = new TaskSetup(CommTestUtils.ZK_STRING);
        final String topologyNames = "cluster1";
        testAssignment(taskSetup, topologyNames);
    }
View Full Code Here

public class ClustersFromZKTest extends ZkBasedTest {

    @Test
    @Ignore
    public void testAssignmentFor1Topology() throws InterruptedException, Exception {
        TaskSetup taskSetup = new TaskSetup(CommTestUtils.ZK_STRING);
        final String clustersString = "cluster1";
        testAssignment(taskSetup, clustersString);
    }
View Full Code Here

    }

    @Test
    public void testAssignmentFor2Topologies() throws Exception {
        Thread.sleep(2000);
        TaskSetup taskSetup = new TaskSetup(CommTestUtils.ZK_STRING);
        final String clustersString = "cluster2, cluster3";
        testAssignment(taskSetup, clustersString);

    }
View Full Code Here

        CommTestUtils.cleanupTmpDirs();

        zkFactory = CommTestUtils.startZookeeperServer();

        TaskSetup taskSetup = new TaskSetup("localhost:" + CommTestUtils.ZK_PORT);
        taskSetup.clean("s4");
        taskSetup.setup("cluster1", numTasks, 1300);
    }
View Full Code Here

        Tools.parseArgs(clusterArgs, args);
        try {

            logger.info("preparing new cluster [{}] with [{}] node(s)", clusterArgs.clusterName, clusterArgs.nbTasks);

            TaskSetup taskSetup = new TaskSetup(clusterArgs.zkConnectionString);
            taskSetup.clean(clusterArgs.clusterName);
            taskSetup.setup(clusterArgs.clusterName, clusterArgs.nbTasks, clusterArgs.firstListeningPort);
            logger.info("New cluster configuration uploaded into zookeeper");
        } catch (Exception e) {
            logger.error("Cannot initialize zookeeper with specified configuration", e);
        }
View Full Code Here

        bind(RemoteStreams.class).toInstance(Mockito.mock(RemoteStreams.class));
        bind(RemoteSenders.class).toInstance(Mockito.mock(RemoteSenders.class));
        bind(RemoteEmitters.class).toInstance(Mockito.mock(RemoteEmitters.class));
        bind(RemoteEmitterFactory.class).toInstance(Mockito.mock(RemoteEmitterFactory.class));
        bind(Clusters.class).toInstance(Mockito.mock(Clusters.class));
        Assignment mockedAssignment = Mockito.mock(Assignment.class);
        Mockito.when(mockedAssignment.assignClusterNode()).thenReturn(new ClusterNode(0, 0, "machine", "Task-0"));
        bind(Assignment.class).toInstance(mockedAssignment);
        Names.bindProperties(binder(), ImmutableMap.of("s4.cluster.name", "testCluster"));
    }
View Full Code Here

        refreshCluster();
        this.topology.addListener(this);
    }

    private boolean connectTo(Integer partitionId) {
        ClusterNode clusterNode = partitionNodeMap.get(partitionId);

        if (clusterNode == null) {

            logger.error("No ClusterNode exists for partitionId " + partitionId);
            refreshCluster();
            return false;
        }

        try {
            ChannelFuture connectFuture = this.bootstrap.connect(new InetSocketAddress(clusterNode.getMachineName(),
                    clusterNode.getPort()));
            connectFuture.await();
            if (connectFuture.isSuccess()) {
                channels.add(connectFuture.getChannel());
                partitionChannelMap.forcePut(partitionId, connectFuture.getChannel());
                return true;
            }
        } catch (InterruptedException ie) {
            logger.error(String.format("Interrupted while connecting to %s:%d", clusterNode.getMachineName(),
                    clusterNode.getPort()));
            Thread.currentThread().interrupt();
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.s4.comm.tools.TaskSetup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.