subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r925657 - /subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Date Sat, 20 Mar 2010 18:53:42 GMT
Author: hwright
Date: Sat Mar 20 18:53:42 2010
New Revision: 925657

URL: http://svn.apache.org/viewvc?rev=925657&view=rev
Log:
JavaHL: In a couple of places in the tests where we only use a class once,
just use an anonymous class.

* subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
  (testBasicProperties, getMergeinfoRevisions, testCommitRevprops):
    Use anonymous classes.
  (MyProplistCallback): Remove.

Modified:
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java?rev=925657&r1=925656&r2=925657&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java
Sat Mar 20 18:53:42 2010
@@ -759,10 +759,15 @@ public class BasicTests extends SVNTests
                                  false);
         client.propertyCreate(itemPath, "cqcq", "qrz", Depth.empty, null,
                               false);
-        MyProplistCallback callback = new MyProplistCallback();
 
-        client.properties(itemPath, null, null, Depth.empty, null, callback);
-        Map<String, byte[]> propMap = callback.getProperties(itemPath);
+        final Map<String, Map<String, byte[]>> propMaps =
+                                    new HashMap<String, Map<String, byte[]>>();
+        client.properties(itemPath, null, null, Depth.empty, null,
+            new ProplistCallback () {
+                public void singlePath(String path, Map<String, byte[]> props)
+                { propMaps.put(path, props); }
+            });
+        Map<String, byte[]> propMap = propMaps.get(itemPath);
         for (String key : propMap.keySet())
         {
             assertEquals("cqcq", key);
@@ -2358,32 +2363,25 @@ public class BasicTests extends SVNTests
                                          Revision srcPegRevision)
         throws SubversionException
     {
-        class Callback implements LogMessageCallback {
-
-            List<Long> revList = new ArrayList<Long>();
+        final List<Long> revList = new ArrayList<Long>();
 
-            public void singleMessage(Set<ChangePath> changedPaths,
+        client.getMergeinfoLog(kind, pathOrUrl, pegRevision, mergeSourceUrl,
+            srcPegRevision, false, Depth.empty, null,
+            new LogMessageCallback () {
+                public void singleMessage(Set<ChangePath> changedPaths,
                     long revision, Map<String, byte[]> revprops,
-                    boolean hasChildren) {
-                revList.add(new Long(revision));
-            }
+                    boolean hasChildren)
+                { revList.add(new Long(revision)); }
+            });
 
-            public long[] getRevisions() {
-                long[] revisions = new long[revList.size()];
-                int i = 0;
-                for (Long revision : revList)
-                {
-                    revisions[i] = revision.longValue();
-                    i++;
-                }
-                return revisions;
-            }
+        long[] revisions = new long[revList.size()];
+        int i = 0;
+        for (Long revision : revList)
+        {
+            revisions[i] = revision.longValue();
+            i++;
         }
-        Callback callback = new Callback();
-        client.getMergeinfoLog(kind, pathOrUrl, pegRevision, mergeSourceUrl,
-                               srcPegRevision, false, Depth.empty, null,
-                               callback);
-        return callback.getRevisions();
+        return revisions;
     }
 
     /**
@@ -3458,25 +3456,6 @@ public class BasicTests extends SVNTests
      */
     public void testCommitRevprops() throws Throwable
     {
-
-        class RevpropLogCallback implements LogMessageCallback
-        {
-            Map<String, byte[]> revprops;
-
-            public void singleMessage(Set<ChangePath> changedPaths,
-                                      long revision,
-                                      Map<String, byte[]> revprops,
-                                      boolean hasChildren)
-            {
-                this.revprops = revprops;
-            }
-
-            public Map<String, byte[]> getRevprops()
-            {
-                return revprops;
-            }
-        }
-
         // build the test setup
         OneTest thisTest = new OneTest();
 
@@ -3506,16 +3485,23 @@ public class BasicTests extends SVNTests
         thisTest.checkStatus();
 
         // Fetch our revprops from the server
-        RevpropLogCallback callback = new RevpropLogCallback();
+        final List<Map<String, byte[]>> revpropList =
+                            new ArrayList<Map<String, byte[]>>();
         Set<String> revProps = new HashSet<String>(2);
         revProps.add("kfogel");
         revProps.add("cmpilato");
         client.logMessages(thisTest.getWCPath(), Revision.getInstance(2),
-                           toRevisionRange(Revision.getInstance(2),
-                                           Revision.getInstance(2)),
-                           false, false, false, revProps, 0,
-                           callback);
-        Map<String, byte[]> fetchedProps = callback.getRevprops();
+                toRevisionRange(Revision.getInstance(2),
+                                Revision.getInstance(2)),
+                false, false, false, revProps, 0,
+                new LogMessageCallback () {
+                    public void singleMessage(Set<ChangePath> changedPaths,
+                                              long revision,
+                                              Map<String, byte[]> revprops,
+                                              boolean hasChildren)
+                  { revpropList.add(revprops); }
+                });
+        Map<String, byte[]> fetchedProps = revpropList.get(0);
 
         assertEquals("wrong number of fetched revprops", revprops.size(),
                      fetchedProps.size());
@@ -3615,22 +3601,6 @@ public class BasicTests extends SVNTests
         }
     }
 
-    private class MyProplistCallback implements ProplistCallback
-    {
-        Map<String, Map<String, byte[]>> propMap =
-                                    new HashMap<String, Map<String, byte[]>>();
-
-        public void singlePath(String path, Map<String, byte[]> props)
-        {
-            propMap.put(path, props);
-        }
-
-        public Map<String, byte[]> getProperties(String path)
-        {
-            return propMap.get(path);
-        }
-    }
-
     private class MyStatusCallback implements StatusCallback
     {
         private List<Status> statuses = new ArrayList<Status>();



Mime
View raw message