Search in sources :

Example 1 with MigrationFinishedEvent

use of com.google.copybara.monitor.EventMonitor.MigrationFinishedEvent in project copybara by google.

the class ConsoleEventMonitorTest method testEventMonitorPrintsToConsole.

@Test
public void testEventMonitorPrintsToConsole() {
    eventMonitor.onMigrationStarted(new MigrationStartedEvent());
    eventMonitor.onMigrationFinished(new MigrationFinishedEvent(ExitCode.SUCCESS));
    eventMonitor.onChangeMigrationStarted(new ChangeMigrationStartedEvent());
    DestinationEffect destinationEffect = new DestinationEffect(Type.CREATED, "Created revision 1234", ImmutableList.of(new OriginRef("ABCD")), new DestinationRef("1234", "commit", /*url=*/
    null));
    eventMonitor.onChangeMigrationFinished(new ChangeMigrationFinishedEvent(ImmutableList.of(destinationEffect), ImmutableMultimap.of(), ImmutableMultimap.of()));
    MigrationReference<DummyRevision> workflow = MigrationReference.create("workflow", new DummyRevision("1111"), ImmutableList.of(newChange("2222"), newChange("3333")));
    Info<?> info = Info.create(ImmutableMultimap.of("origin", "foo"), ImmutableMultimap.of("dest", "bar"), ImmutableList.of(workflow));
    eventMonitor.onInfoFinished(new InfoFinishedEvent(info, ImmutableMap.of("foo_a", "foo_b")));
    console.assertThat().equalsNext(VERBOSE, "onMigrationStarted(): MigrationStartedEvent").equalsNext(VERBOSE, "onMigrationFinished(): " + "MigrationFinishedEvent{exitCode=SUCCESS, profiler=null}").equalsNext(VERBOSE, "onChangeMigrationStarted(): ChangeMigrationStartedEvent{}").matchesNext(VERBOSE, "onChangeMigrationFinished[(][)]: ChangeMigrationFinishedEvent[{].*[}]").matchesNext(VERBOSE, "onInfoFinished[(][)]: InfoFinishedEvent[{].*(origin).*" + "(foo).*(dest).*(bar).*(foo_a).*(foo_b).*[}]").containsNoMoreMessages();
}
Also used : DestinationRef(com.google.copybara.DestinationEffect.DestinationRef) InfoFinishedEvent(com.google.copybara.monitor.EventMonitor.InfoFinishedEvent) DestinationEffect(com.google.copybara.DestinationEffect) ChangeMigrationFinishedEvent(com.google.copybara.monitor.EventMonitor.ChangeMigrationFinishedEvent) ChangeMigrationStartedEvent(com.google.copybara.monitor.EventMonitor.ChangeMigrationStartedEvent) DummyRevision(com.google.copybara.testing.DummyRevision) MigrationStartedEvent(com.google.copybara.monitor.EventMonitor.MigrationStartedEvent) ChangeMigrationStartedEvent(com.google.copybara.monitor.EventMonitor.ChangeMigrationStartedEvent) MigrationFinishedEvent(com.google.copybara.monitor.EventMonitor.MigrationFinishedEvent) ChangeMigrationFinishedEvent(com.google.copybara.monitor.EventMonitor.ChangeMigrationFinishedEvent) OriginRef(com.google.copybara.DestinationEffect.OriginRef) Test(org.junit.Test)

Aggregations

DestinationEffect (com.google.copybara.DestinationEffect)1 DestinationRef (com.google.copybara.DestinationEffect.DestinationRef)1 OriginRef (com.google.copybara.DestinationEffect.OriginRef)1 ChangeMigrationFinishedEvent (com.google.copybara.monitor.EventMonitor.ChangeMigrationFinishedEvent)1 ChangeMigrationStartedEvent (com.google.copybara.monitor.EventMonitor.ChangeMigrationStartedEvent)1 InfoFinishedEvent (com.google.copybara.monitor.EventMonitor.InfoFinishedEvent)1 MigrationFinishedEvent (com.google.copybara.monitor.EventMonitor.MigrationFinishedEvent)1 MigrationStartedEvent (com.google.copybara.monitor.EventMonitor.MigrationStartedEvent)1 DummyRevision (com.google.copybara.testing.DummyRevision)1 Test (org.junit.Test)1