Index: src/test/java/org/modeshape/test/integration/AbstractModeShapeTest.java =================================================================== --- src/test/java/org/modeshape/test/integration/AbstractModeShapeTest.java (revision 2478) +++ src/test/java/org/modeshape/test/integration/AbstractModeShapeTest.java (working copy) @@ -80,6 +80,10 @@ @After public void afterEach() throws Exception { } + + protected void setSession(Session session) { + this.session = session; + } protected static void startEngine( Class testClass, String resourcePathToConfigurationFile, Index: src/test/java/org/modeshape/test/integration/sequencer/XmlSequencerIntegrationTest.java =================================================================== --- src/test/java/org/modeshape/test/integration/sequencer/XmlSequencerIntegrationTest.java (revision 2478) +++ src/test/java/org/modeshape/test/integration/sequencer/XmlSequencerIntegrationTest.java (working copy) @@ -114,4 +114,20 @@ printQuery("SELECT * FROM [modexml:element] WHERE NAME() = 'xhtml:p'", 2); printQuery("SELECT * FROM [modexml:elementContent]", 13); } + + /* + * Validates FixFor( "MODE-981" ) + */ + @Test + public void shouldSequence2XmlFiles2() throws Exception { + // print = true; + uploadFile("docWithComments.xml", "/files/"); + waitUntilSequencedNodesIs(1); + printQuery("SELECT * FROM [nt:base] ORDER BY [jcr:path]", 18); + + uploadFile("docWithComments2.xml", "/files/"); + waitUntilSequencedNodesIs(1); + + printQuery("SELECT * FROM [nt:base] ORDER BY [jcr:path]", 20); + } } Index: src/test/java/org/modeshape/test/integration/jdbc/JcrDriverIntegrationTest.java =================================================================== --- src/test/java/org/modeshape/test/integration/jdbc/JcrDriverIntegrationTest.java (revision 2478) +++ src/test/java/org/modeshape/test/integration/jdbc/JcrDriverIntegrationTest.java (working copy) @@ -739,4 +739,99 @@ results.assertRowCount(1); } + + /* + * FixFor( "MODE-981" ) + * + * The issue was the first read was cached, and after a new file was uploaded, subsequent reads did not see the new rows. + * This was due to a new session wasn't being used. + */ + @Test + public void shouldSequence2XmlFiles() throws Exception { + String[] expected1 = { + "jcr:primaryType[STRING] jcr:path[PATH] jcr:name[STRING] jcr:score[DOUBLE] mode:localName[STRING] mode:depth[LONG]", + "mode:root / 1.0 0", + "nt:unstructured /Cars Cars 1.0 Cars 1", + "nt:unstructured /Cars/Hybrid Hybrid 1.0 Hybrid 2", + "car:Car /Cars/Hybrid/Nissan Altima Nissan Altima 1.0 Nissan Altima 3", + "car:Car /Cars/Hybrid/Toyota Highlander Toyota Highlander 1.0 Toyota Highlander 3", + "car:Car /Cars/Hybrid/Toyota Prius Toyota Prius 1.0 Toyota Prius 3", + "nt:unstructured /Cars/Luxury Luxury 1.0 Luxury 2", + "car:Car /Cars/Luxury/Bentley Continental Bentley Continental 1.0 Bentley Continental 3", + "car:Car /Cars/Luxury/Cadillac DTS Cadillac DTS 1.0 Cadillac DTS 3", + "car:Car /Cars/Luxury/Lexus IS350 Lexus IS350 1.0 Lexus IS350 3", + "nt:unstructured /Cars/Sports Sports 1.0 Sports 2", + "car:Car /Cars/Sports/Aston Martin DB9 Aston Martin DB9 1.0 Aston Martin DB9 3", + "car:Car /Cars/Sports/Infiniti G37 Infiniti G37 1.0 Infiniti G37 3", + "nt:unstructured /Cars/Utility Utility 1.0 Utility 2", + "car:Car /Cars/Utility/Ford F-150 Ford F-150 1.0 Ford F-150 3", + "car:Car /Cars/Utility/Hummer H3 Hummer H3 1.0 Hummer H3 3", + "car:Car /Cars/Utility/Land Rover LR2 Land Rover LR2 1.0 Land Rover LR2 3", + "car:Car /Cars/Utility/Land Rover LR3 Land Rover LR3 1.0 Land Rover LR3 3", + "nt:unstructured /NodeB NodeB 1.0 NodeB 1", + "nt:unstructured /Other Other 1.0 Other 1", + "nt:unstructured /Other/NodeA NodeA 1.0 NodeA 2", + "nt:unstructured /Other/NodeA[2] NodeA 1.0 NodeA 2", + "nt:unstructured /Other/NodeA[3] NodeA 1.0 NodeA 2", + "nt:folder /files files 1.0 files 1", + "nt:file /files/docWithComments.xml docWithComments.xml 1.0 docWithComments.xml 2", + "nt:resource /files/docWithComments.xml/jcr:content jcr:content 1.0 content 3" + }; + + String[] expected2 = { + "jcr:primaryType[STRING] jcr:path[PATH] jcr:name[STRING] jcr:score[DOUBLE] mode:localName[STRING] mode:depth[LONG]", + "mode:root / 1.0 0", + "nt:unstructured /Cars Cars 1.0 Cars 1", + "nt:unstructured /Cars/Hybrid Hybrid 1.0 Hybrid 2", + "car:Car /Cars/Hybrid/Nissan Altima Nissan Altima 1.0 Nissan Altima 3", + "car:Car /Cars/Hybrid/Toyota Highlander Toyota Highlander 1.0 Toyota Highlander 3", + "car:Car /Cars/Hybrid/Toyota Prius Toyota Prius 1.0 Toyota Prius 3", + "nt:unstructured /Cars/Luxury Luxury 1.0 Luxury 2", + "car:Car /Cars/Luxury/Bentley Continental Bentley Continental 1.0 Bentley Continental 3", + "car:Car /Cars/Luxury/Cadillac DTS Cadillac DTS 1.0 Cadillac DTS 3", + "car:Car /Cars/Luxury/Lexus IS350 Lexus IS350 1.0 Lexus IS350 3", + "nt:unstructured /Cars/Sports Sports 1.0 Sports 2", + "car:Car /Cars/Sports/Aston Martin DB9 Aston Martin DB9 1.0 Aston Martin DB9 3", + "car:Car /Cars/Sports/Infiniti G37 Infiniti G37 1.0 Infiniti G37 3", + "nt:unstructured /Cars/Utility Utility 1.0 Utility 2", + "car:Car /Cars/Utility/Ford F-150 Ford F-150 1.0 Ford F-150 3", + "car:Car /Cars/Utility/Hummer H3 Hummer H3 1.0 Hummer H3 3", + "car:Car /Cars/Utility/Land Rover LR2 Land Rover LR2 1.0 Land Rover LR2 3", + "car:Car /Cars/Utility/Land Rover LR3 Land Rover LR3 1.0 Land Rover LR3 3", + "nt:unstructured /NodeB NodeB 1.0 NodeB 1", + "nt:unstructured /Other Other 1.0 Other 1", + "nt:unstructured /Other/NodeA NodeA 1.0 NodeA 2", + "nt:unstructured /Other/NodeA[2] NodeA 1.0 NodeA 2", + "nt:unstructured /Other/NodeA[3] NodeA 1.0 NodeA 2", + "nt:folder /files files 1.0 files 1", + "nt:file /files/docWithComments.xml docWithComments.xml 1.0 docWithComments.xml 2", + "nt:resource /files/docWithComments.xml/jcr:content jcr:content 1.0 content 3", + "nt:file /files/docWithComments2.xml docWithComments2.xml 1.0 docWithComments2.xml 2", + "nt:resource /files/docWithComments2.xml/jcr:content jcr:content 1.0 content 3" + }; + + + Session session = repository.login(); + try { + + this.setSession(session); + + uploadFile("docWithComments.xml", "/files/"); + + print = true; + + + ConnectionResultsComparator.executeTest(this.connection, "SELECT * FROM [nt:base] ORDER BY [jcr:path]", expected1, 26); + + uploadFile("docWithComments2.xml", "/files/"); + + ConnectionResultsComparator.executeTest(this.connection, "SELECT * FROM [nt:base] ORDER BY [jcr:path]", expected2, 28); + + + + } finally { + session.logout(); + } + + } }