Search in sources :

Example 1 with ToolArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.setl.ToolArbitrateEvent in project otter by alibaba.

the class ToolArbitrateEventTest method test_remedy.

@Test
public void test_remedy() {
    toolEvent = new ToolArbitrateEvent();
    RemedyIndexEventData data = new RemedyIndexEventData();
    Date now = new Date();
    Long start = now.getTime() - 24 * 3600 * 60;
    Long startProcessId = 100L;
    for (int i = 10; i >= 1; i--) {
        data.setPipelineId(pipelineId);
        data.setProcessId(startProcessId + i);
        data.setStartTime(start + startProcessId + i);
        data.setEndTime(start + startProcessId + 2 * i);
        toolEvent.addRemedyIndex(data);
    }
    List<RemedyIndexEventData> indexs = toolEvent.listRemedyIndexs(pipelineId);
    want.collection(indexs).sizeEq(10);
    for (RemedyIndexEventData index : indexs) {
        toolEvent.removeRemedyIndex(index);
    }
    indexs = toolEvent.listRemedyIndexs(pipelineId);
    want.collection(indexs).sizeEq(0);
}
Also used : RemedyIndexEventData(com.alibaba.otter.shared.arbitrate.model.RemedyIndexEventData) ToolArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.setl.ToolArbitrateEvent) Date(java.util.Date) Test(org.testng.annotations.Test)

Example 2 with ToolArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.setl.ToolArbitrateEvent in project otter by alibaba.

the class ToolArbitrateEventTest method test_simple.

@Test
public void test_simple() {
    toolEvent = new ToolArbitrateEvent();
    SyncStatusEventData eventData = toolEvent.fetch(pipelineId);
    eventData.setPipelineId(pipelineId);
    eventData.addStatus(new SyncStatus(false, 1000));
    eventData.addStatus(new SyncStatus(true, 1001));
    toolEvent.single(eventData);
    eventData = toolEvent.fetch(pipelineId);
    want.object(eventData).notNull();
}
Also used : SyncStatus(com.alibaba.otter.shared.arbitrate.model.SyncStatusEventData.SyncStatus) ToolArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.setl.ToolArbitrateEvent) SyncStatusEventData(com.alibaba.otter.shared.arbitrate.model.SyncStatusEventData) Test(org.testng.annotations.Test)

Aggregations

ToolArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.setl.ToolArbitrateEvent)2 Test (org.testng.annotations.Test)2 RemedyIndexEventData (com.alibaba.otter.shared.arbitrate.model.RemedyIndexEventData)1 SyncStatusEventData (com.alibaba.otter.shared.arbitrate.model.SyncStatusEventData)1 SyncStatus (com.alibaba.otter.shared.arbitrate.model.SyncStatusEventData.SyncStatus)1 Date (java.util.Date)1