In AbstractImportXmlTest, a bug in getUnusedUri() causes URI length to grow too 
quickly, causing test to fail when using ORM-PM
-------------------------------------------------------------------------------------------------------------------------------

         Key: JCR-262
         URL: http://issues.apache.org/jira/browse/JCR-262
     Project: Jackrabbit
        Type: Test
  Components: API  
    Versions: 1.0    
    Reporter: Joseph Chen
    Priority: Minor


Test fails when using ORM-PM because the URI exceeds the column size in the 
database.

Here is the current implementation:

    protected String getUnusedURI() throws RepositoryException {
        Set uris = new HashSet(Arrays.asList(nsp.getURIs()));
        String uri = TEST_URI;
        int i = 0;
        while (uris.contains(uri)) {
            uri += i++;
        }
        return uri;
    }

When running the test, the URI grows to become something like this:

When i=50,
"www.apache.org/jackrabbit/test/namespaceImportTest01234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950"

Here is the proposed fix:

    protected String getUnusedURI() throws RepositoryException {
        Set uris = new HashSet(Arrays.asList(nsp.getURIs()));
        String uri = TEST_URI;
        int i = 0;
        while (uris.contains(uri)) {
            uri = TEST_URI + i++;
        }
        return uri;
    }

When i=50,
"www.apache.org/jackrabbit/test/namespaceImportTest50"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to