Search in sources :

Example 1 with MigrationInfo

use of com.google.copybara.MigrationInfo in project copybara by google.

the class GerritDestinationTest method process.

private void process(DummyRevision originRef, GerritDestination destination) throws ValidationException, RepoException, IOException {
    WriterContext writerContext = new WriterContext("GerritDestination", "TEST", false, new DummyRevision("test"), Glob.ALL_FILES.roots());
    Writer<GitRevision> gitRevisionWriter = destination.newWriter(writerContext);
    // This is largely unused, except for the label finder.
    TransformWork work = new TransformWork(workdir, new Metadata("Desc", new Author("foo", "foo@foo.com"), ImmutableSetMultimap.of()), Changes.EMPTY, console, new MigrationInfo(DummyOrigin.LABEL_NAME, null), originRef, console -> new DummyEndpoint(), console -> gitRevisionWriter.getFeedbackEndPoint(console), () -> gitRevisionWriter.getDestinationReader(console, null, workdir));
    ImmutableList<DestinationEffect> result = gitRevisionWriter.write(TransformResults.of(workdir, originRef).withLabelFinder(work::getAllLabels).withIdentity(originRef.asString()), Glob.createGlob(ImmutableList.of("**"), excludedDestinationPaths), console);
    assertThat(result).hasSize(1);
    assertThat(result.get(0).getErrors()).isEmpty();
    assertThat(result.get(0).getType()).isEqualTo(Type.CREATED);
    assertThat(result.get(0).getDestinationRef().getType()).isEqualTo("commit");
    assertThat(result.get(0).getDestinationRef().getId()).matches("[0-9a-f]{40}");
}
Also used : DummyEndpoint(com.google.copybara.testing.DummyEndpoint) WriterContext(com.google.copybara.WriterContext) MigrationInfo(com.google.copybara.MigrationInfo) DestinationEffect(com.google.copybara.DestinationEffect) TransformWork(com.google.copybara.TransformWork) DummyRevision(com.google.copybara.testing.DummyRevision) Metadata(com.google.copybara.Metadata) Author(com.google.copybara.authoring.Author)

Aggregations

DestinationEffect (com.google.copybara.DestinationEffect)1 Metadata (com.google.copybara.Metadata)1 MigrationInfo (com.google.copybara.MigrationInfo)1 TransformWork (com.google.copybara.TransformWork)1 WriterContext (com.google.copybara.WriterContext)1 Author (com.google.copybara.authoring.Author)1 DummyEndpoint (com.google.copybara.testing.DummyEndpoint)1 DummyRevision (com.google.copybara.testing.DummyRevision)1