Skip to content

Commit

Permalink
DNA-613 minor changes to get the FileSystemRepositoryTckTest to run w…
Browse files Browse the repository at this point in the history
…ith the newly-added XPath TCK tests.

git-svn-id: https://svn.jboss.org/repos/modeshape/trunk@1558 76366958-4244-0410-ad5e-bbfabb93f86b
  • Loading branch information
Randall Hauch committed Jan 8, 2010
1 parent edc952f commit 009cf6e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,17 @@ public DateTime create( String value ) {
try {
return new JodaDateTime(value.trim());
} catch (IllegalArgumentException err) {
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
DateTime.class.getSimpleName(),
value), err);
// See if this string represents a LONG value ...
try {
Long longValue = Long.parseLong(value);
return new JodaDateTime(longValue);
} catch (NumberFormatException e) {
// Guess it wasn't a long value ...
throw new ValueFormatException(value, getPropertyType(),
GraphI18n.errorConvertingType.text(String.class.getSimpleName(),
DateTime.class.getSimpleName(),
value), err);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test content
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Placeholder for any overlaid properties for this repo configuration

javax.jcr.tck.dnaSkipImport=true
query.xpath.pos.index=false


javax.jcr.tck.nodetype=nt\:folder
Expand Down
26 changes: 16 additions & 10 deletions dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ public static final class QueryLanguage {
* @throws IllegalArgumentException If <code>executionContext</code>, <code>connectionFactory</code>,
* <code>repositorySourceName</code>, or <code>repositoryObservable</code> is <code>null</code>.
*/
public JcrRepository( ExecutionContext executionContext,
RepositoryConnectionFactory connectionFactory,
String repositorySourceName,
Observable repositoryObservable,
RepositorySourceCapabilities repositorySourceCapabilities,
Map<String, String> descriptors,
Map<Option, String> options ) throws RepositoryException {
JcrRepository( ExecutionContext executionContext,
RepositoryConnectionFactory connectionFactory,
String repositorySourceName,
Observable repositoryObservable,
RepositorySourceCapabilities repositorySourceCapabilities,
Map<String, String> descriptors,
Map<Option, String> options ) throws RepositoryException {
CheckArg.isNotNull(executionContext, "executionContext");
CheckArg.isNotNull(connectionFactory, "connectionFactory");
CheckArg.isNotNull(repositorySourceName, "repositorySourceName");
Expand All @@ -415,11 +415,17 @@ public JcrRepository( ExecutionContext executionContext,
modifiableDescriptors.put(Repository.LEVEL_2_SUPPORTED, "true");
modifiableDescriptors.put(Repository.OPTION_LOCKING_SUPPORTED, "true");
modifiableDescriptors.put(Repository.OPTION_OBSERVATION_SUPPORTED, "true");
modifiableDescriptors.put(Repository.OPTION_QUERY_SQL_SUPPORTED, "false");
modifiableDescriptors.put(Repository.OPTION_QUERY_SQL_SUPPORTED, "false"); // not JCR 1.0 SQL
modifiableDescriptors.put(Repository.OPTION_TRANSACTIONS_SUPPORTED, "false");
modifiableDescriptors.put(Repository.OPTION_VERSIONING_SUPPORTED, "false");
modifiableDescriptors.put(Repository.QUERY_XPATH_DOC_ORDER, "true");
modifiableDescriptors.put(Repository.QUERY_XPATH_POS_INDEX, "true");
if (!modifiableDescriptors.containsKey(Repository.QUERY_XPATH_DOC_ORDER)) {
// don't override what was supplied ...
modifiableDescriptors.put(Repository.QUERY_XPATH_DOC_ORDER, "true");
}
if (!modifiableDescriptors.containsKey(Repository.QUERY_XPATH_POS_INDEX)) {
// don't override what was supplied ...
modifiableDescriptors.put(Repository.QUERY_XPATH_POS_INDEX, "true");
}
// Vendor-specific descriptors (REP_XXX) will only be initialized if not already present, allowing for customer branding.
if (!modifiableDescriptors.containsKey(Repository.REP_NAME_DESC)) {
modifiableDescriptors.put(Repository.REP_NAME_DESC, JcrI18n.REP_NAME_DESC.text());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,13 @@ public void shouldBeAbleToExecuteXPathQueryToFindAllUnstructuredNodesOrderedByPr
Query query = manager.createQuery("//element(*,nt:unstructured) order by @jcr:primaryType", Query.XPATH);
assertThat(query, is(notNullValue()));
QueryResult result = query.execute();
print = true;
assertResults(query, result, 21);
assertThat(result, is(notNullValue()));
assertResultsHaveColumns(result, "jcr:primaryType", "jcr:path", "jcr:score");

query = manager.createQuery("//element(*,car:Car) order by @car:year", Query.XPATH);
assertThat(query, is(notNullValue()));
result = query.execute();
print = true;
assertResults(query, result, 12);
assertThat(result, is(notNullValue()));
assertResultsHaveColumns(result, "car:year", "jcr:path", "jcr:score");
Expand All @@ -312,7 +310,6 @@ public void shouldBeAbleToExecuteXPathQueryToFindNodesUnderNode() throws Reposit
Query query = session.getWorkspace().getQueryManager().createQuery(" /jcr:root/Cars/Hybrid/*", Query.XPATH);
assertThat(query, is(notNullValue()));
QueryResult result = query.execute();
print = true;
assertResults(query, result, 3);
assertThat(result, is(notNullValue()));
assertResultsHaveColumns(result, "jcr:primaryType", "jcr:path", "jcr:score");
Expand Down Expand Up @@ -389,7 +386,6 @@ public void shouldBeAbleToExecuteXPathQueryToFindSameNameSiblingsByIndex() throw
Query query = session.getWorkspace().getQueryManager().createQuery("/jcr:root/Other/NodeA", Query.XPATH);
assertThat(query, is(notNullValue()));
QueryResult result = query.execute();
print = true;
assertResults(query, result, 1);
assertThat(result, is(notNullValue()));
assertThat(result.getNodes().nextNode().getIndex(), is(1));
Expand All @@ -398,7 +394,6 @@ public void shouldBeAbleToExecuteXPathQueryToFindSameNameSiblingsByIndex() throw
query = session.getWorkspace().getQueryManager().createQuery("/jcr:root/Other/NodeA[2]", Query.XPATH);
assertThat(query, is(notNullValue()));
result = query.execute();
print = true;
assertResults(query, result, 1);
assertThat(result, is(notNullValue()));
assertThat(result.getNodes().nextNode().getIndex(), is(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ protected void setOrReplaceProperties( Location location,
if (fullTextSearchValue != null && fullTextSearchValue.length() != 0) {
doc.add(new Field(ContentIndex.FULL_TEXT, fullTextSearchValue.toString(), Field.Store.NO, Field.Index.ANALYZED));
}
// System.out.println("Replaced " + doc);
getContentWriter().updateDocument(new Term(ContentIndex.PATH, pathStr), doc);
}

Expand Down

0 comments on commit 009cf6e

Please sign in to comment.