Search in sources :

Example 1 with TimelineSyncImpl

use of org.zalando.nakadi.service.timeline.TimelineSyncImpl in project nakadi by zalando.

the class TimelineSyncAT method createTimeline.

private TimelineSyncImpl createTimeline() throws InterruptedException {
    if (null == uuidGenerator) {
        uuidGenerator = new UUIDGenerator();
    }
    if (null == zookeeperHolder) {
        zookeeperHolder = Mockito.mock(ZooKeeperHolder.class);
        Mockito.when(zookeeperHolder.get()).thenReturn(CURATOR);
    }
    final TimelineSyncImpl result = new TimelineSyncImpl(zookeeperHolder, uuidGenerator);
    synchronized (DELAYED_RUNS) {
        DELAYED_RUNS.add(() -> {
            try {
                result.reactOnEventTypesChange();
            } catch (final InterruptedException ex) {
                Thread.currentThread().interrupt();
            }
        });
    }
    return result;
}
Also used : UUIDGenerator(org.zalando.nakadi.util.UUIDGenerator) TimelineSyncImpl(org.zalando.nakadi.service.timeline.TimelineSyncImpl) ZooKeeperHolder(org.zalando.nakadi.repository.zookeeper.ZooKeeperHolder)

Example 2 with TimelineSyncImpl

use of org.zalando.nakadi.service.timeline.TimelineSyncImpl in project nakadi by zalando.

the class TimelineSyncAT method testNodeInformationWrittenOnStart.

@Test
public void testNodeInformationWrittenOnStart() throws Exception {
    final TimelineSyncImpl sync = createTimeline();
    final String currentVersion = new String(CURATOR.getData().forPath("/nakadi/timelines/version"));
    Assert.assertEquals(currentVersion, new String(CURATOR.getData().forPath("/nakadi/timelines/nodes/" + sync.getNodeId())));
}
Also used : TimelineSyncImpl(org.zalando.nakadi.service.timeline.TimelineSyncImpl) Test(org.junit.Test)

Aggregations

TimelineSyncImpl (org.zalando.nakadi.service.timeline.TimelineSyncImpl)2 Test (org.junit.Test)1 ZooKeeperHolder (org.zalando.nakadi.repository.zookeeper.ZooKeeperHolder)1 UUIDGenerator (org.zalando.nakadi.util.UUIDGenerator)1