jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1213839 - in /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query: AbstractOrderByTest.java AbstractQueryTest.java CreateQueryTest.java OrderByLocalNameTest.java qom/QueryObjectModelFactoryTest.java
Date Tue, 13 Dec 2011 18:33:32 GMT
Author: reschke
Date: Tue Dec 13 18:33:32 2011
New Revision: 1213839

URL: http://svn.apache.org/viewvc?rev=1213839&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/AbstractOrderByTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractQueryTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/CreateQueryTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/OrderByLocalNameTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractOrderByTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractOrderByTest.java?rev=1213839&r1=1213838&r2=1213839&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractOrderByTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractOrderByTest.java
Tue Dec 13 18:33:32 2011
@@ -192,14 +192,14 @@ class AbstractOrderByTest extends Abstra
      */
     protected void checkResultOrder(QueryResult result, String[] nodeNames)
             throws RepositoryException {
-        List nodes = new ArrayList();
+        List<Node> nodes = new ArrayList<Node>();
         for (NodeIterator it = result.getNodes(); it.hasNext();) {
             nodes.add(it.nextNode());
         }
         assertEquals("Wrong hit count:", nodeNames.length, nodes.size());
 
         for (int i = 0; i < nodeNames.length; i++) {
-            String name = ((Node) nodes.get(i)).getName();
+            String name = nodes.get(i).getName();
             assertEquals("Wrong order of nodes:", nodeNames[i], name);
         }
     }
@@ -256,7 +256,7 @@ class AbstractOrderByTest extends Abstra
      * @throws RepositoryException if an error occurs.
      */
     protected String createXPath() throws RepositoryException {
-        List languages = Arrays.asList(superuser.getWorkspace().getQueryManager().getSupportedQueryLanguages());
+        List<String> languages = Arrays.asList(superuser.getWorkspace().getQueryManager().getSupportedQueryLanguages());
         if (languages.contains(Query.XPATH)) {
             return xpathRoot + "/*[@jcr:primaryType='" + testNodeType + "'] order by @" +
propertyName1;
         } else {

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractQueryTest.java?rev=1213839&r1=1213838&r2=1213839&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/AbstractQueryTest.java
Tue Dec 13 18:33:32 2011
@@ -20,7 +20,6 @@ import org.apache.jackrabbit.test.Abstra
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.api.util.ISO9075;
 
-import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.RowIterator;
 import javax.jcr.query.Query;
@@ -328,22 +327,22 @@ public abstract class AbstractQueryTest 
     protected void checkResult(QueryResult result, Node[] nodes)
             throws RepositoryException {
         // collect paths
-        Set expectedPaths = new HashSet();
+        Set<String> expectedPaths = new HashSet<String>();
         for (int i = 0; i < nodes.length; i++) {
             expectedPaths.add(nodes[i].getPath());
         }
-        Set resultPaths = new HashSet();
+        Set<String> resultPaths = new HashSet<String>();
         for (NodeIterator it = result.getNodes(); it.hasNext();) {
             resultPaths.add(it.nextNode().getPath());
         }
         // 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));
         }
     }
@@ -354,11 +353,11 @@ public abstract class AbstractQueryTest 
      * @return the elements of the iterator as an array of Nodes.
      */
     protected Node[] toArray(NodeIterator it) {
-        List nodes = new ArrayList();
+        List<Node> nodes = new ArrayList<Node>();
         while (it.hasNext()) {
             nodes.add(it.nextNode());
         }
-        return (Node[]) nodes.toArray(new Node[nodes.size()]);
+        return nodes.toArray(new Node[nodes.size()]);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/CreateQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/CreateQueryTest.java?rev=1213839&r1=1213838&r2=1213839&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/CreateQueryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/CreateQueryTest.java
Tue Dec 13 18:33:32 2011
@@ -30,7 +30,7 @@ import javax.jcr.query.InvalidQueryExcep
 public class CreateQueryTest extends AbstractQueryTest {
 
     public void testUnknownQueryLanguage() throws RepositoryException {
-        List supported = Arrays.asList(qm.getSupportedQueryLanguages());
+        List<String> supported = Arrays.asList(qm.getSupportedQueryLanguages());
         String language;
         do {
             language = createRandomString(5);

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/OrderByLocalNameTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/OrderByLocalNameTest.java?rev=1213839&r1=1213838&r2=1213839&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/OrderByLocalNameTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/OrderByLocalNameTest.java
Tue Dec 13 18:33:32 2011
@@ -31,10 +31,10 @@ public class OrderByLocalNameTest extend
     public void testLocalName() throws RepositoryException {
         populate(new String[]{"a", "a", "a", "a"}); // dummy values
         String[] names = new String[]{nodeName1, nodeName2, nodeName3, nodeName4};
-        Arrays.sort(names, new Comparator() {
-            public int compare(Object o1, Object o2) {
-                String s1 = getLocalName((String) o1);
-                String s2 = getLocalName((String) o2);
+        Arrays.sort(names, new Comparator<String>() {
+            public int compare(String o1, String o2) {
+                String s1 = getLocalName(o1);
+                String s2 = getLocalName(o2);
                 return s1.compareTo(s2);
             }
         });

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java?rev=1213839&r1=1213838&r2=1213839&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/query/qom/QueryObjectModelFactoryTest.java
Tue Dec 13 18:33:32 2011
@@ -91,12 +91,12 @@ public class QueryObjectModelFactoryTest
     /**
      * Set of all possible operators.
      */
-    private static final Set OPERATORS = new HashSet();
+    private static final Set<String> OPERATORS = new HashSet<String>();
 
     /**
      * Set of all possible join types.
      */
-    private static final Set JOIN_TYPES = new HashSet();
+    private static final Set<String> JOIN_TYPES = new HashSet<String>();
 
     static {
         OPERATORS.add(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO);
@@ -217,8 +217,8 @@ public class QueryObjectModelFactoryTest
     public void testComparison() throws RepositoryException {
         PropertyValue op1 = qf.propertyValue(SELECTOR_NAME1, propertyName1);
         BindVariableValue op2 = qf.bindVariable(VARIABLE_NAME);
-        for (Iterator it = OPERATORS.iterator(); it.hasNext(); ) {
-            String operator = (String) it.next();
+        for (Iterator<String> it = OPERATORS.iterator(); it.hasNext(); ) {
+            String operator = it.next();
             Comparison comp = qf.comparison(op1, operator, op2);
             assertTrue("Not a PropertyValue operand", comp.getOperand1() instanceof PropertyValue);
             assertTrue("Not a BindVariableValue operand", comp.getOperand2() instanceof BindVariableValue);
@@ -437,8 +437,8 @@ public class QueryObjectModelFactoryTest
         Selector s1 = qf.selector(ntBase, SELECTOR_NAME1);
         Selector s2 = qf.selector(testNodeType, SELECTOR_NAME1);
         JoinCondition cond = qf.equiJoinCondition(ntBase, jcrPrimaryType, testNodeType, jcrPrimaryType);
-        for (Iterator it = JOIN_TYPES.iterator(); it.hasNext(); ) {
-            String joinType = (String) it.next();
+        for (Iterator<String> it = JOIN_TYPES.iterator(); it.hasNext(); ) {
+            String joinType = it.next();
             Join join = qf.join(s1, s2, joinType, cond);
             assertTrue("Not a selector source", join.getLeft() instanceof Selector);
             assertTrue("Not a selector source", join.getRight() instanceof Selector);



Mime
View raw message