@Test public void testResolveNameOneArg() { Map<GraphName, GraphName> remappings = new HashMap<GraphName, GraphName>(); GraphName nodeName = GraphName.of("/node"); NodeNameResolver r = new NodeNameResolver(nodeName, NameResolver.newRootFromRemappings(remappings)); assertGraphNameEquals("/foo", r.resolve("foo")); assertGraphNameEquals("/foo", r.resolve("/foo")); assertGraphNameEquals("/foo/bar", r.resolve("foo/bar")); assertGraphNameEquals("/node/foo", r.resolve("~foo")); assertGraphNameEquals("/node/foo/bar", r.resolve("~foo/bar")); assertGraphNameEquals("/node/foo", r.resolve("~/foo")); nodeName = GraphName.of("/ns1/node"); r = new NodeNameResolver(nodeName, NameResolver.newRootFromRemappings(remappings)); assertGraphNameEquals("/ns1/node/foo", r.resolve("~foo")); assertGraphNameEquals("/ns1/node/foo", r.resolve("~/foo")); assertGraphNameEquals("/ns1/node/foo/bar", r.resolve("~/foo/bar")); nodeName = GraphName.of("/ns2/node"); r = new NodeNameResolver(nodeName, NameResolver.newFromNamespaceAndRemappings("/ns1", remappings)); assertGraphNameEquals("/ns1/foo", r.resolve("foo")); assertGraphNameEquals("/foo", r.resolve("/foo")); assertGraphNameEquals("/ns1/foo/bar", r.resolve("foo/bar")); assertGraphNameEquals("/ns2/node/foo", r.resolve("~foo")); assertGraphNameEquals("/ns2/node/foo/bar", r.resolve("~foo/bar")); assertGraphNameEquals("/ns2/node/foo", r.resolve("~/foo")); }
@Override public GraphName resolve(GraphName name) { GraphName graphName = lookUpRemapping(name); if (graphName.isPrivate()) { return resolve(privateNamespace, graphName.toRelative()); } return super.resolve(name); }
NodeNameResolver extends NameResolver { @Override public GraphName resolve(GraphName name) { GraphName graphName = lookUpRemapping(name); if (graphName.isPrivate()) { return resolve(privateNamespace, graphName.toRelative()); } return super.resolve(name); } }
NodeNameResolver extends NameResolver { @Override public GraphName resolve(GraphName name) { GraphName graphName = lookUpRemapping(name); if (graphName.isPrivate()) { return resolve(privateNamespace, graphName.toRelative()); } return super.resolve(name); } NodeNameResolver(GraphName nodeName, NameResolver defaultResolver); }
NodeNameResolver extends NameResolver { @Override public GraphName resolve(GraphName name) { GraphName graphName = lookUpRemapping(name); if (graphName.isPrivate()) { return resolve(privateNamespace, graphName.toRelative()); } return super.resolve(name); } NodeNameResolver(GraphName nodeName, NameResolver defaultResolver); @Override GraphName resolve(GraphName name); @Override GraphName resolve(String name); }
NodeNameResolver extends NameResolver { @Override public GraphName resolve(GraphName name) { GraphName graphName = lookUpRemapping(name); if (graphName.isPrivate()) { return resolve(privateNamespace, graphName.toRelative()); } return super.resolve(name); } NodeNameResolver(GraphName nodeName, NameResolver defaultResolver); @Override GraphName resolve(GraphName name); @Override GraphName resolve(String name);  }