Search in sources :

Example 51 with ProcessedChange

use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.

the class MetadataModuleTest method testMessageTransformerForNoDescription.

@Test
public void testMessageTransformerForNoDescription() throws Exception {
    runWorkflow(WorkflowMode.SQUASH, "" + "metadata.squash_notes(" + "  prefix = 'Importing foo project:\\n\\n'," + "  show_description = False," + ")");
    ProcessedChange change = Iterables.getOnlyElement(destination.processed);
    assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + "  - 2 by Foo Baz <foo@baz.com>\n" + "  - 1 by Foo Bar <foo@bar.com>\n");
    assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
Also used : ProcessedChange(com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange) Test(org.junit.Test)

Example 52 with ProcessedChange

use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.

the class MetadataModuleTest method testAddHeaderLabelNotFoundIgnore.

@Test
public void testAddHeaderLabelNotFoundIgnore() throws Exception {
    options.setLastRevision(origin.resolve("HEAD").asString());
    Workflow<?, ?> wf = createWorkflow(WorkflowMode.ITERATIVE, "metadata.add_header('[HEADER with ${LABEL}]', " + "ignore_label_not_found = True)");
    origin.addSimpleChange(0, "A change\n");
    wf.run(workdir, ImmutableList.of());
    ProcessedChange change = Iterables.getLast(destination.processed);
    assertThat(change.getChangesSummary()).isEqualTo("A change\n");
}
Also used : ProcessedChange(com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange) Test(org.junit.Test)

Example 53 with ProcessedChange

use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.

the class MetadataModuleTest method testMessageTransformerForSquashCompactNoRefOrAuthor.

@Test
public void testMessageTransformerForSquashCompactNoRefOrAuthor() throws Exception {
    runWorkflow(WorkflowMode.SQUASH, "" + "metadata.squash_notes(" + "  prefix = 'Importing foo project:\\n\\n'," + "  oldest_first = True," + "  show_ref = False," + "  show_author = False," + ")");
    ProcessedChange change = Iterables.getOnlyElement(destination.processed);
    assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + "  - second commit\n" + "  - third commit\n");
    assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
Also used : ProcessedChange(com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange) Test(org.junit.Test)

Example 54 with ProcessedChange

use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.

the class MetadataModuleTest method testMessageTransformerForSquashCompact.

@Test
public void testMessageTransformerForSquashCompact() throws Exception {
    runWorkflow(WorkflowMode.SQUASH, "" + "metadata.map_author({" + "    'Foo Bar': 'Public Foo Bar <public@foobar.com>'," + "    'Foo Baz': 'Public Foo Baz <public@foobaz.com>'," + "})," + "metadata.squash_notes(" + "  prefix = 'Importing foo project:\\n\\n'," + "  oldest_first = True," + ")");
    ProcessedChange change = Iterables.getOnlyElement(destination.processed);
    assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + "  - 1 second commit by Foo Bar <foo@bar.com>\n" + "  - 2 third commit by Foo Baz <foo@baz.com>\n");
    assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
Also used : ProcessedChange(com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange) Test(org.junit.Test)

Example 55 with ProcessedChange

use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.

the class MetadataModuleTest method testSquashWithMapAuthor.

@Test
public void testSquashWithMapAuthor() throws Exception {
    runWorkflow(WorkflowMode.SQUASH, "" + "metadata.map_author({" + "    'Foo Bar': 'Public Foo Bar <public@foobar.com>'," + "    'Foo Baz': 'Public Foo Baz <public@foobaz.com>'," + "}," + "  map_all_changes = True)," + "metadata.squash_notes(" + "  prefix = 'Importing foo project:\\n\\n'," + "  oldest_first = True," + ")");
    ProcessedChange change = Iterables.getOnlyElement(destination.processed);
    assertThat(change.getChangesSummary()).isEqualTo("" + "Importing foo project:\n" + "\n" + "  - 1 second commit by Public Foo Bar <public@foobar.com>\n" + "  - 2 third commit by Public Foo Baz <public@foobaz.com>\n");
    assertThat(change.getAuthor()).isEqualTo(DEFAULT_AUTHOR);
}
Also used : ProcessedChange(com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange) Test(org.junit.Test)

Aggregations

ProcessedChange (com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange)59 Test (org.junit.Test)57 Author (com.google.copybara.authoring.Author)11 Revision (com.google.copybara.Revision)4 Workflow (com.google.copybara.Workflow)4 RecordsProcessCallDestination (com.google.copybara.testing.RecordsProcessCallDestination)4 ValidationException (com.google.copybara.exception.ValidationException)2 DummyRevision (com.google.copybara.testing.DummyRevision)2 TemporalAccessor (java.time.temporal.TemporalAccessor)1 HashSet (java.util.HashSet)1