Bug 780915 (SOA-3377) - Query is not addressing existing nodes inside FileSystem Connector's repository (The Query can't search existing repository nodes)
Summary: Query is not addressing existing nodes inside FileSystem Connector's reposito...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: SOA-3377
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: EDS
Version: 5.2.0.ER3
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 5.2.0.ER4
Assignee: Van Halbert
QA Contact:
URL: http://jira.jboss.org/jira/browse/SOA...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-14 14:43 UTC by Van Halbert
Modified: 2011-10-11 17:02 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Windows Vista 32-bit Jdk6 Maven3
Last Closed: 2011-10-11 17:02:35 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SOA-3377 0 None None None Never

Description Van Halbert 2011-09-14 14:43:08 UTC
Steps to Reproduce:      We can use the [FileSystemRepositoryIntegrationTest.java|https://github.com/ModeShape/modeshape/blob/master/modeshape-integration-tests/src/test/java/org/modeshape/test/integration/filesystem/FileSystemRepositoryIntegrationTest.java] to illustrate the issue, let us add some folders ie:folder1 & folder2 into the repository before running the unit tests.

{code:java}  
@Override
public void beforeEach() throws Exception {
    // Delete the directory used for the FS store ...
    FileUtil.delete("target/fsRepoWithProps");
        
    // Now make the root directory ...
    new File("target/fsRepoWithProps/root").mkdirs();
    new File("target/fsRepoWithProps/root/defaultWorkspace/folder1").mkdirs();
    new File("target/fsRepoWithProps/root/defaultWorkspace/folder2").mkdirs();

    super.beforeEach();
}
{code} 
 
Let us create a new unit @Test TestQueryingExistingContent() as below:
{code:java}
    @Test
    public void TestQueryingExistingContent() throws Exception {
    startEngineUsing("config/configRepositoryForFileSystemWithExtraProperties.xml");
    Session session = session();
    
    //Create a new Node (after session is started)
    session.getRootNode().addNode("NewFolder", "nt:folder");
    session.save();
    
    //Query all nodes
    String sql = "SELECT * FROM [nt:base]";
    Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2);
    QueryResult result = query.execute();
    System.out.println(result.toString());
    
    logout();    
    }
{code}

The result of @Test TestQueryingExistingContent() :-

{code} 
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.modeshape.test.integration.filesystem.FileSystemRepositoryIntegrationTest
+---+-----------------+------------+-----------+-----------+----------------+------------+------------------------------------------------------------------------------------+----------------+
| # | jcr:primaryType | jcr:path   | jcr:name  | jcr:score | mode:localName | mode:depth | Location(nt:base)                                                                  | Score(nt:base) |
+---+-----------------+------------+-----------+-----------+----------------+------------+------------------------------------------------------------------------------------+----------------+
| 1 | mode:root       | /          |           | 1.0       |                | 0          | </ && [{http://www.modeshape.org/1.0}uuid = cafebabe-cafe-babe-cafe-babecafebabe]> | 1.0            |
| 2 | nt:folder       | /NewFolder | NewFolder | 1.0       | NewFolder      | 1          | /{}NewFolder                                                                       | 1.0            |
+---+-----------------+------------+-----------+-----------+----------------+------------+------------------------------------------------------------------------------------+----------------+
{code} 
 
     As shown above, only the Root node and the newly created "NewFolder" node are returned by the Query. The Query won't address the existing "folder1" or "folder2", we can even put some text file into "folder1" or "folder2", it won't show either. So, all existing nodes (except Root node) before session start won't be addressed by the Query. Putting Thread.sleep(3000) before Query.execute() won't help either.

     *Pls noted that for @Test shouldFindAllNodesWhenQueryingContent(), it doesn't address any existing nodes inside the Repository, all its print out via printQuery("SELECT * FROM [nt:base]", 5L, Collections.<String, String>emptyMap()); only return Root node and its newly created nodes after session started (Total 5 rows). However, this @Test still PASS, but by right, it should FAIL because we are expecting 7 rows returned due to the existing "folder1" & "folder2" and is not match with "5L". But of course, if we change the printQuery() -> "5L" to "7L", then this @Test will FAIL with Error:"Expected different number of rows from 'SELECT * FROM [nt:base]". 

project_key: SOA

- The Query is not addressing those existing nodes inside the FileSystem Connector's repository before the Session start. So, the query will just return Root node even though the repository already have multiple folder or files. 
- The Query is only address those nodes created (save or not saved) after Session start. 
- This Query problem confirmed happen to FileSystem connector (as tested so far using Standalone or App Server), whereas for Disk,Database,InMemory connectors, the Query is working just fine. Not tested with other type of connector yet.
- Putting Thread.sleep(3000) before Query.execute won't help.
- Related unit @Test is at \modeshape-integration-tests\src\test\java\org\modeshape\test\integration\filesystem\FileSystemRepositoryIntegrationTest.java

Comment 1 Van Halbert 2011-09-14 14:43:09 UTC
Link: Added: This issue Cloned from MODE-1263


Comment 2 Van Halbert 2011-09-14 14:44:02 UTC
Workflow: Removed: GIT Pull Request workflow  Added: jira
Security: Added: Public


Comment 3 Van Halbert 2011-09-14 14:45:08 UTC
Committed to ModeShape 2.5.x branch:  CommitID: 52153ce2135d860a5efdc0848232c4b92bedb717

Comment 4 Warren Gibson 2011-10-11 17:02:35 UTC
10/11/2011 Passing Unit Test.


Note You need to log in before you can comment on or make changes to this bug.