Long firstRevisionId = scenario.create();
Long secondRevisionId = scenario.update_A_and_add_D_and_E();
List<Node> actuals = createAndExecuteQuery(firstRevisionId, 0);
String json = String.format("{ \"/#%1$s\" : {} }", firstRevisionId);
Node expected = NodeBuilder.build(json);
Iterator<Node> expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(secondRevisionId, 0);
json = String.format("{ \"/#%1$s\" : {} }", firstRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(firstRevisionId, 1);
json = String.format("{ \"/#%1$s\" : { \"a#%1$s\" : { \"int\" : 1 } } }", firstRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(secondRevisionId, 1);
json = String.format("{ \"/#%1$s\" : { \"a#%2$s\" : { \"int\" : 1 , \"double\" : 0.123 } } }",
firstRevisionId, secondRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(firstRevisionId, 2);
json = String.format("{ \"/#%1$s\" : { \"a#%1$s\" : { \"int\" : 1, \"b#%1$s\" : { \"string\" : \"foo\" } , \"c#%1$s\" : { \"bool\" : true } } } }",
firstRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(secondRevisionId, 2);
json = String.format("{ \"/#%1$s\" : { \"a#%2$s\" : { \"int\" : 1 , \"double\" : 0.123 , \"b#%2$s\" : { \"string\" : \"foo\" } , \"c#%1$s\" : { \"bool\" : true }, \"d#%2$s\" : { \"null\" : null } } } }",
firstRevisionId, secondRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(firstRevisionId);
json = String.format("{ \"/#%1$s\" : { \"a#%1$s\" : { \"int\" : 1 , \"b#%1$s\" : { \"string\" : \"foo\" } , \"c#%1$s\" : { \"bool\" : true } } } }",
firstRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
actuals = createAndExecuteQuery(secondRevisionId);
json = String.format("{ \"/#%1$s\" : { \"a#%2$s\" : { \"int\" : 1 , \"double\" : 0.123 , \"b#%2$s\" : { \"string\" : \"foo\", \"e#%2$s\" : { \"array\" : [ 123, null, 123.456, \"for:bar\", true ] } } , \"c#%1$s\" : { \"bool\" : true }, \"d#%2$s\" : { \"null\" : null } } } }",
firstRevisionId, secondRevisionId);
expected = NodeBuilder.build(json);
expecteds = expected.getChildNodeEntries(0, -1);
NodeAssert.assertEquals(expecteds, actuals);
}