Search in sources :

Example 21 with Identity

use of com.alibaba.otter.shared.etl.model.Identity in project otter by alibaba.

the class FileBatchConflictDetectServiceIntegration method test_localFile.

@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);
            configClientService.findPipeline(anyLong);
            returns(pipeline);
        }
    };
    Identity identity = new Identity();
    identity.setChannelId(100L);
    identity.setPipelineId(100L);
    identity.setProcessId(100L);
    FileBatch fileBatch = new FileBatch();
    fileBatch.setIdentity(identity);
    fileBatch.getFiles().addAll(generatorLocalFileData("fileLoad", 10));
    FileBatch result = fileBatchConflictDetectService.detect(fileBatch, 1L);
    want.number(result.getFiles().size()).isEqualTo(0);
    NioUtils.delete(new File(tmp + File.separator + OTTERLOAD));
}
Also used : FileBatch(com.alibaba.otter.shared.etl.model.FileBatch) Node(com.alibaba.otter.shared.common.model.config.node.Node) Identity(com.alibaba.otter.shared.etl.model.Identity) File(java.io.File) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) Test(org.testng.annotations.Test) BaseOtterTest(com.alibaba.otter.node.etl.BaseOtterTest)

Example 22 with Identity

use of com.alibaba.otter.shared.etl.model.Identity in project otter by alibaba.

the class DatabaseExtractorTest method setUp.

@BeforeMethod
public void setUp() {
    identity = new Identity();
    identity.setChannelId(100L);
    identity.setPipelineId(100L);
    identity.setProcessId(100L);
}
Also used : Identity(com.alibaba.otter.shared.etl.model.Identity) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 23 with Identity

use of com.alibaba.otter.shared.etl.model.Identity in project otter by alibaba.

the class FreedomExtractorTest method setUp.

@BeforeMethod
public void setUp() {
    identity = new Identity();
    identity.setChannelId(100L);
    identity.setPipelineId(100L);
    identity.setProcessId(100L);
}
Also used : Identity(com.alibaba.otter.shared.etl.model.Identity) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 24 with Identity

use of com.alibaba.otter.shared.etl.model.Identity in project otter by alibaba.

the class DbLoadActionTest method test_db_load_oracle.

@Test
public void test_db_load_oracle() {
    ArbitrateConfigRegistry.regist(configClientService);
    dbLoadAction = (DbLoadAction) TestedObject.getSpringBeanFactory().getBean("dbLoadAction");
    final Channel channel = new Channel();
    channel.setId(1L);
    final Pipeline pipeline = new Pipeline();
    pipeline.setId(100L);
    List<DataMediaPair> pairs = generatorDataMediaPairForOracle(20);
    pipeline.setPairs(pairs);
    pipeline.getParameters().merge(new SystemParameter());
    pipeline.getParameters().merge(new ChannelParameter());
    // 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);
            configClientService.findPipeline(anyLong);
            returns(pipeline);
            configClientService.currentNode();
            returns(currentNode);
        }
    };
    Identity identity = new Identity();
    identity.setChannelId(100L);
    identity.setPipelineId(100L);
    identity.setProcessId(100L);
    RowBatch rowBatch = new RowBatch();
    rowBatch.setIdentity(identity);
    List<EventData> eventDatas = generatorEventDataForOracle(0, 20, EventType.INSERT);
    for (EventData eventData : eventDatas) {
        rowBatch.merge(eventData);
    }
    eventDatas = generatorEventDataForOracle(10, 10, EventType.INSERT);
    for (EventData eventData : eventDatas) {
        rowBatch.merge(eventData);
    }
    eventDatas = generatorEventDataForOracle(19, 1, EventType.DELETE);
    for (EventData eventData : eventDatas) {
        rowBatch.merge(eventData);
    }
    WeightController controller = new WeightController(1);
    dbLoadAction.load(rowBatch, controller);
}
Also used : DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ChannelParameter(com.alibaba.otter.shared.common.model.config.channel.ChannelParameter) Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) Node(com.alibaba.otter.shared.common.model.config.node.Node) EventData(com.alibaba.otter.shared.etl.model.EventData) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) RowBatch(com.alibaba.otter.shared.etl.model.RowBatch) SystemParameter(com.alibaba.otter.shared.common.model.config.parameter.SystemParameter) WeightController(com.alibaba.otter.node.etl.load.loader.weight.WeightController) Identity(com.alibaba.otter.shared.etl.model.Identity) Test(org.testng.annotations.Test) BaseDbTest(com.alibaba.otter.node.etl.BaseDbTest)

Example 25 with Identity

use of com.alibaba.otter.shared.etl.model.Identity in project otter by alibaba.

the class OtterTransformerFactory method translateIdentity.

private Identity translateIdentity(Identity identity) {
    Identity result = new Identity();
    result.setChannelId(identity.getChannelId());
    result.setPipelineId(identity.getPipelineId());
    result.setProcessId(identity.getProcessId());
    return result;
}
Also used : Identity(com.alibaba.otter.shared.etl.model.Identity)

Aggregations

Identity (com.alibaba.otter.shared.etl.model.Identity)28 Test (org.testng.annotations.Test)16 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)12 RowBatch (com.alibaba.otter.shared.etl.model.RowBatch)12 BaseDbTest (com.alibaba.otter.node.etl.BaseDbTest)9 EventData (com.alibaba.otter.shared.etl.model.EventData)9 FileBatch (com.alibaba.otter.shared.etl.model.FileBatch)9 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)8 BaseOtterTest (com.alibaba.otter.node.etl.BaseOtterTest)7 DbBatch (com.alibaba.otter.shared.etl.model.DbBatch)7 File (java.io.File)6 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)5 Node (com.alibaba.otter.shared.common.model.config.node.Node)5 BatchObject (com.alibaba.otter.shared.etl.model.BatchObject)5 FileData (com.alibaba.otter.shared.etl.model.FileData)5 WeightController (com.alibaba.otter.node.etl.load.loader.weight.WeightController)4 DbDataMedia (com.alibaba.otter.shared.common.model.config.data.db.DbDataMedia)3 ArrayList (java.util.ArrayList)3 NodeCommmunicationClient (com.alibaba.otter.node.common.communication.NodeCommmunicationClient)2 HttpPipeKey (com.alibaba.otter.node.etl.common.pipe.impl.http.HttpPipeKey)2