use of com.metabroadcast.columbus.telescope.api.Event in project atlas-deer by atlasapi.
the class ContentBootstrapWorkerTest method testReportingSuccessfulMigrationEvent.
@Test
public void testReportingSuccessfulMigrationEvent() throws RecoverableException, WriteException {
ResourceUpdatedMessage updatedMessage = createUpdatedMessage();
when(resourceRef.getId()).thenReturn(Id.valueOf(1));
when(contentResolver.resolveIds(any(Collection.class))).thenReturn(Futures.immediateFuture(Resolved.valueOf(ImmutableList.of(content))));
when(writer.writeContent(content)).thenReturn(successfulWriteResult);
bootstrapWorker.process(updatedMessage);
verify(telescopeClient, times(1)).createEvent(any(Event.class));
verify(telescopeClient).createEvent(columbusTelescopeEventCaptor.capture());
Event event = columbusTelescopeEventCaptor.getValue();
assertThat(event.getStatus(), is(Event.Status.SUCCESS));
assertThat(event.getType(), is(Event.Type.MIGRATION));
}
use of com.metabroadcast.columbus.telescope.api.Event in project atlas-deer by atlasapi.
the class ContentBootstrapWorkerTest method testReportingMigrationCorrectRawObjectIsSentAsPartOfTheEventReport.
@Test
public void testReportingMigrationCorrectRawObjectIsSentAsPartOfTheEventReport() throws RecoverableException, WriteException, JsonProcessingException {
this.content.setLastFetched(DateTime.parse("2016-08-28T00:00:00Z"));
ResourceUpdatedMessage updatedMessage = createUpdatedMessage();
when(resourceRef.getId()).thenReturn(Id.valueOf(1));
when(contentResolver.resolveIds(any(Collection.class))).thenReturn(Futures.immediateFuture(Resolved.valueOf(ImmutableList.of(content))));
when(writer.writeContent(content)).thenReturn(successfulWriteResult);
when(objectMapper.writeValueAsString(any(Content.class))).thenReturn(TEST_RAW_STRING);
bootstrapWorker.process(updatedMessage);
verify(telescopeClient, times(1)).createEvent(any(Event.class));
verify(telescopeClient).createEvent(columbusTelescopeEventCaptor.capture());
Event event = columbusTelescopeEventCaptor.getValue();
assertThat(event.getEntityState().get().getRaw().get(), is(TEST_RAW_STRING));
assertThat(event.getEntityState().get().getRawMime().get(), is(MimeType.APPLICATION_JSON.toString()));
assertThat(event.getEntityState().get().getAtlasId().get(), is("c"));
}
use of com.metabroadcast.columbus.telescope.api.Event in project atlas-deer by atlasapi.
the class ColumbusTelescopeReporter method reportSuccessfulMigration.
public void reportSuccessfulMigration(Content content) {
EntityState entityState = EntityState.builder().withAtlasId(codec.encode(content.getId().toBigInteger())).withRaw(getContentJsonString(content)).withRawMime(MimeType.APPLICATION_JSON.toString()).build();
Event event = createEvent(entityState, Event.Status.SUCCESS);
telescopeClient.createEvent(event);
}
Aggregations