@Test @FixFor( "MODE-2491" ) public void shouldSupportCaseOperandsForMultiValuedProperties() throws Exception { Node metaData = session.getRootNode().addNode("metaData", "nt:unstructured"); metaData.setProperty("lowerCase", new String[]{"a", "b", "c"}); metaData.setProperty("upperCase", new String[] { "A", "B", "C" }); session.save(); try { String sql = "SELECT [jcr:path] FROM [nt:unstructured] AS node WHERE LOWER(node.upperCase) = 'a'"; Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); NodeIterator nodes = query.execute().getNodes(); assertEquals(1, nodes.getSize()); assertEquals("/metaData", nodes.nextNode().getPath()); sql = "SELECT [jcr:path] FROM [nt:unstructured] AS node WHERE LOWER(node.upperCase) = 'b'"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); nodes = query.execute().getNodes(); assertEquals(1, nodes.getSize()); assertEquals("/metaData", nodes.nextNode().getPath()); sql = "SELECT [jcr:path] FROM [nt:unstructured] AS node WHERE LOWER(node.upperCase) = 'c'"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); nodes = query.execute().getNodes(); assertEquals(1, nodes.getSize()); assertEquals("/metaData", nodes.nextNode().getPath()); sql = "SELECT [jcr:path] FROM [nt:unstructured] AS node WHERE UPPER(node.lowerCase) = 'A'"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); nodes = query.execute().getNodes(); assertEquals(1, nodes.getSize()); assertEquals("/metaData", nodes.nextNode().getPath()); sql = "SELECT [jcr:path] FROM [nt:unstructured] AS node WHERE UPPER(node.lowerCase) = 'B'"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); nodes = query.execute().getNodes(); assertEquals(1, nodes.getSize()); assertEquals("/metaData", nodes.nextNode().getPath()); sql = "SELECT [jcr:path] FROM [nt:unstructured] AS node WHERE UPPER(node.lowerCase) = 'C'"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); nodes = query.execute().getNodes(); assertEquals(1, nodes.getSize()); assertEquals("/metaData", nodes.nextNode().getPath()); } finally { metaData.remove(); session.save(); } }
@Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages(); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages();  }