jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1214308 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/
Date Wed, 14 Dec 2011 15:55:02 GMT
Author: reschke
Date: Wed Dec 14 15:55:01 2011
New Revision: 1214308

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

Reduce warning noise

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryReadMethodsTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeMixinUtil.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeReadMethodsTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/RepositoryDescriptorTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueStringTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ValueFactoryTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
Wed Dec 14 15:55:01 2011
@@ -466,7 +466,7 @@ abstract class AbstractImportXmlTest ext
      * @return an unused namespace prefix.
      */
     protected String getUnusedPrefix() throws RepositoryException {
-        Set prefixes = new HashSet(Arrays.asList(nsp.getPrefixes()));
+        Set<String> prefixes = new HashSet<String>(Arrays.asList(nsp.getPrefixes()));
         String prefix = TEST_PREFIX;
         int i = 0;
         while (prefixes.contains(prefix)) {
@@ -482,7 +482,7 @@ abstract class AbstractImportXmlTest ext
      * @return an unused namespace URI.
      */
     protected String getUnusedURI() throws RepositoryException {
-        Set uris = new HashSet(Arrays.asList(nsp.getURIs()));
+        Set<String> uris = new HashSet<String>(Arrays.asList(nsp.getURIs()));
         String uri = TEST_URI;
         int i = 0;
         while (uris.contains(uri)) {

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ExportDocViewTest.java
Wed Dec 14 15:55:01 2011
@@ -45,6 +45,8 @@ import javax.jcr.Property;
 import javax.jcr.PropertyType;
 import javax.jcr.PropertyIterator;
 import javax.jcr.Value;
+
+import java.util.List;
 import java.util.Stack;
 import java.util.ArrayList;
 import java.util.Properties;
@@ -88,11 +90,11 @@ public class ExportDocViewTest extends A
     /**
      * the stack of the text node values to check
      */
-    private Stack textValuesStack;
+    private Stack<StackEntry> textValuesStack;
 
     private class StackEntry {
         // the list of text node values of the text nodes of an xml element
-        ArrayList textValues;
+        List<String> textValues;
         // the current position in the ArrayList
         int position = 0;
     }
@@ -236,7 +238,7 @@ public class ExportDocViewTest extends A
      */
     private void compareTree() throws RepositoryException, IOException {
         Element root = doc.getDocumentElement();
-        textValuesStack = new Stack();
+        textValuesStack = new Stack<StackEntry>();
         // we assume the path is valid
         Item item = session.getItem(testPath);
 
@@ -315,7 +317,7 @@ public class ExportDocViewTest extends A
             textValuesStack.push(entry);
             // xmltext nodes directly following each other
             // are serialized together as xml text
-            ArrayList jcrTextNodes = new ArrayList();
+            List<Node> jcrTextNodes = new ArrayList<Node>();
 
             while (nodeIter.hasNext()) {
                 Node childNode = nodeIter.nextNode();
@@ -383,7 +385,7 @@ public class ExportDocViewTest extends A
 
         name = !isValidName ? escapeNames(name) : name;
         // same name sibs
-        ArrayList children = getChildElems(parentElem, name);
+        List<Element> children = getChildElems(parentElem, name);
 
         if (children.size() > 0) {
             // xmltext nodes are not exported as elements
@@ -394,7 +396,7 @@ public class ExportDocViewTest extends A
                 // order of same name siblings is preserved during export
                 int index = node.getIndex();
                 try {
-                    nodeElem = (Element) children.get(index - 1);
+                    nodeElem = children.get(index - 1);
                 } catch (IndexOutOfBoundsException iobe) {
                     fail("Node " + node.getPath() + " is not exported."
                             + iobe.toString());
@@ -685,7 +687,7 @@ public class ExportDocViewTest extends A
      * @param parentElem
      * @throws RepositoryException
      */
-    private void compareXmltextNodes(ArrayList nodes, Element parentElem)
+    private void compareXmltextNodes(List<Node> nodes, Element parentElem)
             throws RepositoryException {
         // only this case
         if (withHandler) {
@@ -703,7 +705,7 @@ public class ExportDocViewTest extends A
 
             int size = nodes.size();
             if (size == 1) {
-                Node node = (Node) nodes.get(0);
+                Node node = nodes.get(0);
                 Property prop = node.getProperty(JCR_XMLDATA);
                 value = prop.getString();
                 assertEquals("The " + JCR_XMLTEXT + " node " + node.getPath() +
@@ -712,7 +714,7 @@ public class ExportDocViewTest extends A
             } else {
                 // check the concatenated values sequenceally
                 for (int i = 0; i < nodes.size(); i++) {
-                    Node node = (Node) nodes.get(i);
+                    Node node = nodes.get(i);
                     Property prop = node.getProperty(JCR_XMLDATA);
                     value = prop.getString();
                     // the first one
@@ -1027,13 +1029,13 @@ public class ExportDocViewTest extends A
      * @param name
      * @return
      */
-    private ArrayList getChildElems(Element elem, String name) {
-        ArrayList children = new ArrayList();
+    private List<Element> getChildElems(Element elem, String name) {
+        List<Element> children = new ArrayList<Element>();
         org.w3c.dom.Node child = elem.getFirstChild();
         while (child != null) {
             if (child.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
                 if (name.equals("*") || name.equals(child.getNodeName())) {
-                    children.add(child);
+                    children.add((Element)child);
                 }
             }
             child = child.getNextSibling();
@@ -1066,8 +1068,8 @@ public class ExportDocViewTest extends A
      * @param elem
      * @return
      */
-    private ArrayList getChildTextNodeValues(Element elem) {
-        ArrayList textValues = new ArrayList();
+    private List<String> getChildTextNodeValues(Element elem) {
+        List<String> textValues = new ArrayList<String>();
         StringBuffer buf = new StringBuffer();
         org.w3c.dom.Node child = elem.getFirstChild();
         // collect the characters of successive text nodes

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryReadMethodsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryReadMethodsTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryReadMethodsTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryReadMethodsTest.java
Wed Dec 14 15:55:01 2011
@@ -77,7 +77,7 @@ public class NamespaceRegistryReadMethod
      * required namespace prefixes and if they are mapped to the correct URIs.
      */
     public void testGetNamespacePrefixes() throws RepositoryException {
-        Set prefixes = new HashSet();
+        Set<String> prefixes = new HashSet<String>();
         prefixes.addAll(Arrays.asList(nsr.getPrefixes()));
         for (int i = 0; i < BUILTIN_PREFIXES.length; i++) {
             String prefix = BUILTIN_PREFIXES[i];
@@ -92,7 +92,7 @@ public class NamespaceRegistryReadMethod
      * required namespace URIs and if they are mapped to the correct prefixes.
      */
     public void testGetNamespaceURIs() throws RepositoryException {
-        Set uris = new HashSet();
+        Set<String> uris = new HashSet<String>();
         uris.addAll(Arrays.asList(nsr.getURIs()));
         for (int i = 0; i < BUILTIN_URIS.length; i++) {
             String uri = BUILTIN_URIS[i];
@@ -108,7 +108,7 @@ public class NamespaceRegistryReadMethod
      * unknown prefix.
      */
     public void testGetURINamespaceException() throws RepositoryException, NotExecutableException
{
-        Set prefixes = new HashSet();
+        Set<String> prefixes = new HashSet<String>();
         prefixes.addAll(Arrays.asList(nsr.getPrefixes()));
         String prefix = "myapp";
         int count = 0;
@@ -131,7 +131,7 @@ public class NamespaceRegistryReadMethod
      * unknown URI.
      */
     public void testGetPrefixNamespaceException() throws RepositoryException, NotExecutableException
{
-        Set uris = new HashSet();
+        Set<String> uris = new HashSet<String>();
         uris.addAll(Arrays.asList(nsr.getURIs()));
         String uri = "http://www.unknown-company.com/namespace";
         int count = 0;

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRegistryTest.java
Wed Dec 14 15:55:01 2011
@@ -190,7 +190,7 @@ public class NamespaceRegistryTest exten
      * @return an unused namespace prefix.
      */
     private String getUnusedPrefix() throws RepositoryException {
-        Set prefixes = new HashSet(Arrays.asList(nsp.getPrefixes()));
+        Set<String> prefixes = new HashSet<String>(Arrays.asList(nsp.getPrefixes()));
         String prefix = TEST_PREFIX;
         int i = 0;
         while (prefixes.contains(prefix)) {
@@ -205,7 +205,7 @@ public class NamespaceRegistryTest exten
      * @return an unused namespace URI.
      */
     private String getUnusedURI() throws RepositoryException {
-        Set uris = new HashSet(Arrays.asList(nsp.getURIs()));
+        Set<String> uris = new HashSet<String>(Arrays.asList(nsp.getURIs()));
         String uri = TEST_URI;
         int i = 0;
         while (uris.contains(uri)) {

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
Wed Dec 14 15:55:01 2011
@@ -115,8 +115,8 @@ public class NamespaceRemappingTest exte
      * </blockquote>
      */
     public void testAutomaticNewLocalPrefix() throws RepositoryException {
-        Set prefixes =
-            new HashSet(Arrays.asList(session.getNamespacePrefixes()));
+        Set<String> prefixes =
+            new HashSet<String>(Arrays.asList(session.getNamespacePrefixes()));
         prefixes.remove(session.getNamespacePrefix(NS_JCR_URI));
         prefixes.remove(session.getNamespacePrefix(NS_NT_URI));
 
@@ -242,7 +242,7 @@ public class NamespaceRemappingTest exte
      * <blockquote>
      * However, the method will throw an exception if
      * <ul>
-     * <li>the specified prefix begins with the characters “xml”
+     * <li>the specified prefix begins with the characters "xml"
      *     (in any combination of case) or,</li>
      * <li>the specified prefix is the empty string or,</li>
      * <li>the specified namespace URI is the empty string.</li>
@@ -374,7 +374,7 @@ public class NamespaceRemappingTest exte
      * @return a namespace prefix that is not in use.
      */
     private String getUnusedPrefix() throws RepositoryException {
-        Set prefixes = new HashSet();
+        Set<String> prefixes = new HashSet<String>();
         prefixes.addAll(Arrays.asList(session.getNamespacePrefixes()));
         String prefix = "myapp";
         int count = 0;

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeMixinUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeMixinUtil.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeMixinUtil.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeMixinUtil.java
Wed Dec 14 15:55:01 2011
@@ -58,7 +58,7 @@ public class NodeMixinUtil {
     public static String getNotAssignedMixinName(Session session, Node node) throws RepositoryException
{
         NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
         NodeTypeIterator mixins = manager.getMixinNodeTypes();
-        List existingMixins = Arrays.asList(node.getMixinNodeTypes());
+        List<NodeType> existingMixins = Arrays.asList(node.getMixinNodeTypes());
 
         while (mixins.hasNext()) {
             NodeType nt = mixins.nextNodeType();

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeReadMethodsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeReadMethodsTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeReadMethodsTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NodeReadMethodsTest.java
Wed Dec 14 15:55:01 2011
@@ -323,7 +323,7 @@ public class NodeReadMethodsTest extends
                     "Root node must have at least one child node.");
         }
         NodeIterator allNodesIt = node.getNodes();
-        ArrayList allNodes = new ArrayList();
+        List<Node> allNodes = new ArrayList<Node>();
         while (allNodesIt.hasNext()) {
             Node n = allNodesIt.nextNode();
             allNodes.add(n);
@@ -342,7 +342,7 @@ public class NodeReadMethodsTest extends
         }
 
         // all further tests are using root's first sub node
-        Node firstNode = (Node) allNodes.get(0);
+        Node firstNode = allNodes.get(0);
 
         // test pattern "*"
         String pattern1 = "*";
@@ -367,7 +367,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found nodes is correct
         int numExpected2 = 0;
         for (int i = 0; i < allNodes.size(); i++) {
-            Node n = (Node) allNodes.get(i);
+            Node n = allNodes.get(i);
             if (n.getName().equals(firstNode.getName())) {
                 numExpected2++;
             }
@@ -392,7 +392,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found nodes is correct
         int numExpected3 = 0;
         for (int i = 0; i < allNodes.size(); i++) {
-            Node n = (Node) allNodes.get(i);
+            Node n = allNodes.get(i);
             if (n.getName().equals(firstNode.getName())) {
                 numExpected3++;
             }
@@ -420,7 +420,7 @@ public class NodeReadMethodsTest extends
             // test if the number of found nodes is correct
             int numExpected4 = 0;
             for (int i = 0; i < allNodes.size(); i++) {
-                Node n = (Node) allNodes.get(i);
+                Node n = allNodes.get(i);
                 if (n.getName().indexOf(shortenName) != -1) {
                     numExpected4++;
                 }
@@ -448,7 +448,7 @@ public class NodeReadMethodsTest extends
                     "Root node must have at least one child node.");
         }
         NodeIterator allNodesIt = node.getNodes();
-        ArrayList allNodes = new ArrayList();
+        List<Node> allNodes = new ArrayList<Node>();
         while (allNodesIt.hasNext()) {
             Node n = allNodesIt.nextNode();
             allNodes.add(n);
@@ -467,7 +467,7 @@ public class NodeReadMethodsTest extends
         }
 
         // all further tests are using root's first sub node
-        Node firstNode = (Node) allNodes.get(0);
+        Node firstNode = allNodes.get(0);
 
         // test pattern "*"
         String pattern1 = "*";
@@ -492,7 +492,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found nodes is correct
         int numExpected2 = 0;
         for (int i = 0; i < allNodes.size(); i++) {
-            Node n = (Node) allNodes.get(i);
+            Node n = allNodes.get(i);
             if (n.getName().equals(firstNode.getName())) {
                 numExpected2++;
             }
@@ -515,7 +515,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found nodes is correct
         int numExpected4 = 0;
         for (int i = 0; i < allNodes.size(); i++) {
-            Node n = (Node) allNodes.get(i);
+            Node n = allNodes.get(i);
             if (n.getName().equals(firstNode.getName())) {
                 numExpected4++;
             }
@@ -542,7 +542,7 @@ public class NodeReadMethodsTest extends
             // test if the number of found nodes is correct
             int numExpected5 = 0;
             for (int i = 0; i < allNodes.size(); i++) {
-                Node n = (Node) allNodes.get(i);
+                Node n = allNodes.get(i);
                 if (n.getName().indexOf(shortenName) != -1) {
                     numExpected5++;
                 }
@@ -610,7 +610,7 @@ public class NodeReadMethodsTest extends
             fail("Root node must always have at least one property: jcr:primaryType");
         }
         PropertyIterator allPropertiesIt = node.getProperties();
-        ArrayList allProperties = new ArrayList();
+        List<Property> allProperties = new ArrayList<Property>();
         StringBuffer notExistingPropertyName = new StringBuffer();
         while (allPropertiesIt.hasNext()) {
             Property p = allPropertiesIt.nextProperty();
@@ -632,7 +632,7 @@ public class NodeReadMethodsTest extends
         }
 
         // all tests are running using root's first property
-        Property firstProperty = (Property) allProperties.get(0);
+        Property firstProperty = allProperties.get(0);
 
         // test: getProperties("*")
         String pattern1 = "*";
@@ -656,7 +656,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found properties is correct
         int numExpected2 = 0;
         for (int i = 0; i < allProperties.size(); i++) {
-            Property p = (Property) allProperties.get(i);
+            Property p = allProperties.get(i);
             if (p.getName().equals(firstProperty.getName())) {
                 numExpected2++;
             }
@@ -681,7 +681,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found properties is correct
         int numExpected3 = 0;
         for (int i = 0; i < allProperties.size(); i++) {
-            Property p = (Property) allProperties.get(i);
+            Property p = allProperties.get(i);
             if (p.getName().equals(firstProperty.getName())) {
                 numExpected3++;
             }
@@ -709,7 +709,7 @@ public class NodeReadMethodsTest extends
             // test if the number of found properties is correct
             int numExpected4 = 0;
             for (int i = 0; i < allProperties.size(); i++) {
-                Property p = (Property) allProperties.get(i);
+                Property p = allProperties.get(i);
                 if (p.getName().indexOf(shortenName) != -1) {
                     numExpected4++;
                 }
@@ -734,7 +734,7 @@ public class NodeReadMethodsTest extends
             fail("Root node must always have at least one property: jcr:primaryType");
         }
         PropertyIterator allPropertiesIt = node.getProperties();
-        List allProperties = new ArrayList();
+        List<Property> allProperties = new ArrayList<Property>();
         StringBuffer notExistingPropertyName = new StringBuffer();
         while (allPropertiesIt.hasNext()) {
             Property p = allPropertiesIt.nextProperty();
@@ -743,7 +743,7 @@ public class NodeReadMethodsTest extends
         }
 
         // all tests are running using root's first property
-        Property firstProperty = (Property) allProperties.get(0);
+        Property firstProperty = allProperties.get(0);
 
         // test: getProperties("*")
         String pattern1 = "*";
@@ -767,7 +767,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found properties is correct
         int numExpected2 = 0;
         for (int i = 0; i < allProperties.size(); i++) {
-            Property p = (Property) allProperties.get(i);
+            Property p = allProperties.get(i);
             if (p.getName().equals(firstProperty.getName())) {
                 numExpected2++;
             }
@@ -791,7 +791,7 @@ public class NodeReadMethodsTest extends
         // test if the number of found properties is correct
         int numExpected4 = 0;
         for (int i = 0; i < allProperties.size(); i++) {
-            Property p = (Property) allProperties.get(i);
+            Property p = allProperties.get(i);
             if (p.getName().equals(firstProperty.getName())) {
                 numExpected4++;
             }
@@ -817,7 +817,7 @@ public class NodeReadMethodsTest extends
             // test if the number of found properties is correct
             int numExpected5 = 0;
             for (int i = 0; i < allProperties.size(); i++) {
-                Property p = (Property) allProperties.get(i);
+                Property p = allProperties.get(i);
                 if (p.getName().indexOf(shortenName) != -1) {
                     numExpected5++;
                 }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ReferencesTest.java
Wed Dec 14 15:55:01 2011
@@ -148,7 +148,7 @@ public class ReferencesTest extends Abst
         // get references with name propertyName1
         // (should return p1 and p3))
         PropertyIterator iter = n1.getReferences(propertyName1);
-        Set results = new HashSet();
+        Set<String> results = new HashSet<String>();
         while (iter.hasNext()) {
             results.add(iter.nextProperty().getPath());
         }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/RepositoryDescriptorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/RepositoryDescriptorTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/RepositoryDescriptorTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/RepositoryDescriptorTest.java
Wed Dec 14 15:55:01 2011
@@ -39,7 +39,7 @@ import java.util.Arrays;
  */
 public class RepositoryDescriptorTest extends AbstractJCRTest {
 
-    private static final Set requiredDescriptorKeys = new HashSet();
+    private static final Set<String> requiredDescriptorKeys = new HashSet<String>();
 
     static {
         requiredDescriptorKeys.add(Repository.IDENTIFIER_STABILITY);
@@ -121,8 +121,8 @@ public class RepositoryDescriptorTest ex
      */
     public void testRequiredDescriptors() {
         Repository rep = session.getRepository();
-        for (Iterator it = requiredDescriptorKeys.iterator(); it.hasNext();) {
-            String descName = (String) it.next();
+        for (Iterator<String> it = requiredDescriptorKeys.iterator(); it.hasNext();)
{
+            String descName = it.next();
             assertTrue(descName + " is a standard descriptor", rep.isStandardDescriptor(descName));
             if (rep.isSingleValueDescriptor(descName)) {
                 Value val = rep.getDescriptorValue(descName);
@@ -141,9 +141,9 @@ public class RepositoryDescriptorTest ex
      * descriptors keys.
      */
     public void testGetDescriptorKeys() {
-        List keys = Arrays.asList(session.getRepository().getDescriptorKeys());
-        for (Iterator it = requiredDescriptorKeys.iterator(); it.hasNext();) {
-            String key = (String) it.next();
+        List<String> keys = Arrays.asList(session.getRepository().getDescriptorKeys());
+        for (Iterator<String> it = requiredDescriptorKeys.iterator(); it.hasNext();)
{
+            String key = it.next();
             assertTrue("Required descriptor is missing: " + key,
                     keys.contains(key));
         }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueStringTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueStringTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueStringTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueStringTest.java
Wed Dec 14 15:55:01 2011
@@ -321,7 +321,7 @@ public class SetValueStringTest extends 
         property2.setValue(mv);
         superuser.save();
         Value[] values = property2.getValues();
-        List strValues = new ArrayList();
+        List<String> strValues = new ArrayList<String>();
         for (int i = 0; i < values.length; i++) {
             strValues.add(values[i].getString());
         }
@@ -338,7 +338,7 @@ public class SetValueStringTest extends 
         property2.setValue(mv);
         node.save();
         Value[] values = property2.getValues();
-        List strValues = new ArrayList();
+        List<String> strValues = new ArrayList<String>();
         for (int i = 0; i < values.length; i++) {
             strValues.add(values[i].getString());
         }

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ShareableNodeTest.java
Wed Dec 14 15:55:01 2011
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
+import java.util.List;
 
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Item;
@@ -1128,14 +1129,14 @@ public class ShareableNodeTest extends A
         String sql = "SELECT * FROM nt:unstructured WHERE jcr:uuid = '"+c.getUUID()+"'";
         QueryResult res = workspace.getQueryManager().createQuery(sql, Query.SQL).execute();
 
-        ArrayList list = new ArrayList();
+        List<Node> list = new ArrayList<Node>();
 
         NodeIterator iter = res.getNodes();
         while (iter.hasNext()) {
             list.add(iter.nextNode());
         }
         assertEquals(1, list.size());
-        assertTrue(((Node) list.get(0)).isSame(c));
+        assertTrue(list.get(0).isSame(c));
     }
 
     //--------------------------------------------------------- limitation tests

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SysViewContentHandler.java
Wed Dec 14 15:55:01 2011
@@ -38,6 +38,7 @@ import java.io.IOException;
 import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Stack;
 import java.util.Hashtable;
 import java.util.Enumeration;
@@ -67,14 +68,12 @@ class SysViewContentHandler extends Defa
     PropElemData currentPropElem;
     // the valueElem in process
     protected StringBuffer currentValue;
-    // the value(s) of the current propElem e.g if multiple values
-    protected ArrayList currentValues;
     // prefix mapping data
-    protected HashMap prefixes;
+    protected Map<String, String> prefixes;
     // if the first node is yet treated
     protected boolean testRootDone;
     // The stack holding the opened nodeElems
-    Stack nodeElemStack;
+    Stack<NodeElemData> nodeElemStack;
 
     // resolved QNames for well known node and property names
     private String jcrRoot;
@@ -124,12 +123,12 @@ class SysViewContentHandler extends Defa
             // Check the given path, init the treeState stack
             Item item = session.getItem(path);
             checkCondition("TestPath "+path+" is not a path to a node.", item.isNode());
-            nodeElemStack = new Stack();
+            nodeElemStack = new Stack<NodeElemData>();
             currentNodeElem = new NodeElemData();
             currentNodeElem.name = item.getName();
             currentNodeElem.node = (Node) item;
             currentNodeElem.path = path;
-            prefixes = new HashMap();
+            prefixes = new HashMap<String, String>();
             testRootDone = false;
         } catch (PathNotFoundException pe) {
             checkCondition("TestPath " + path + " is not a valid path."
@@ -248,7 +247,7 @@ class SysViewContentHandler extends Defa
                 currentPropElem.name = attributes.getValue(svName);
                 currentPropElem.typeName = attributes.getValue(svType);
                 currentPropElem.type = PropertyType.valueFromName(currentPropElem.typeName);
-                currentPropElem.values = new ArrayList();
+                currentPropElem.values = new ArrayList<String>();
             }
 
             else if (qName.equals(svValue)) {
@@ -338,20 +337,20 @@ class SysViewContentHandler extends Defa
     public void endDocument() throws SAXException {
         // check exported namespaces
         try {
-            Map sessionNamespaces = new HashMap();
+            Map<String, String> sessionNamespaces = new HashMap<String, String>();
             String[] sessionPrefixes = session.getNamespacePrefixes();
             for (int i = 0; i < sessionPrefixes.length; i++) {
                 sessionNamespaces.put(sessionPrefixes[i], session.getNamespaceURI(sessionPrefixes[i]));
             }
 
             // check prefixes against namespace mapping in session
-            for (Iterator it = prefixes.keySet().iterator(); it.hasNext(); ) {
-                String prefix = (String) it.next();
+            for (Iterator<String> it = prefixes.keySet().iterator(); it.hasNext();
) {
+                String prefix = it.next();
                 if ("xml".equals(prefix)) {
                     Assert.fail("Prefix mapping for 'xml' must not be exported.");
                 }
 
-                String uri = (String) prefixes.get(prefix);
+                String uri = prefixes.get(prefix);
                 checkCondition("Exported uri " + uri + " is not a registered namespace.",
                         sessionNamespaces.containsValue(uri));
                 checkCondition("Exported prefix " + prefix + " does not match " +
@@ -387,13 +386,13 @@ class SysViewContentHandler extends Defa
         boolean jcrPrimaryTypeFound = false;
         boolean jcrMixinTypesFound = true;
         boolean uuidFound = true;
-        PropElemData propElem = (PropElemData) nodeElem.propElems.get(0);
+        PropElemData propElem = nodeElem.propElems.get(0);
         jcrPrimaryTypeFound = (jcrPrimaryType.equals(propElem.name));
         checkCondition("Exported property jcr:primaryType of node " + nodeElem.path +
                 " is not at the first position.", jcrPrimaryTypeFound);
 
         if (nodeElem.node.hasProperty(jcrMixinTypes)) {
-            PropElemData propElem2 = (PropElemData) nodeElem.propElems.get(1);
+            PropElemData propElem2 = nodeElem.propElems.get(1);
             jcrMixinTypesFound = (jcrMixinTypes.equals(propElem2.name));
             checkCondition("Exported property jcr:jcrMixinTypes of node " + nodeElem.path
+
                 " is not at the second position.", jcrMixinTypesFound);
@@ -401,7 +400,7 @@ class SysViewContentHandler extends Defa
             NodeType[] mixins = nodeElem.node.getMixinNodeTypes();
             for (int j=0; j<mixins.length; j++) {
                 if (mixins[j].getName().equals(mixReferenceable)) {
-                uuidFound = (jcrUuid.equals(((PropElemData)nodeElem.propElems.get(2)).name));
+                uuidFound = (jcrUuid.equals(nodeElem.propElems.get(2).name));
                 checkCondition("Exported property jcr:uuid of node " + nodeElem.path +
                         " is not at the third position.", uuidFound);
                 }
@@ -425,7 +424,7 @@ class SysViewContentHandler extends Defa
         boolean allFound = false;
         boolean correctVal = false;
         Node node = nodeElem.node;
-        ArrayList propElems = nodeElem.propElems;
+        List<PropElemData> propElems = nodeElem.propElems;
 
         // no props exported
         if (propElems.size() == 0) {
@@ -452,7 +451,7 @@ class SysViewContentHandler extends Defa
             // compare the propElems with the properties of the given node
             for (int i = 0; i < propElems.size(); i++) {
                 correctVal = false;
-                PropElemData propElem = (PropElemData) propElems.get(i);
+                PropElemData propElem = propElems.get(i);
                 int propType = propElem.type;
                 if (node.hasProperty(propElem.name)) {
                     Property prop = node.getProperty(propElem.name);
@@ -490,7 +489,7 @@ class SysViewContentHandler extends Defa
                                 else {
                                     str = prop.getString();
                                 }
-                                String val = (String) propElem.values.get(0);
+                                String val = propElem.values.get(0);
 
                                if (prop.getType() == PropertyType.BINARY) {
                                     // decode value
@@ -511,7 +510,7 @@ class SysViewContentHandler extends Defa
                                 for (int j = 0; j < size; j++) {
                                     // we know that the order of the values
                                     // of a mulitval prop is preserved during export
-                                    String val = (String)propElem.values.get(j);
+                                    String val = propElem.values.get(j);
 
                                     if (prop.getType() == PropertyType.BINARY) {
                                         // decode value
@@ -563,7 +562,7 @@ class SysViewContentHandler extends Defa
     private void checkChildren(NodeElemData nodeElem, boolean noRecurse)
             throws RepositoryException, SAXException {
 
-        Hashtable childElemsFound = nodeElem.childNodeElemNames;
+        Hashtable<String, ChildNodeElem> childElemsFound = nodeElem.childNodeElemNames;
         boolean totalSumOk = false;
         boolean partialSumOk = true;
         if (noRecurse) {
@@ -577,8 +576,8 @@ class SysViewContentHandler extends Defa
             NodeIterator nodeIter = nodeElem.node.getNodes();
 
             long children = getSize(nodeIter);
-            for (Enumeration e = childElemsFound.elements();  e.hasMoreElements();) {
-                ChildNodeElem child = (ChildNodeElem) e.nextElement();
+            for (Enumeration<ChildNodeElem> e = childElemsFound.elements();  e.hasMoreElements();)
{
+                ChildNodeElem child = e.nextElement();
                 String name = child.name;
                 long number = child.number;
 
@@ -647,7 +646,7 @@ class SysViewContentHandler extends Defa
         // the path of the node
         String path;
         // List of PropElemData
-        ArrayList  propElems = new ArrayList();
+        List<PropElemData>  propElems = new ArrayList<PropElemData>();
         // the node itself
         Node node;
         // the current position of the child node in process among its same name siblings.
@@ -655,7 +654,7 @@ class SysViewContentHandler extends Defa
         int position = 0;
         // the childNodeElems (stored are key: name and
         // value: number of the same name siblings)
-        Hashtable childNodeElemNames = new Hashtable();
+        Hashtable<String, ChildNodeElem> childNodeElemNames = new Hashtable<String,
ChildNodeElem>();
     }
 
     /**
@@ -665,7 +664,7 @@ class SysViewContentHandler extends Defa
         String name;
         String typeName;
         int type;
-        ArrayList values;
+        List<String> values;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ValueFactoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ValueFactoryTest.java?rev=1214308&r1=1214307&r2=1214308&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ValueFactoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/ValueFactoryTest.java
Wed Dec 14 15:55:01 2011
@@ -31,7 +31,6 @@ import javax.jcr.PathNotFoundException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 import java.util.Calendar;
-import java.util.ArrayList;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
@@ -53,14 +52,11 @@ public class ValueFactoryTest extends Ab
     private static final double doubleValue = 3.1414926;
     private static final long  longValue = Long.MAX_VALUE;
     private Node referenceNode = null;
-    private Node notReferenceableNode = null;
     private static final String stringValue = "a string";
     private static String nameValue = "aName";
     private static String pathValue = "/a/Path[1]";
     private byte[] binaryValue = null;
 
-    private  ArrayList values = new ArrayList();
-
     private String dateValueFail = nameValue;
     private static final String doubleValueFail = nameValue;
     private static final String  longValueFail = nameValue;



Mime
View raw message