Search in sources :

Example 6 with BlameReport

use of org.locationtech.geogig.api.porcelain.BlameReport in project GeoGig by boundlessgeo.

the class BlameOpTest method testBlameChangedByTwoCommits.

@Test
public void testBlameChangedByTwoCommits() throws Exception {
    insertAndAdd(points1);
    RevCommit firstCommit = geogig.command(CommitOp.class).call();
    Feature pointsModified = feature(pointsType, idP1, "StringProp1_3", new Integer(1000), "POINT(1 1)");
    insertAndAdd(pointsModified);
    RevCommit secondCommit = geogig.command(CommitOp.class).call();
    String path = NodeRef.appendChild(pointsName, idP1);
    BlameReport report = geogig.command(BlameOp.class).setPath(path).call();
    Map<String, ValueAndCommit> changes = report.getChanges();
    assertEquals(3, changes.size());
    assertEquals(secondCommit, changes.get("sp").commit);
    assertEquals(firstCommit, changes.get("ip").commit);
    assertEquals(firstCommit, changes.get("pp").commit);
    assertEquals(pointsModified.getProperty("sp").getValue(), changes.get("sp").value.get());
    assertEquals(points1.getProperty("ip").getValue(), changes.get("ip").value.get());
    assertEquals(points1.getProperty("pp").getValue(), changes.get("pp").value.get());
    report = geogig.command(BlameOp.class).setPath(path).setCommit(firstCommit.getId()).call();
    changes = report.getChanges();
    assertEquals(3, changes.size());
    Collection<ValueAndCommit> commits = changes.values();
    for (ValueAndCommit valueAndCommit : commits) {
        assertEquals(firstCommit, valueAndCommit.commit);
    }
}
Also used : ValueAndCommit(org.locationtech.geogig.api.porcelain.ValueAndCommit) BlameReport(org.locationtech.geogig.api.porcelain.BlameReport) CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) Feature(org.opengis.feature.Feature) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Aggregations

BlameReport (org.locationtech.geogig.api.porcelain.BlameReport)6 RevCommit (org.locationtech.geogig.api.RevCommit)5 ValueAndCommit (org.locationtech.geogig.api.porcelain.ValueAndCommit)5 Test (org.junit.Test)4 CommitOp (org.locationtech.geogig.api.porcelain.CommitOp)4 BlameException (org.locationtech.geogig.api.porcelain.BlameException)3 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ConsoleReader (jline.console.ConsoleReader)1 Ansi (org.fusesource.jansi.Ansi)1 Context (org.locationtech.geogig.api.Context)1 GeoGIG (org.locationtech.geogig.api.GeoGIG)1 ObjectId (org.locationtech.geogig.api.ObjectId)1 RevParse (org.locationtech.geogig.api.plumbing.RevParse)1 BlameOp (org.locationtech.geogig.api.porcelain.BlameOp)1 InvalidParameterException (org.locationtech.geogig.cli.InvalidParameterException)1 CommandContext (org.locationtech.geogig.web.api.CommandContext)1 CommandResponse (org.locationtech.geogig.web.api.CommandResponse)1 CommandSpecException (org.locationtech.geogig.web.api.CommandSpecException)1