incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1060754 - /sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Date Wed, 19 Jan 2011 10:37:44 GMT
Author: fmeschbe
Date: Wed Jan 19 10:37:44 2011
New Revision: 1060754

URL: http://svn.apache.org/viewvc?rev=1060754&view=rev
Log:
Close ResourceResolver after the test

Modified:
    sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java

Modified: sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java?rev=1060754&r1=1060753&r2=1060754&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverTest.java
Wed Jan 19 10:37:44 2011
@@ -410,29 +410,33 @@ public class JcrResourceResolverTest ext
         final ResourceResolver rr = resFac.getResourceResolver(authInfo);
         final Session s = rr.adaptTo(Session.class);
 
-        assertEquals("Expect 3 session attributes", 3,
-            s.getAttributeNames().length);
-        assertEquals("AStringValue", s.getAttribute("testAttributeString"));
-        assertEquals(999, s.getAttribute("testAttributeNumber"));
-        assertEquals("admin", s.getAttribute(ResourceResolverFactory.USER));
-        assertNull(session.getAttribute(ResourceResolverFactory.PASSWORD));
-
-        assertEquals("AStringValue", rr.getAttribute("testAttributeString"));
-        assertEquals(999, rr.getAttribute("testAttributeNumber"));
-        assertEquals("admin", rr.getAttribute(ResourceResolverFactory.USER));
-        assertNull(rr.getAttribute(ResourceResolverFactory.PASSWORD));
-
-        final HashSet<String> validNames = new HashSet<String>();
-        validNames.add(ResourceResolverFactory.USER);
-        validNames.add("testAttributeString");
-        validNames.add("testAttributeNumber");
-        final Iterator<String> names = rr.getAttributeNames();
-        assertTrue(validNames.remove(names.next()));
-        assertTrue(validNames.remove(names.next()));
-        assertTrue(validNames.remove(names.next()));
-        assertFalse("Expect no more names", names.hasNext());
-        assertTrue("Expect validNames set to be empty now",
-            validNames.isEmpty());
+        try {
+            assertEquals("Expect 3 session attributes", 3,
+                s.getAttributeNames().length);
+            assertEquals("AStringValue", s.getAttribute("testAttributeString"));
+            assertEquals(999, s.getAttribute("testAttributeNumber"));
+            assertEquals("admin", s.getAttribute(ResourceResolverFactory.USER));
+            assertNull(session.getAttribute(ResourceResolverFactory.PASSWORD));
+
+            assertEquals("AStringValue", rr.getAttribute("testAttributeString"));
+            assertEquals(999, rr.getAttribute("testAttributeNumber"));
+            assertEquals("admin", rr.getAttribute(ResourceResolverFactory.USER));
+            assertNull(rr.getAttribute(ResourceResolverFactory.PASSWORD));
+
+            final HashSet<String> validNames = new HashSet<String>();
+            validNames.add(ResourceResolverFactory.USER);
+            validNames.add("testAttributeString");
+            validNames.add("testAttributeNumber");
+            final Iterator<String> names = rr.getAttributeNames();
+            assertTrue(validNames.remove(names.next()));
+            assertTrue(validNames.remove(names.next()));
+            assertTrue(validNames.remove(names.next()));
+            assertFalse("Expect no more names", names.hasNext());
+            assertTrue("Expect validNames set to be empty now",
+                validNames.isEmpty());
+        } finally {
+            rr.close();
+        }
     }
 
     public void testGetResource() throws Exception {



Mime
View raw message