String pathInSource,
String sourceName,
String workspaceName,
String... extraChildren ) {
FEDERATED_TIMER.start();
Node fedNode = federated.getNodeAt(pathInFederated);
FEDERATED_TIMER.stop();
SOURCE_TIMER.start();
Node sourceNode = graphFor(sourceName, workspaceName).getNodeAt(pathInSource);
SOURCE_TIMER.stop();
// The name should match ...
Path fedPath = fedNode.getLocation().getPath();
Path sourcePath = sourceNode.getLocation().getPath();
if (!fedPath.isRoot() && !sourcePath.isRoot()) {
assertThat(fedNode.getLocation().getPath().getLastSegment().getName(), is(sourceNode.getLocation()
.getPath()
.getLastSegment()
.getName()));
}
// The UUID should match ...
UUID fedUuid = fedNode.getLocation().getUuid();
UUID sourceUuid = sourceNode.getLocation().getUuid();
assertThat(fedUuid, is(sourceUuid));
// The children should match ...
List<Path.Segment> fedChildren = new ArrayList<Path.Segment>();
List<Path.Segment> sourceChildren = new ArrayList<Path.Segment>();
for (Location child : fedNode.getChildren()) {
fedChildren.add(child.getPath().getLastSegment());
}
for (Location child : sourceNode.getChildren()) {
sourceChildren.add(child.getPath().getLastSegment());
}
// Add any extra children to the 'sourceChildren' ...
for (String extraChild : extraChildren) {
sourceChildren.add(context.getValueFactories().getPathFactory().createSegment(extraChild));
}
assertThat(fedChildren, is(sourceChildren));
// The properties should match ...
Map<Name, Property> fedProps = fedNode.getPropertiesByName();
Map<Name, Property> sourceProps = sourceNode.getPropertiesByName();
assertThat(fedProps, is(sourceProps));
// Now, try to get the children only ...
FEDERATED_TIMER.start();
List<Location> children = federated.getChildren().of(pathInFederated);