jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1214251 - in /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query: ./ qom/
Date Wed, 14 Dec 2011 14:23:27 GMT
Author: reschke
Date: Wed Dec 14 14:23:26 2011
New Revision: 1214251

URL: http://svn.apache.org/viewvc?rev=1214251&view=rev
Log:
JCR-3177: Remove jdk 1.4 restriction for jcr-tests

Reduce warning noise on query tests

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetPropertyNamesTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetSupportedQueryLanguagesTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/GetQueryTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/DerefQueryLevel1Test.java
Wed Dec 14 14:23:26 2011
@@ -115,13 +115,13 @@ public class DerefQueryLevel1Test extend
             throw new NotExecutableException("Reference property does not contain a value");
         }
         String nodeName = targetNodes[0].getName();
-        List resultNodes = new ArrayList();
+        List<Node> resultNodes = new ArrayList<Node>();
         for (int i = 0; i < targetNodes.length; i++) {
             if (targetNodes[i].getName().equals(nodeName)) {
                 resultNodes.add(targetNodes[i]);
             }
         }
-        targetNodes = (Node[]) resultNodes.toArray(new Node[resultNodes.size()]);
+        targetNodes = resultNodes.toArray(new Node[resultNodes.size()]);
         String xpath = createStatement(refProp, nodeName);
         executeDerefQuery(session, xpath, targetNodes);
     }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetPropertyNamesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetPropertyNamesTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetPropertyNamesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetPropertyNamesTest.java
Wed Dec 14 14:23:26 2011
@@ -74,7 +74,7 @@ public class GetPropertyNamesTest extend
         // Get the node's non-residual properties
         PropertyDefinition[] pd = superuser.getWorkspace().getNodeTypeManager().getNodeType(ntBase).getDeclaredPropertyDefinitions();
 
