ObjectId newId = RevObjectTestSupport.hashString(n.toString()); Envelope newBounds = new Envelope(n.bounds().get()); newBounds.translate(0.1, 0.1);
ObjectId newId = RevObjectTestSupport.hashString(n.toString()); Envelope newBounds = new Envelope(n.bounds().get()); newBounds.translate(0.1, 0.1);
@Test public void testToString() { Node node = RevObjectFactory.defaultInstance().createNode("Points.1", ObjectId.valueOf("abc123000000000000001234567890abcdef0000"), ObjectId.NULL, TYPE.FEATURE, null, null); String readableNode = node.toString(); String expected = RevObjects.toString(node); assertEquals(expected, readableNode.toString()); }
@Test public void nodeReplacedOnEditsWithBaseRevTree() { final RevTree origTree = manuallyCreateBucketsTree(); store.put(origTree); final Set<Node> original = new HashSet<>(); final Set<Node> edited = new HashSet<>(); { Iterator<NodeRef> it = new DepthTreeIterator("", ObjectId.NULL, origTree, store, Strategy.RECURSIVE_FEATURES_ONLY); while (it.hasNext()) { original.add(it.next().getNode()); } for (Node n : original) { ObjectId oid = RevObjectTestSupport.hashString(n.toString()); Node edit = Node.create(n.getName(), oid, ObjectId.NULL, TYPE.FEATURE, n.bounds().orNull()); edited.add(edit); } assertFalse(original.equals(edited)); } strategy = canonical.original(origTree).build(); for (Node n : edited) { strategy.put(n); } Set<Node> edittedResult = new HashSet<>(); DAG root = strategy.buildRoot(); edittedResult.addAll(toNode(flatten(root))); assertEquals(edited.size(), edittedResult.size()); assertEquals(edited, edittedResult); }
@Test public void nodeReplacedOnEditsWithBaseRevTree() { final RevTree origTree = manuallyCreateBucketsTree(); store.put(origTree); final Set<Node> original = new HashSet<>(); final Set<Node> edited = new HashSet<>(); { Iterator<NodeRef> it = new DepthTreeIterator("", ObjectId.NULL, origTree, store, Strategy.RECURSIVE_FEATURES_ONLY); while (it.hasNext()) { original.add(it.next().getNode()); } for (Node n : original) { ObjectId oid = RevObjectTestSupport.hashString(n.toString()); Node edit = RevObjectFactory.defaultInstance().createNode(n.getName(), oid, ObjectId.NULL, TYPE.FEATURE, n.bounds().orNull(), null); edited.add(edit); } assertFalse(original.equals(edited)); } strategy = canonical.original(origTree).build(); for (Node n : edited) { strategy.put(n); } Set<Node> edittedResult = new HashSet<>(); DAG root = strategy.buildRoot(); edittedResult.addAll(toNode(flatten(root))); assertEquals(edited.size(), edittedResult.size()); assertEquals(edited, edittedResult); }
if (i % 5 == 0) { Node oldNode = entry.getNode(); ObjectId newId = RevObjectTestSupport.hashString(oldNode.toString()); Envelope newBounds = new Envelope(oldNode.bounds().get()); if (i % 10 == 0) {
if (i % 5 == 0) { Node oldNode = entry.getNode(); ObjectId newId = RevObjectTestSupport.hashString(oldNode.toString()); Envelope newBounds = new Envelope(oldNode.bounds().get()); if (i % 10 == 0) {