Search in sources :

Example 6 with Profiler

use of com.google.copybara.profiler.Profiler in project copybara by google.

the class GitMirrorTest method testMirror.

@Test
public void testMirror() throws Exception {
    RecordingListener recordingCallback = new RecordingListener();
    Profiler profiler = new Profiler(new FakeTicker());
    profiler.init(ImmutableList.of(recordingCallback));
    options.general.withProfiler(profiler);
    Migration mirror = createMirrorObj();
    mirror.run(workdir, ImmutableList.of());
    String orig = originRepo.git(originRepo.getGitDir(), "show-ref").getStdout();
    String dest = destRepo.git(destRepo.getGitDir(), "show-ref").getStdout();
    assertThat(dest).isEqualTo(orig);
    recordingCallback.assertMatchesNext(EventType.START, "//copybara").assertMatchesNext(EventType.START, "//copybara/run/default").assertMatchesNext(EventType.START, "//copybara/run/default/fetch").assertMatchesNext(EventType.END, "//copybara/run/default/fetch").assertMatchesNext(EventType.START, "//copybara/run/default/push").assertMatchesNext(EventType.END, "//copybara/run/default/push").assertMatchesNext(EventType.END, "//copybara/run/default");
}
Also used : Profiler(com.google.copybara.profiler.Profiler) RecordingListener(com.google.copybara.testing.profiler.RecordingListener) Migration(com.google.copybara.config.Migration) FakeTicker(com.google.common.testing.FakeTicker) Test(org.junit.Test)

Example 7 with Profiler

use of com.google.copybara.profiler.Profiler in project copybara by google.

the class RemoteArchiveOriginTest method setUp.

@Before
public void setUp() throws Exception {
    workdir = Files.createTempDirectory("workdir");
    ticker = new FakeTicker().setAutoIncrementStep(1, TimeUnit.MILLISECONDS);
    profiler = new Profiler(ticker);
    remoteFileOptions = new RemoteFileOptions();
}
Also used : Profiler(com.google.copybara.profiler.Profiler) FakeTicker(com.google.common.testing.FakeTicker) Before(org.junit.Before)

Aggregations

Profiler (com.google.copybara.profiler.Profiler)7 Migration (com.google.copybara.config.Migration)3 ProfilerTask (com.google.copybara.profiler.Profiler.ProfilerTask)3 SkylarkConsole (com.google.copybara.transform.SkylarkConsole)3 Before (org.junit.Before)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 Preconditions (com.google.common.base.Preconditions)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableSetMultimap (com.google.common.collect.ImmutableSetMultimap)2 FakeTicker (com.google.common.testing.FakeTicker)2 Action (com.google.copybara.action.Action)2 ConfigFile (com.google.copybara.config.ConfigFile)2 RepoException (com.google.copybara.exception.RepoException)2 ValidationException (com.google.copybara.exception.ValidationException)2 ChangeMigrationFinishedEvent (com.google.copybara.monitor.EventMonitor.ChangeMigrationFinishedEvent)2 IOException (java.io.IOException)2 Path (java.nio.file.Path)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Nullable (javax.annotation.Nullable)2