jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915358 [2/2] - in /jackrabbit/trunk/jackrabbit-spi2dav/src: main/java/org/apache/jackrabbit/spi2dav/ main/java/org/apache/jackrabbit/spi2davex/ test/java/org/apache/jackrabbit/spi2dav/ test/java/org/apache/jackrabbit/spi2davex/
Date Tue, 23 Feb 2010 14:36:24 GMT
Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/RepositoryServiceImpl.java
Tue Feb 23 14:36:22 2010
@@ -25,11 +25,12 @@
 import org.apache.commons.httpclient.methods.multipart.Part;
 import org.apache.commons.httpclient.methods.multipart.PartBase;
 import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.json.JsonParser;
 import org.apache.jackrabbit.commons.json.JsonUtil;
-import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Path;
@@ -40,10 +41,10 @@
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
 import org.apache.jackrabbit.spi.commons.identifier.IdFactoryImpl;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.PathBuilder;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi2dav.ExceptionConverter;
 import org.apache.jackrabbit.util.Text;
 import org.apache.jackrabbit.webdav.DavException;
@@ -56,7 +57,6 @@
 
 import javax.jcr.Credentials;
 import javax.jcr.ItemNotFoundException;
-import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import java.io.IOException;
@@ -109,7 +109,7 @@
      */
     private final BatchReadConfig batchReadConfig;
 
-    private final Map qvFactories = new HashMap();
+    private final Map<SessionInfo, QValueFactoryImpl> qvFactories = new HashMap<SessionInfo,
QValueFactoryImpl>();
 
     public RepositoryServiceImpl(String jcrServerURI, BatchReadConfig batchReadConfig) throws
