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

Examples of com.alibaba.otter.node.etl.common.pipe.impl.memory.RowDataMemoryPipe


    private static final String tmp = System.getProperty("java.io.tmpdir", "/tmp");

    @Test
    public void test_ok() {
        RowDataMemoryPipe pipe = new RowDataMemoryPipe();
        pipe.setDownloadDir(tmp);
        try {
            pipe.afterPropertiesSet();
        } catch (Exception e) {
            want.fail();
        }

        DbBatch source = new DbBatch();
        RowBatch rowBatch = new RowBatch();
        Identity identity = new Identity();
        identity.setChannelId(100L);
        identity.setPipelineId(100L);
        identity.setProcessId(100L);
        rowBatch.setIdentity(identity);
        source.setRowBatch(rowBatch);

        MemoryPipeKey key = pipe.put(source);
        DbBatch target = pipe.get(key);
        want.bool(source == target).is(true);// 引用为同一个
    }
View Full Code Here


        want.bool(source == target).is(true);// 引用为同一个
    }

    @Test
    public void test_timeout() {
        RowDataMemoryPipe pipe = new RowDataMemoryPipe();
        pipe.setTimeout(1 * 1000L);// 1s后超时
        pipe.setDownloadDir(tmp);
        try {
            pipe.afterPropertiesSet();
        } catch (Exception e) {
            want.fail();
        }

        DbBatch source = new DbBatch();
        RowBatch rowBatch = new RowBatch();
        Identity identity = new Identity();
        identity.setChannelId(100L);
        identity.setPipelineId(100L);
        identity.setProcessId(100L);
        rowBatch.setIdentity(identity);
        source.setRowBatch(rowBatch);

        MemoryPipeKey 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.memory.RowDataMemoryPipe

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.