Package com.alibaba.otter.shared.common.model.config.node

Examples of com.alibaba.otter.shared.common.model.config.node.Node


        });

        mbeanServers = mapMaker.makeComputingMap(new Function<Long, MBeanServerConnection>() {

            public MBeanServerConnection apply(Long nid) {
                Node node = nodeService.findById(nid);
                String ip = node.getIp();
                if (node.getParameters().getUseExternalIp()) {
                    ip = node.getParameters().getExternalIp();
                }

                int port = node.getPort().intValue() + 1;
                Integer mbeanPort = node.getParameters().getMbeanPort();
                if (mbeanPort != null && mbeanPort != 0) {// 做个兼容处理,<=4.2.2版本没有mbeanPort设置
                    port = mbeanPort;
                }

                try {
View Full Code Here


            try {
                byte[] data = zookeeper.readData(path);
                EtlEventData eventData = JsonUtils.unmarshalFromByte(data, EtlEventData.class);

                Node node = LoadBalanceFactory.getNextTransformNode(pipelineId);// 获取下一个处理节点信息
                if (node == null) {// 没有后端节点
                    // TerminEventData termin = new TerminEventData();
                    // termin.setPipelineId(pipelineId);
                    // termin.setType(TerminType.ROLLBACK);
                    // termin.setCode("no_node");
                    // termin.setDesc(MessageFormat.format("pipeline[{}] extract stage has no node!", pipelineId));
                    // terminEvent.single(termin);
                    throw new ArbitrateException("Extract_single", "no next node");
                } else {
                    eventData.setNextNid(node.getId());
                    return eventData;// 只有这一条路返回
                }
            } catch (ZkNoNodeException e) {
                logger.error("pipeline[{}] processId[{}] is invalid , retry again", pipelineId, processId);
                return await(pipelineId);// /出现节点不存在,说明出现了error情况,递归调用重新获取一次
View Full Code Here

        // final Pipeline oppositePipeline = new Pipeline();
        // oppositePipeline.setId(101L);
        channel.setPipelines(Arrays.asList(pipeline));

        final Node currentNode = new Node();
        currentNode.setId(1L);
        new NonStrictExpectations() {

            {
                configClientService.findChannel(anyLong);
                returns(channel);
View Full Code Here

        // final Pipeline oppositePipeline = new Pipeline();
        // oppositePipeline.setId(101L);
        channel.setPipelines(Arrays.asList(pipeline));

        final Node currentNode = new Node();
        currentNode.setId(1L);
        new NonStrictExpectations() {

            {
                configClientService.findChannel(anyLong);
                returns(channel);
View Full Code Here

        Pipeline pipeline2 = new Pipeline();
        pipeline2.setChannelId(channelId);
        pipeline2.setId(oppositePipelineId);
        channel.setPipelines(Arrays.asList(pipeline1, pipeline2));

        Node node1 = new Node();
        node1.setId(1L);

        Node node2 = new Node();
        node2.setId(2L);

        pipeline1.setSelectNodes(Arrays.asList(node1, node2));
        pipeline1.setExtractNodes(Arrays.asList(node1, node2));
        pipeline1.setLoadNodes(Arrays.asList(node2));

        pipeline2.setSelectNodes(Arrays.asList(node1));
        pipeline2.setExtractNodes(Arrays.asList(node1));
        pipeline2.setLoadNodes(Arrays.asList(node1, node2));
        Mockit.setUpMock(NodeCommmunicationClient.class, new Object() {

            @Mock
            public Object callManager(final Event event) {
                if (event instanceof FindNodeEvent) {
                    Node node = new Node();
                    Long nid = ((FindNodeEvent) event).getNid();
                    node.setId(nid);
                    return node;
                } else {
                    return Arrays.asList(channel);
                }
            }
View Full Code Here

        Pipeline pipeline2 = new Pipeline();
        pipeline2.setChannelId(channelId);
        pipeline2.setId(oppositePipelineId);
        channel.setPipelines(Arrays.asList(pipeline1, pipeline2));

        Node node1 = new Node();
        node1.setId(1L);

        Node node2 = new Node();
        node2.setId(2L);

        pipeline1.setSelectNodes(Arrays.asList(node1, node2));
        pipeline1.setExtractNodes(Arrays.asList(node1, node2));
        pipeline1.setLoadNodes(Arrays.asList(node1));

        pipeline2.setSelectNodes(Arrays.asList(node2));
        pipeline2.setExtractNodes(Arrays.asList(node2));
        pipeline2.setLoadNodes(Arrays.asList(node1, node2));

        Mockit.setUpMock(NodeCommmunicationClient.class, new Object() {

            @Mock
            public Object callManager(final Event event) {
                if (event instanceof FindNodeEvent) {
                    Node node = new Node();
                    Long nid = ((FindNodeEvent) event).getNid();
                    node.setId(nid);
                    return node;
                } else {
                    return Arrays.asList(channel);
                }
            }
View Full Code Here

    }

    @Test
    public void test_attachment() {
        final Node currentNode = new Node();
        currentNode.setId(1L);
        currentNode.setIp("127.0.0.1");
        currentNode.setParameters(new NodeParameter());
        final Pipeline pipeline = new Pipeline();
        pipeline.getParameters().setRetriever(RetrieverType.ARIA2C);
        // mock一下
        new NonStrictExpectations() {
View Full Code Here

    }

    @Test
    public void test_rowData() {
        final Node currentNode = new Node();
        currentNode.setId(1L);
        currentNode.setIp("127.0.0.1");
        currentNode.setParameters(new NodeParameter());
        final Pipeline pipeline = new Pipeline();
        pipeline.getParameters().setRetriever(RetrieverType.ARIA2C);
        // mock一下
        new NonStrictExpectations() {
View Full Code Here

    @Test
    public void test_localFile() {
        final Pipeline pipeline = new Pipeline();
        pipeline.setId(100L);

        final Node currentNode = new Node();
        currentNode.setId(1L);
        new NonStrictExpectations() {

            {
                configClientService.currentNode();
                returns(currentNode);
View Full Code Here

        ExtractRandomLoadBanlance extract = new ExtractRandomLoadBanlance(pipelineId);
        extract.setNodeMonitor(nodeMonitor);
        sleep(500L);
        try {
            Node n1 = extract.next();
            Node n2 = extract.next();
            Node n3 = extract.next();
            Node n4 = extract.next();
            System.out.printf("n1[%s] n2[%s] n3[%s] n4[%s]", n1.getId(), n2.getId(), n3.getId(), n4.getId());
            want.bool(sourceList.contains(n1)).is(true);
            want.bool(sourceList.contains(n2)).is(true);
            want.bool(sourceList.contains(n3)).is(true);
            want.bool(sourceList.contains(n4)).is(true);
        } catch (InterruptedException e) {
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.common.model.config.node.Node

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.