/** * Validates each changelog system-stream with its respective SystemAdmin. */ private void validateChangelogStreams() { LOG.info("Validating change log streams: " + changelogSystemStreams); for (SystemStream changelogSystemStream : changelogSystemStreams.values()) { SystemAdmin systemAdmin = systemAdmins.getSystemAdmin(changelogSystemStream.getSystem()); StreamSpec changelogSpec = StreamSpec.createChangeLogStreamSpec(changelogSystemStream.getStream(), changelogSystemStream.getSystem(), maxChangeLogStreamPartitions); systemAdmin.validateStream(changelogSpec); } }
@Test public void testCreateCoordinatorStream() { SystemAdmin admin = Mockito.spy(systemAdmin()); StreamSpec spec = StreamSpec.createCoordinatorStreamSpec("testCoordinatorStream", "testSystem"); admin.createStream(spec); admin.validateStream(spec); Mockito.verify(admin).createStream(Mockito.any()); }
LOG.info(String.format("changelog stream %s already exists.", systemStream.getStream())); systemAdmin.validateStream(changelogSpec); new StreamSpec(accesslogStream, accesslogStream, systemStream.getSystem(), maxChangeLogStreamPartitions); systemAdmin.createStream(accesslogSpec); systemAdmin.validateStream(accesslogSpec);
LOG.info(String.format("changelog stream %s already exists.", systemStream.getStream())); systemAdmin.validateStream(changelogSpec); new StreamSpec(accesslogStream, accesslogStream, systemStream.getSystem(), maxChangeLogStreamPartitions); systemAdmin.createStream(accesslogSpec); systemAdmin.validateStream(accesslogSpec);
LOG.info(String.format("changelog stream %s already exists.", systemStream.getStream())); systemAdmin.validateStream(changelogSpec); new StreamSpec(accesslogStream, accesslogStream, systemStream.getSystem(), maxChangeLogStreamPartitions); systemAdmin.createStream(accesslogSpec); systemAdmin.validateStream(accesslogSpec);
LOG.info(String.format("changelog stream %s already exists.", systemStream.getStream())); systemAdmin.validateStream(changelogSpec); new StreamSpec(accesslogStream, accesslogStream, systemStream.getSystem(), maxChangeLogStreamPartitions); systemAdmin.createStream(accesslogSpec); systemAdmin.validateStream(accesslogSpec);
LOG.info(String.format("changelog stream %s already exists.", systemStream.getStream())); systemAdmin.validateStream(changelogSpec); new StreamSpec(accesslogStream, accesslogStream, systemStream.getSystem(), maxChangeLogStreamPartitions); systemAdmin.createStream(accesslogSpec); systemAdmin.validateStream(accesslogSpec);
@Test(expected = StreamValidationException.class) public void testStartFailsOnTopicValidationErrors() { KafkaStreamSpec checkpointSpec = new KafkaStreamSpec(CHECKPOINT_TOPIC, CHECKPOINT_TOPIC, CHECKPOINT_SYSTEM, 1); // create an admin that throws an exception during validateStream SystemAdmin mockAdmin = newAdmin("0", "10"); doThrow(new StreamValidationException("invalid stream")).when(mockAdmin).validateStream(checkpointSpec); SystemFactory factory = newFactory(mock(SystemProducer.class), mock(SystemConsumer.class), mockAdmin); KafkaCheckpointManager checkpointManager = new KafkaCheckpointManager(checkpointSpec, factory, true, mock(Config.class), mock(MetricsRegistry.class), null, new KafkaCheckpointLogKeySerde()); // expect an exception during startup checkpointManager.createResources(); checkpointManager.start(); }
return null; }).when(mockSystemAdmin).validateStream(Mockito.any()); SystemAdmins mockSystemAdmins = Mockito.mock(SystemAdmins.class); Mockito.when(mockSystemAdmins.getSystemAdmin("kafka")).thenReturn(mockSystemAdmin);