-        List singleValPropNames = new ArrayList();
+        List<String> singleValPropNames = new ArrayList<String>();
         for (int i = 0; i < pd.length; i++) {
             // only keep the single-value properties
             if (!pd[i].isMultiple()) {

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetSupportedQueryLanguagesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetSupportedQueryLanguagesTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetSupportedQueryLanguagesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/GetSupportedQueryLanguagesTest.java
Wed Dec 14 14:23:26 2011
@@ -64,7 +64,7 @@ public class GetSupportedQueryLanguagesT
      * that have the SQL descriptor set in the repository return {@link Query#SQL}.
      */
     public void testGetSupportedQueryLanguages() throws RepositoryException {
-        List langs = Arrays.asList(session.getWorkspace().getQueryManager().getSupportedQueryLanguages());
+        List<String> langs = Arrays.asList(session.getWorkspace().getQueryManager().getSupportedQueryLanguages());
         // all repositories must support XPath
         assertTrue("JCR_SQL2 not retured with QueryManager.getSupportedQueryLanguages()",
                 langs.contains(Query.JCR_SQL2));

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/SQLPathTest.java
Wed Dec 14 14:23:26 2011
@@ -111,7 +111,7 @@ public class SQLPathTest extends Abstrac
         String sql = getStatement(testRoot + "/%/" + name);
         sql += " OR " + jcrPath + " = '" + testRoot + "/" + name + "'";
         // gather the nodes with visitor
-        final List nodes = new ArrayList();
+        final List<Node> nodes = new ArrayList<Node>();
         testRootNode.accept(new TraversingItemVisitor.Default() {
             protected void entering(Node node, int level) throws RepositoryException {
                 if (node.getName().equals(name) && !testRootNode.isSame(node)) {
@@ -119,7 +119,7 @@ public class SQLPathTest extends Abstrac
                 }
             }
         });
-        executeSqlQuery(session, sql, (Node[]) nodes.toArray(new Node[nodes.size()]));
+        executeSqlQuery(session, sql, nodes.toArray(new Node[nodes.size()]));
     }
 
     /**
@@ -180,7 +180,7 @@ public class SQLPathTest extends Abstrac
      * @throws RepositoryException if an error occurs.
      */
     private Node[] getDescendants(final Node node) throws RepositoryException {
-        final List descendants = new ArrayList();
+        final List<Node> descendants = new ArrayList<Node>();
 
         node.accept(new TraversingItemVisitor.Default() {
             protected void entering(Node n, int level)
@@ -191,6 +191,6 @@ public class SQLPathTest extends Abstrac
             }
         });
 
-        return (Node[]) descendants.toArray(new Node[descendants.size()]);
+        return descendants.toArray(new Node[descendants.size()]);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/AbstractQOMTest.java
Wed Dec 14 14:23:26 2011
@@ -68,7 +68,7 @@ public abstract class AbstractQOMTest ex
                                     Node[][] nodes)
             throws RepositoryException {
         // collect rows
-        List expectedPaths = new ArrayList();
+        List<String> expectedPaths = new ArrayList<String>();
         log.println("expected:");
         for (int i = 0; i < nodes.length; i++) {
             StringBuffer aggregatedPaths = new StringBuffer();
@@ -80,7 +80,7 @@ public abstract class AbstractQOMTest ex
             log.println(aggregatedPaths.toString());
         }
 
-        List resultPaths = new ArrayList();
+        List<String> resultPaths = new ArrayList<String>();
         log.println("result:");
         for (RowIterator it = result.getRows(); it.hasNext();) {
             Row r = it.nextRow();
@@ -138,7 +138,7 @@ public abstract class AbstractQOMTest ex
                                Node[][] nodes)
             throws RepositoryException {
         // collect rows
-        Set expectedPaths = new HashSet();
+        Set<String> expectedPaths = new HashSet<String>();
         log.println("expected:");
         for (int i = 0; i < nodes.length; i++) {
             StringBuffer aggregatedPaths = new StringBuffer();
@@ -150,7 +150,7 @@ public abstract class AbstractQOMTest ex
             log.println(aggregatedPaths.toString());
         }
 
-        Set resultPaths = new HashSet();
+        Set<String> resultPaths = new HashSet<String>();
         log.println("result:");
         for (RowIterator it = result.getRows(); it.hasNext();) {
             Row r = it.nextRow();
@@ -164,13 +164,13 @@ public abstract class AbstractQOMTest ex
         }
 
         // check if all expected are in result
-        for (Iterator it = expectedPaths.iterator(); it.hasNext();) {
-            String path = (String) it.next();
+        for (Iterator<String> it = expectedPaths.iterator(); it.hasNext();) {
+            String path = it.next();
             assertTrue(path + " is not part of the result set", resultPaths.contains(path));
         }
         // check result does not contain more than expected
-        for (Iterator it = resultPaths.iterator(); it.hasNext();) {
-            String path = (String) it.next();
+        for (Iterator<String> it = resultPaths.iterator(); it.hasNext();) {
+            String path = it.next();
             assertTrue(path + " is not expected to be part of the result set", expectedPaths.contains(path));
         }
     }
@@ -203,11 +203,11 @@ public abstract class AbstractQOMTest ex
      */
     protected void forQOMandSQL2(QueryObjectModel qom, Callable callable)
             throws RepositoryException {
-        List queries = new ArrayList();
+        List<Query> queries = new ArrayList<Query>();
         queries.add(qom);
         queries.add(qm.createQuery(qom.getStatement(), Query.JCR_SQL2));
-        for (Iterator it = queries.iterator(); it.hasNext();) {
-            callable.call((Query) it.next());
+        for (Iterator<Query> it = queries.iterator(); it.hasNext();) {
+            callable.call(it.next());
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ChildNodeJoinConditionTest.java
Wed Dec 14 14:23:26 2011
@@ -58,13 +58,13 @@ public class ChildNodeJoinConditionTest 
     public void testLeftOuterJoin() throws RepositoryException {
         JoinCondition c = qf.childNodeJoinCondition(LEFT, RIGHT);
         QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER,
c);
-        List result = new ArrayList();
+        List<Node[]> result = new ArrayList<Node[]>();
         result.add(new Node[]{n2, n1});
         if (testRootNode.isNodeType(testNodeType)) {
             result.add(new Node[]{n1, testRootNode});
         } else {
             result.add(new Node[]{n1, null});
         }
-        checkQOM(qom, (Node[][]) result.toArray(new Node[result.size()][]));
+        checkQOM(qom, result.toArray(new Node[result.size()][]));
     }
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/ColumnTest.java
Wed Dec 14 14:23:26 2011
@@ -65,7 +65,7 @@ public class ColumnTest extends Abstract
         forQOMandSQL2(qom, new Callable() {
             public Object call(Query query) throws RepositoryException {
                 QueryResult result = query.execute();
-                List names = new ArrayList(Arrays.asList(result.getColumnNames()));
+                List<String> names = new ArrayList<String>(Arrays.asList(result.getColumnNames()));
                 NodeTypeManager ntMgr = superuser.getWorkspace().getNodeTypeManager();
                 NodeType nt = ntMgr.getNodeType(testNodeType);
                 PropertyDefinition[] propDefs = nt.getPropertyDefinitions();
@@ -77,7 +77,7 @@ public class ColumnTest extends Abstract
                                 names.remove(columnName));
                     }
                 }
-                for (Iterator it = names.iterator(); it.hasNext(); ) {
+                for (Iterator<String> it = names.iterator(); it.hasNext(); ) {
                     fail(it.next() + " is not a property on node type " + testNodeType);
                 }
                 return null;
@@ -100,9 +100,9 @@ public class ColumnTest extends Abstract
         forQOMandSQL2(qom, new Callable() {
             public Object call(Query query) throws RepositoryException {
                 QueryResult result = query.execute();
-                List names = new ArrayList(Arrays.asList(result.getColumnNames()));
+                List<String> names = new ArrayList<String>(Arrays.asList(result.getColumnNames()));
                 assertTrue("Missing column: " + propertyName1, names.remove(propertyName1));
-                for (Iterator it = names.iterator(); it.hasNext(); ) {
+                for (Iterator<String> it = names.iterator(); it.hasNext(); ) {
                     fail(it.next() + " was not declared as a column");
                 }
                 return null;

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/DescendantNodeJoinConditionTest.java
Wed Dec 14 14:23:26 2011
@@ -58,7 +58,7 @@ public class DescendantNodeJoinCondition
     public void testLeftOuterJoin() throws RepositoryException {
         JoinCondition c = qf.descendantNodeJoinCondition(LEFT, RIGHT);
         QueryObjectModel qom = createQuery(QueryObjectModelConstants.JCR_JOIN_TYPE_LEFT_OUTER,
c);
-        List result = new ArrayList();
+        List<Node[]> result = new ArrayList<Node[]>();
         result.add(new Node[]{n2, n1});
         // for each ancestor-or-self of testRootNode check
         // whether it is of type testNodeType and add
@@ -79,6 +79,6 @@ public class DescendantNodeJoinCondition
             // n1 not yet covered
             result.add(new Node[]{n1, null});
         }
-        checkQOM(qom, (Node[][]) result.toArray(new Node[result.size()][]));
+        checkQOM(qom, result.toArray(new Node[result.size()][]));
     }
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/GetQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/GetQueryTest.java?rev=1214251&r1=1214250&r2=1214251&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/GetQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/GetQueryTest.java
Wed Dec 14 14:23:26 2011
@@ -40,7 +40,7 @@ public class GetQueryTest extends Abstra
         checkNtQuery();
         Node n = testRootNode.addNode(nodeName1, testNodeType);
         superuser.save();
-        List queries = new ArrayList();
+        List<Query> queries = new ArrayList<Query>();
         QueryObjectModel qom = qf.createQuery(
                 qf.selector(testNodeType, "s"),
                 qf.childNode("s", testRoot),
@@ -57,8 +57,8 @@ public class GetQueryTest extends Abstra
             String sql = "select * from " + testNodeType + " where jcr:path like '" + testRoot
+ "/%'";
             queries.add(qm.createQuery(sql, Query.SQL));
         }
-        for (Iterator it = queries.iterator(); it.hasNext(); ) {
-            Query q = (Query) it.next();
+        for (Iterator<Query> it = queries.iterator(); it.hasNext(); ) {
+            Query q = it.next();
             String lang = q.getLanguage();
             checkResult(q.execute(), new Node[]{n});
 



Mime
View raw message