Package com.alibaba.otter.node.etl.common.pipe.impl.rpc

Examples of com.alibaba.otter.node.etl.common.pipe.impl.rpc.RowDataRpcPipe


        identity.setPipelineId(100L);
        identity.setProcessId(100L);
        rowBatch.setIdentity(identity);
        source.setRowBatch(rowBatch);

        final RowDataRpcPipe pipe = new RowDataRpcPipe();
        try {
            pipe.afterPropertiesSet();
        } catch (Exception e) {
            want.fail();
        }
        Mockit.setUpMock(NodeCommmunicationClient.class, new Object() {

            @Mock
            public Object call(Long nid, final Event event) {
                try {
                    return TestUtils.invokeMethod(pipe, "onGet", event);
                } catch (Exception e) {
                    want.fail();
                }

                return null;
            }

        });

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

            @Mock
            private Long getNid() {
                return 1L;
            }

        });
        pipe.setNodeCommmunicationClient(new NodeCommmunicationClient());
        RpcPipeKey key = pipe.put(source);
        DbBatch target = pipe.get(key);
        want.bool(source.getRowBatch().getIdentity().equals(target.getRowBatch().getIdentity())).is(true);// identify相等
    }
View Full Code Here


        identity.setPipelineId(100L);
        identity.setProcessId(100L);
        rowBatch.setIdentity(identity);
        source.setRowBatch(rowBatch);

        final RowDataRpcPipe pipe = new RowDataRpcPipe();
        pipe.setTimeout(1 * 1000L);// 1s后超时
        try {
            pipe.afterPropertiesSet();
        } catch (Exception e) {
            want.fail();
        }
        Mockit.setUpMock(NodeCommmunicationClient.class, new Object() {

            @Mock
            public Object call(Long nid, final Event event) {
                try {
                    return TestUtils.invokeMethod(pipe, "onGet", event);
                } catch (Exception e) {
                    want.fail();
                }

                return null;
            }

        });

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

            @Mock
            private Long getNid() {
                return 1L;
            }

        });
        pipe.setNodeCommmunicationClient(new NodeCommmunicationClient());

        RpcPipeKey key = pipe.put(source);
        try {
            Thread.sleep(1500L);
        } catch (InterruptedException e) {
            want.fail();
        }
        DbBatch target = pipe.get(key);
        want.bool(target == null).is(true);// 返回结果为空
    }
View Full Code Here

TOP

Related Classes of com.alibaba.otter.node.etl.common.pipe.impl.rpc.RowDataRpcPipe

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.