RepositoryException {
         this(jcrServerURI, null, batchReadConfig);
@@ -122,8 +122,7 @@
         this.defaultWorkspaceName = defaultWorkspaceName;
         if (batchReadConfig == null) {
             this.batchReadConfig = new BatchReadConfig() {
-                public int getDepth(Path path, PathResolver resolver)
-                        throws NamespaceException {
+                public int getDepth(Path path, PathResolver resolver) {
                     return 0;
                 }
             };
@@ -149,7 +148,7 @@
                     log.warn("ItemURI " + uri + " doesn't start with rootURI (" + rootUri
+ ").");
                     // fallback:
                     // calculated uri does not start with the rootURI
-                    // -> search /jcr:root and start substring behind.
+                    // -> search /jcr:root and start sub-string behind.
                     String rootSegment = Text.escapePath(ItemResourceConstants.ROOT_ITEM_RESOURCEPATH);
                     jcrPath = uri.substring(uri.indexOf(rootSegment) + rootSegment.length());
                 }
@@ -198,7 +197,7 @@
     public QValueFactoryImpl getQValueFactory(SessionInfo sessionInfo) throws RepositoryException
{
          QValueFactoryImpl qv;
          if (qvFactories.containsKey(sessionInfo)) {
-             qv = (QValueFactoryImpl) qvFactories.get(sessionInfo);
+             qv = qvFactories.get(sessionInfo);
          } else {
              ValueLoader loader = new ValueLoader(getClient(sessionInfo));
              qv = new QValueFactoryImpl(getNamePathResolver(sessionInfo), loader);
@@ -218,6 +217,7 @@
      *
      * @see RepositoryService#obtain(Credentials, String)
      */
+    @Override
     public SessionInfo obtain(Credentials credentials, String workspaceName)
             throws  RepositoryException {
         // for backwards compatibility with jcr-server < 1.5.0
@@ -231,6 +231,7 @@
      *
      * @see RepositoryService#obtain(SessionInfo, String)
      */
+    @Override
     public SessionInfo obtain(SessionInfo sessionInfo, String workspaceName)
             throws RepositoryException {
         // for backwards compatibility with jcr-server < 1.5.0
@@ -241,6 +242,7 @@
     /**
      * @see RepositoryService#dispose(SessionInfo)
      */
+    @Override
     public void dispose(SessionInfo sessionInfo) throws RepositoryException {
         super.dispose(sessionInfo);
         // remove the qvalue factory created for the given SessionInfo from the
@@ -251,7 +253,8 @@
     /**
      * @see RepositoryService#getItemInfos(SessionInfo, NodeId)
      */
-    public Iterator getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws ItemNotFoundException,
RepositoryException {
+    @Override
+    public Iterator<? extends ItemInfo> getItemInfos(SessionInfo sessionInfo, NodeId
nodeId) throws ItemNotFoundException, RepositoryException {
         Path path = getPath(nodeId, sessionInfo);
         String uri = getURI(path, sessionInfo);
         int depth = batchReadConfig.getDepth(path, this.getNamePathResolver(sessionInfo));
@@ -261,7 +264,7 @@
             int statusCode = getClient(sessionInfo).executeMethod(method);
             if (statusCode == DavServletResponse.SC_OK) {
                 if (method.getResponseContentLength() == 0) {
-                    // no json response -> no such node on the server
+                    // no JSON response -> no such node on the server
                     throw new ItemNotFoundException("No such node " + nodeId);
                 }
 
@@ -272,7 +275,7 @@
                 JsonParser ps = new JsonParser(handler);
                 ps.parse(method.getResponseBodyAsStream(), method.getResponseCharSet());
 
-                Iterator it = handler.getItemInfos();
+                Iterator<? extends ItemInfo> it = handler.getItemInfos();
                 if (!it.hasNext()) {
                     throw new ItemNotFoundException("No such node " + uri);
                 }
@@ -290,10 +293,12 @@
         }
     }
 
+    @Override
     public Batch createBatch(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException
{
         return new BatchImpl(itemId, sessionInfo);
     }
 
+    @Override
     public void submit(Batch batch) throws RepositoryException {
         if (!(batch instanceof BatchImpl)) {
             throw new RepositoryException("Unknown Batch implementation.");
@@ -308,6 +313,7 @@
         }
     }
 
+    @Override
     public void copy(SessionInfo sessionInfo, String srcWorkspaceName, NodeId srcNodeId,
NodeId destParentNodeId, Name destName) throws RepositoryException {
         if (srcWorkspaceName.equals(sessionInfo.getWorkspaceName())) {
             super.copy(sessionInfo, srcWorkspaceName, srcNodeId, destParentNodeId, destName);
@@ -345,6 +351,7 @@
         }
     }
 
+    @Override
     public void clone(SessionInfo sessionInfo, String srcWorkspaceName, NodeId srcNodeId,
NodeId destParentNodeId, Name destName, boolean removeExisting) throws RepositoryException
{
         PostMethod method = null;
         try {
@@ -400,14 +407,14 @@
 
         private final ItemId targetId;
         private final SessionInfo sessionInfo;
-        private final List parts;
-        private final List diff;
+        private final List<Part> parts;
+        private final List<String> diff;
         /*
           If this batch needs to remove multiple same-name-siblings starting
           from lower index, the index of the following siblings must be reset
           in order to avoid PathNotFoundException.
         */
-        private final Map removed = new HashMap();
+        private final Map<Path, Path> removed = new HashMap<Path, Path>();
 
         private PostMethod method; // TODO: use PATCH request instead.
         private boolean isConsumed;
@@ -415,21 +422,21 @@
         private BatchImpl(ItemId targetId, SessionInfo sessionInfo) {
             this.targetId = targetId;
             this.sessionInfo = sessionInfo;
-            parts = new ArrayList();
-            diff = new ArrayList();
+            parts = new ArrayList<Part>();
+            diff = new ArrayList<String>();
         }
 
         private void start() throws RepositoryException {
             checkConsumed();
 
-            // add locktokens
+            // add lock tokens
             addIfHeader(sessionInfo, method);
 
             // insert the content of 'batchMap' part containing the ordered list
             // of methods to be executed:
             StringBuffer buf = new StringBuffer();
-            for (Iterator it = diff.iterator(); it.hasNext();) {
-                buf.append(it.next().toString());
+            for (Iterator<String> it = diff.iterator(); it.hasNext();) {
+                buf.append(it.next());
                 if (it.hasNext()) {
                     buf.append("\r");
                 }
@@ -442,7 +449,7 @@
                 // other parts are present -> add the diff part
                 addPart(PARAM_DIFF, buf.toString());
                 // ... and create multipart-entity (and set it to method)
-                Part[] partArr = (Part[]) parts.toArray(new Part[parts.size()]);
+                Part[] partArr = parts.toArray(new Part[parts.size()]);
                 RequestEntity entity = new MultipartRequestEntity(partArr, method.getParams());
                 method.setRequestEntity(entity);
             }
@@ -479,7 +486,7 @@
             if (method == null) {
                 String uri = getURI(targetId, sessionInfo);
                 method = new PostMethod(uri);
-                // ship lock-tokens as if-header to cirvumvent problems with
+                // ship lock-tokens as if-header to circumvent problems with
                 // locks created by this session.
                 String[] locktokens = sessionInfo.getLockTokens();
                 if (locktokens != null && locktokens.length > 0) {
@@ -678,8 +685,8 @@
             // are only reflected once in the multipart, otherwise this will
             // cause consistency problems as the various calls cannot be separated
             // (missing unique identifier for the parts).
-            for (Iterator it = diff.iterator(); it.hasNext();) {
-                String entry = it.next().toString();
+            for (Iterator<String> it = diff.iterator(); it.hasNext();) {
+                String entry = it.next();
                 if (entry.startsWith(key)) {
                     it.remove();
                     removeParts(jcrPropPath);
@@ -726,8 +733,8 @@
         }
 
         private void removeParts(String paramName) {
-            for (Iterator it = parts.iterator(); it.hasNext();) {
-                Part part = (Part) it.next();
+            for (Iterator<Part> it = parts.iterator(); it.hasNext();) {
+                Part part = it.next();
                 if (part.getName().equals(paramName)) {
                     it.remove();
                 }
@@ -777,7 +784,7 @@
                     if (removed.containsKey(siblingP)) {
                         // as the previous sibling has been remove -> the same index
                         // must be used to remove the node at removedNodePath.
-                        siblingP = (Path) removed.get(siblingP);
+                        siblingP = removed.get(siblingP);
                         removed.put(removedNodePath, siblingP);
                         return siblingP;
                     }

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2davex/ValueLoader.java
Tue Feb 23 14:36:22 2010
@@ -74,7 +74,7 @@
             MultiStatusResponse[] responses = method.getResponseBodyAsMultiStatus().getResponses();
             if (responses.length == 1) {
                 DavPropertySet props = responses[0].getProperties(DavServletResponse.SC_OK);
-                DavProperty type = props.get(ItemResourceConstants.JCR_TYPE);
+                DavProperty<?> type = props.get(ItemResourceConstants.JCR_TYPE);
                 if (type != null) {
                     return PropertyType.valueFromName(type.getValue().toString());
                 } else {
@@ -103,4 +103,4 @@
          */
         void setStream(InputStream in) throws IOException;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/RepositoryStubImpl.java
Tue Feb 23 14:36:22 2010
@@ -60,6 +60,7 @@
         super(env);
     }
 
+    @Override
     public synchronized Repository getRepository() throws RepositoryStubException {
         if (repository == null) {
             try {
@@ -85,13 +86,15 @@
         return new RepositoryServiceImpl(uri, idFactory, nFactory, pFactory, vFactory);
     }
 
+    @Override
     public Principal getKnownPrincipal(Session session) throws RepositoryException {
         // TODO Auto-generated method stub
         throw new RepositoryException("TBD");
     }
 
+    @Override
     public Principal getUnknownPrincipal(Session session) throws RepositoryException, NotExecutableException
{
         // TODO Auto-generated method stub
         throw new RepositoryException("TBD");
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/ServiceStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/ServiceStubImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/ServiceStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2dav/ServiceStubImpl.java
Tue Feb 23 14:36:22 2010
@@ -54,6 +54,7 @@
         super(env);
     }
 
+    @Override
     public RepositoryService getRepositoryService() throws RepositoryException {
         if (service == null) {
             String uri = getProperty(PROP_REPOSITORY_URI);
@@ -66,6 +67,7 @@
         return service;
     }
 
+    @Override
     public Credentials getAdminCredentials() {
         if (adminCredentials == null) {
             adminCredentials = new SimpleCredentials(getProperty(RepositoryServiceStub.PROP_PREFIX
+ "." + RepositoryServiceStub.PROP_ADMIN_NAME),
@@ -74,6 +76,7 @@
         return adminCredentials;
     }
 
+    @Override
     public Credentials getReadOnlyCredentials() {
         if (readOnlyCredentials == null) {
             readOnlyCredentials = new SimpleCredentials(getProperty(RepositoryServiceStub.PROP_PREFIX
+ "." + RepositoryServiceStub.PROP_READONLY_NAME),
@@ -81,4 +84,4 @@
         }
         return readOnlyCredentials;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/BatchTest.java
Tue Feb 23 14:36:22 2010
@@ -58,16 +58,17 @@
     private RepositoryService rs;
     private SessionInfo si;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
 
         rs = helper.getRepositoryService();
         si = helper.getAdminSessionInfo();
         NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
-            public String getURI(String prefix) throws NamespaceException {
+            public String getURI(String prefix) {
                 return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
             }
-            public String getPrefix(String uri) throws NamespaceException {
+            public String getPrefix(String uri) {
                 return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
             }
         };
@@ -82,6 +83,7 @@
         }
     }
 
+    @Override
     protected void tearDown() throws Exception {
         try {
             Batch b = rs.createBatch(si, getNodeId("/"));
@@ -105,13 +107,13 @@
         rs.submit(b);
 
         NodeId id = rs.getIdFactory().createNodeId(nid, resolver.getQPath("aNode"));
-        Iterator it = rs.getItemInfos(si, id);
+        Iterator<? extends ItemInfo> it = rs.getItemInfos(si, id);
         while (it.hasNext()) {
-            ItemInfo info = (ItemInfo) it.next();
+            ItemInfo info = it.next();
             if (info.denotesNode()) {
                 NodeInfo nInfo = (NodeInfo) info;
                 assertEquals(NameConstants.NT_UNSTRUCTURED, nInfo.getNodetype());
-                Iterator childIt = nInfo.getChildInfos();
+                Iterator<ChildInfo> childIt = nInfo.getChildInfos();
                 assertTrue(childIt == null || !childIt.hasNext());
                 assertEquals(id, nInfo.getId());
             }
@@ -211,11 +213,11 @@
         b.reorderNodes(nid, getNodeId(testPath + "/3"), null);
         rs.submit(b);
 
-        Iterator it = rs.getChildInfos(si, nid);
+        Iterator<ChildInfo> it = rs.getChildInfos(si, nid);
         int i = 1;
         while (it.hasNext()) {
-            ChildInfo ci = (ChildInfo) it.next();
-            assertEquals(i, new Integer(ci.getName().getLocalName()).intValue());
+            ChildInfo ci = it.next();
+            assertEquals(i, Integer.parseInt(ci.getName().getLocalName()));
             i++;
         }
     }
@@ -233,11 +235,11 @@
         b.reorderNodes(nid, getNodeId(testPath + "/1"), getNodeId(testPath + "/2"));
         rs.submit(b);
 
-        Iterator it = rs.getChildInfos(si, nid);
+        Iterator<ChildInfo> it = rs.getChildInfos(si, nid);
         int i = 1;
         while (it.hasNext()) {
-            ChildInfo ci = (ChildInfo) it.next();
-            assertEquals(i, new Integer(ci.getName().getLocalName()).intValue());
+            ChildInfo ci = it.next();
+            assertEquals(i, Integer.parseInt(ci.getName().getLocalName()));
             i++;
         }
     }
@@ -278,9 +280,9 @@
         assertEquals(Arrays.asList(new QValue[0]), Arrays.asList(pi.getValues()));
         assertFalse(pi.getType() == PropertyType.UNDEFINED);
 
-        Iterator it = rs.getItemInfos(si, nid);
+        Iterator<? extends ItemInfo> it = rs.getItemInfos(si, nid);
         while (it.hasNext()) {
-            ItemInfo info = (ItemInfo) it.next();
+            ItemInfo info = it.next();
             if (!info.denotesNode()) {
                 PropertyInfo pInfo = (PropertyInfo) info;
                 if (propName.equals((pInfo.getId().getName()))) {
@@ -546,7 +548,7 @@
         Name propName = resolver.getQName("stringProp");
         QValueFactory vf = rs.getQValueFactory();
 
-        List l = new ArrayList();
+        List<String> l = new ArrayList<String>();
         l.add("String value containing \"double quotes\" and \'single\' and \"undeterminated
quote.");
         l.add("String value \ncontaining \n\rline \r\nseparators and \t tab.");
         l.add("String value containing \r\n\r\r\n\r\n multiple \r\n\r\n line separators in
sequence.");
@@ -554,8 +556,8 @@
         l.add("String value containing \n>line sep \r+and \r\n-diff\n\r^chars.");
         l.add("String value containing \u0633\u0634 unicode chars.");
 
-        for (Iterator it = l.iterator(); it.hasNext();) {
-            QValue v = vf.create(it.next().toString(), PropertyType.STRING);
+        for (String val : l) {
+            QValue v = vf.create(val, PropertyType.STRING);
             Batch b = rs.createBatch(si, nid);
             b.addProperty(nid, propName, v);
             rs.submit(b);
@@ -664,6 +666,33 @@
         assertEquals(PropertyType.REFERENCE, pi.getType());
     }
 
+    public void testSetWeakReferenceValue() throws RepositoryException {
+        NodeId nid = getNodeId(testPath);
+        NodeInfo nInfo = rs.getNodeInfo(si, nid);
+        if (!Arrays.asList(nInfo.getMixins()).contains(NameConstants.MIX_REFERENCEABLE))
{
+            Batch b = rs.createBatch(si, nid);
+            b.setMixins(nid, new Name[] {NameConstants.MIX_REFERENCEABLE});
+            rs.submit(b);
+        }
+
+        String ref = rs.getNodeInfo(si, nid).getId().getUniqueID();
+        Name propName = resolver.getQName("weakRefProp");
+        QValue v = rs.getQValueFactory().create(ref, PropertyType.WEAKREFERENCE);
+
+        Batch b = rs.createBatch(si, nid);
+        b.addProperty(nid, propName, v);
+        rs.submit(b);
+
+        PropertyInfo pi = rs.getPropertyInfo(si, getPropertyId(nid, propName));
+        assertFalse(pi.isMultiValued());
+        assertEquals(v, pi.getValues()[0]);
+        assertEquals(PropertyType.WEAKREFERENCE, pi.getType());
+
+        pi = getPropertyInfo(nid, propName);
+        assertEquals(v, pi.getValues()[0]);
+        assertEquals(PropertyType.WEAKREFERENCE, pi.getType());
+    }
+
     public void testSetPropertyTwice() throws RepositoryException {
         NodeId nid = getNodeId(testPath);
         Name propName = resolver.getQName("nameProp");
@@ -716,9 +745,9 @@
     }
 
     private PropertyInfo getPropertyInfo(NodeId parentId, Name propName) throws RepositoryException
{
-        Iterator it = rs.getItemInfos(si, parentId);
+        Iterator<? extends ItemInfo> it = rs.getItemInfos(si, parentId);
         while (it.hasNext()) {
-            ItemInfo info = (ItemInfo) it.next();
+            ItemInfo info = it.next();
             if (!info.denotesNode()) {
                 PropertyInfo pInfo = (PropertyInfo) info;
                 if (propName.equals((pInfo.getId().getName()))) {

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CloneTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CloneTest.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CloneTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CloneTest.java
Tue Feb 23 14:36:22 2010
@@ -22,6 +22,7 @@
 import org.apache.jackrabbit.spi.NodeInfo;
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -45,6 +46,7 @@
     private SessionInfo sInfo;
     private NodeId clonedId;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
 
@@ -72,6 +74,7 @@
         sInfo = rs.obtain(si, "test");
     }
 
+    @Override
     protected void tearDown() throws Exception {
         try {
             if (si != null) {
@@ -108,11 +111,11 @@
 
         clonedId = getNodeId("/destname");
         NodeInfo nInfo = rs.getNodeInfo(sInfo, clonedId);
-        Iterator it = rs.getItemInfos(sInfo, clonedId);
+        Iterator<? extends ItemInfo> it = rs.getItemInfos(sInfo, clonedId);
 
         assertTrue(it.hasNext());
         NodeInfo nInfo2 = (NodeInfo) it.next();
         assertEquals(nInfo.getId(), nInfo2.getId());
         assertEquals(nInfo.getNodetype(), nInfo2.getNodetype());
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ConnectionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ConnectionTest.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ConnectionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ConnectionTest.java
Tue Feb 23 14:36:22 2010
@@ -25,7 +25,6 @@
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 
 import javax.jcr.LoginException;
-import javax.jcr.NamespaceException;
 import javax.jcr.RepositoryException;
 import javax.jcr.SimpleCredentials;
 
@@ -34,18 +33,18 @@
  */
 public class ConnectionTest extends AbstractSPITest {
 
-    private final String testPath = "/";
     private NamePathResolver resolver;
     private RepositoryService rs;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         rs = helper.getRepositoryService();
                 NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
-            public String getURI(String prefix) throws NamespaceException {
+            public String getURI(String prefix) {
                 return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
             }
-            public String getPrefix(String uri) throws NamespaceException {
+            public String getPrefix(String uri) {
                 return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
             }
         };
@@ -60,4 +59,4 @@
             rs.dispose(sInfo);
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CopyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CopyTest.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CopyTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/CopyTest.java
Tue Feb 23 14:36:22 2010
@@ -17,18 +17,18 @@
 package org.apache.jackrabbit.spi2davex;
 
 import org.apache.jackrabbit.spi.AbstractSPITest;
-import org.apache.jackrabbit.spi.RepositoryService;
-import org.apache.jackrabbit.spi.SessionInfo;
-import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Batch;
+import org.apache.jackrabbit.spi.ItemInfo;
+import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.RepositoryService;
+import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
-import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
-import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver;
+import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 
-import javax.jcr.NamespaceException;
 import javax.jcr.RepositoryException;
 import java.util.Iterator;
 
@@ -44,16 +44,17 @@
     private SessionInfo sInfo;
     private NodeId copiedId;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
 
         rs = helper.getRepositoryService();
         si = helper.getAdminSessionInfo();
         NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
-            public String getURI(String prefix) throws NamespaceException {
+            public String getURI(String prefix) {
                 return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
             }
-            public String getPrefix(String uri) throws NamespaceException {
+            public String getPrefix(String uri) {
                 return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
             }
         };
@@ -68,6 +69,7 @@
         }
     }
 
+    @Override
     protected void tearDown() throws Exception {
         try {
             if (si != null) {
@@ -106,7 +108,7 @@
 
             nid = getNodeId("/destname");
             NodeInfo nInfo = rs.getNodeInfo(si, nid);
-            Iterator it = rs.getItemInfos(si, nid);
+            Iterator<? extends ItemInfo> it = rs.getItemInfos(si, nid);
 
             assertTrue(it.hasNext());
             NodeInfo nInfo2 = (NodeInfo) it.next();
@@ -131,11 +133,11 @@
 
         copiedId = getNodeId("/destname");
         NodeInfo nInfo = rs.getNodeInfo(sInfo, copiedId);
-        Iterator it = rs.getItemInfos(sInfo, copiedId);
+        Iterator<? extends ItemInfo> it = rs.getItemInfos(sInfo, copiedId);
 
         assertTrue(it.hasNext());
         NodeInfo nInfo2 = (NodeInfo) it.next();
         assertEquals(nInfo.getId(), nInfo2.getId());
         assertEquals(nInfo.getNodetype(), nInfo2.getNodetype());
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ExtensionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ExtensionTest.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ExtensionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ExtensionTest.java
Tue Feb 23 14:36:22 2010
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
@@ -44,22 +45,24 @@
     private RepositoryService rs;
     private SessionInfo si;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
 
         rs = helper.getRepositoryService();
         si = helper.getAdminSessionInfo();
         NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
-            public String getURI(String prefix) throws NamespaceException {
+            public String getURI(String prefix) {
                 return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
             }
-            public String getPrefix(String uri) throws NamespaceException {
+            public String getPrefix(String uri) {
                 return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
             }
         };
         resolver = new DefaultNamePathResolver(nsResolver);
     }
 
+    @Override
     protected void tearDown() throws Exception {
         try {
             removeTestNode(testPath);
@@ -97,7 +100,7 @@
         //System.out.println("NodeInfo: " + nInfo.getPath().getNameElement().getName());
         assertEquals(testName, nInfo.getPath().getNameElement().getName());
 
-        Iterator it = rs.getItemInfos(si, getNodeId(path));
+        Iterator<? extends ItemInfo > it = rs.getItemInfos(si, getNodeId(path));
         assertTrue(it.hasNext());
         nInfo = (NodeInfo) it.next();
         //System.out.println("ItemInfo: " + nInfo.getPath().getNameElement().getName());
@@ -140,7 +143,7 @@
          //System.out.println("NodeInfo: " + nInfo.getPath().getNameElement().getName());
          assertEquals(testName, nInfo.getPath().getNameElement().getName());
 
-         Iterator it = rs.getItemInfos(si, getNodeId("/test[2]"));
+         Iterator<? extends ItemInfo> it = rs.getItemInfos(si, getNodeId("/test[2]"));
          assertTrue(it.hasNext());
          nInfo = (NodeInfo) it.next();
          //System.out.println("ItemInfo: " + nInfo.getPath().getNameElement().getName());
@@ -148,4 +151,4 @@
 
          removeTestNode("/test[2]");
      }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ReadTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ReadTest.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ReadTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ReadTest.java
Tue Feb 23 14:36:22 2010
@@ -16,15 +16,13 @@
  */
 package org.apache.jackrabbit.spi2davex;
 
+import org.apache.jackrabbit.spi.AbstractSPITest;
 import org.apache.jackrabbit.spi.Batch;
-import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PropertyId;
-import org.apache.jackrabbit.spi.PropertyInfo;
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
-import org.apache.jackrabbit.spi.AbstractSPITest;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
@@ -34,7 +32,6 @@
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.NamespaceException;
 import javax.jcr.RepositoryException;
-import java.util.Iterator;
 
 /**
  * <code>ConnectionTest</code>...
@@ -46,16 +43,17 @@
     private RepositoryService rs;
     private SessionInfo si;
 
+    @Override
     protected void setUp() throws Exception {
         super.setUp();
         rs = helper.getRepositoryService();
         si = helper.getAdminSessionInfo();
 
         NamespaceResolver nsResolver = new AbstractNamespaceResolver() {
-            public String getURI(String prefix) throws NamespaceException {
+            public String getURI(String prefix) {
                 return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
             }
-            public String getPrefix(String uri) throws NamespaceException {
+            public String getPrefix(String uri) {
                 return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
             }
         };
@@ -70,6 +68,7 @@
         }
     }
 
+    @Override
     protected void tearDown() throws Exception {
         try {
             Batch b = rs.createBatch(si, getNodeId("/"));
@@ -136,18 +135,4 @@
     private PropertyId getPropertyId(NodeId nId, Name propName) throws RepositoryException
{
         return rs.getIdFactory().createPropertyId(nId, propName);
     }
-
-    private PropertyInfo getPropertyInfo(NodeId parentId, Name propName) throws RepositoryException
{
-        Iterator it = rs.getItemInfos(si, parentId);
-        while (it.hasNext()) {
-            ItemInfo info = (ItemInfo) it.next();
-            if (!info.denotesNode()) {
-                PropertyInfo pInfo = (PropertyInfo) info;
-                if (propName.equals((pInfo.getId().getName()))) {
-                    return pInfo;
-                }
-            }
-        }
-        throw new ItemNotFoundException();
-    }
 }

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/RepositoryStubImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/RepositoryStubImpl.java
Tue Feb 23 14:36:22 2010
@@ -43,6 +43,7 @@
         super(env);
     }
 
+    @Override
     protected RepositoryService createService(String uri) throws RepositoryException {
         BatchReadConfig brc = new BatchReadConfig() {
             public int getDepth(Path path, PathResolver resolver) throws NamespaceException
{
@@ -51,4 +52,4 @@
         };
         return new RepositoryServiceImpl(uri, brc);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ServiceStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ServiceStubImpl.java?rev=915358&r1=915357&r2=915358&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ServiceStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/test/java/org/apache/jackrabbit/spi2davex/ServiceStubImpl.java
Tue Feb 23 14:36:22 2010
@@ -22,7 +22,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
 import java.util.Properties;
 
@@ -34,8 +33,6 @@
     public static final String PROP_DEFAULT_DEPTH = "org.apache.jackrabbit.spi2davex.defaultDepth";
 
     private RepositoryService service;
-    private Credentials adminCredentials;
-    private Credentials readOnlyCredentials;
 
     /**
      * Implementations of this class must overwrite this constructor.
@@ -46,6 +43,7 @@
         super(env);
     }
 
+    @Override
     public RepositoryService getRepositoryService() throws RepositoryException {
         if (service == null) {
             String uri = getProperty(PROP_REPOSITORY_URI);
@@ -65,4 +63,4 @@
         }
         return service;
     }
-}
\ No newline at end of file
+}



Mime
View raw message