Changeset View
Changeset View
Standalone View
Standalone View
java/server/src/test/java/org/softwareheritage/graph/LeavesTest.java
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | public void forwardFromRel() { | ||||
ArrayList<SwhPID> actualLeaves = (ArrayList) endpoint.leaves(new Endpoint.Input(src)).result; | ArrayList<SwhPID> actualLeaves = (ArrayList) endpoint.leaves(new Endpoint.Input(src)).result; | ||||
GraphTest.assertEqualsAnyOrder(expectedLeaves, actualLeaves); | GraphTest.assertEqualsAnyOrder(expectedLeaves, actualLeaves); | ||||
} | } | ||||
@Test | @Test | ||||
public void backwardFromLeaf() { | public void backwardFromLeaf() { | ||||
Graph graph = getGraph(); | Graph graph = getGraph(); | ||||
Endpoint endpoint = new Endpoint(graph, "backward", "*"); | |||||
Endpoint endpoint1 = new Endpoint(graph, "backward", "*"); | |||||
SwhPID src1 = new SwhPID("swh:1:cnt:0000000000000000000000000000000000000015"); | SwhPID src1 = new SwhPID("swh:1:cnt:0000000000000000000000000000000000000015"); | ||||
ArrayList<SwhPID> expectedLeaves1 = new ArrayList<>(); | ArrayList<SwhPID> expectedLeaves1 = new ArrayList<>(); | ||||
expectedLeaves1.add(new SwhPID("swh:1:rel:0000000000000000000000000000000000000019")); | expectedLeaves1.add(new SwhPID("swh:1:rel:0000000000000000000000000000000000000019")); | ||||
ArrayList<SwhPID> actualLeaves1 = (ArrayList) endpoint.leaves(new Endpoint.Input(src1)).result; | ArrayList<SwhPID> actualLeaves1 = (ArrayList) endpoint1.leaves(new Endpoint.Input(src1)).result; | ||||
GraphTest.assertEqualsAnyOrder(expectedLeaves1, actualLeaves1); | GraphTest.assertEqualsAnyOrder(expectedLeaves1, actualLeaves1); | ||||
Endpoint endpoint2 = new Endpoint(graph, "backward", "*"); | |||||
SwhPID src2 = new SwhPID("swh:1:cnt:0000000000000000000000000000000000000004"); | SwhPID src2 = new SwhPID("swh:1:cnt:0000000000000000000000000000000000000004"); | ||||
ArrayList<SwhPID> expectedLeaves2 = new ArrayList<>(); | ArrayList<SwhPID> expectedLeaves2 = new ArrayList<>(); | ||||
expectedLeaves2.add(new SwhPID("swh:1:ori:0000000000000000000000000000000000000021")); | expectedLeaves2.add(new SwhPID("swh:1:ori:0000000000000000000000000000000000000021")); | ||||
expectedLeaves2.add(new SwhPID("swh:1:rel:0000000000000000000000000000000000000019")); | expectedLeaves2.add(new SwhPID("swh:1:rel:0000000000000000000000000000000000000019")); | ||||
ArrayList<SwhPID> actualLeaves2 = (ArrayList) endpoint.leaves(new Endpoint.Input(src2)).result; | ArrayList<SwhPID> actualLeaves2 = (ArrayList) endpoint2.leaves(new Endpoint.Input(src2)).result; | ||||
GraphTest.assertEqualsAnyOrder(expectedLeaves2, actualLeaves2); | GraphTest.assertEqualsAnyOrder(expectedLeaves2, actualLeaves2); | ||||
} | } | ||||
@Test | @Test | ||||
public void forwardRevToRevOnly() { | public void forwardRevToRevOnly() { | ||||
Graph graph = getGraph(); | Graph graph = getGraph(); | ||||
SwhPID src = new SwhPID("swh:1:rev:0000000000000000000000000000000000000018"); | SwhPID src = new SwhPID("swh:1:rev:0000000000000000000000000000000000000018"); | ||||
Endpoint endpoint = new Endpoint(graph, "forward", "rev:rev"); | Endpoint endpoint = new Endpoint(graph, "forward", "rev:rev"); | ||||
Show All 37 Lines |