jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r157057 - in incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api: BinaryPropertyTest.java PropertyUtil.java ReferencePropertyTest.java SessionReadMethodsTest.java StringPropertyTest.java
Date Fri, 11 Mar 2005 08:34:51 GMT
Author: mreutegg
Date: Fri Mar 11 00:34:48 2005
New Revision: 157057

URL: http://svn.apache.org/viewcvs?view=rev&rev=157057
Log:
Removed format checks for value of reference property. Implementation specific.

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/PropertyUtil.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SessionReadMethodsTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/StringPropertyTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java?view=diff&r1=157056&r2=157057
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/BinaryPropertyTest.java
Fri Mar 11 00:34:48 2005
@@ -198,17 +198,7 @@
      */
     public void testAsReference() throws RepositoryException, NotExecutableException {
         if (!multiple) {
-            if (!PropertyUtil.isUUID(prop.getString())) {
-                try {
-                    prop.getNode();
-                    fail("Conversion from a Path value to a Reference value " +
-                            "should throw a ValueFormatException");
-                } catch (ValueFormatException vfe) {
-                    //ok
-                }
-            } else {
-                prop.getNode();
-            }
+            // not testable since format of ID is implementation specific
         } else {
             try {
                 prop.getNode();

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/PropertyUtil.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/PropertyUtil.java?view=diff&r1=157056&r2=157057
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/PropertyUtil.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/PropertyUtil.java Fri
Mar 11 00:34:48 2005
@@ -132,11 +132,6 @@
         "(Z|[+-]([0-1][0-9]|2[0-3]):[0-5][0-9])";
     public static final Pattern PATTERN_DATE = Pattern.compile(PATTERNSTRING_DATE);
 
-    public static final String PATTERNSTRING_UUID =
-        "\\p{XDigit}{8}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{4}-\\p{XDigit}{12}";
-    public static final Pattern PATTERN_UUID = Pattern.compile(PATTERNSTRING_UUID);
-
-
     /**
      * Private constructor to disable instantiation.
      */
@@ -276,16 +271,6 @@
      */
     public static boolean isDateFormat(String str) {
         return PATTERN_DATE.matcher(str).matches();
-    }
-
-    /**
-     * Checks if the String is a UUID.
-     *
-     * @param str the string to test.
-     * @return <code>true</code> if <code>str</code> is a UUID.
-     */
-    public static boolean isUUID(String str) {
-        return PATTERN_UUID.matcher(str).matches();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferencePropertyTest.java?view=diff&r1=157056&r2=157057
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ReferencePropertyTest.java
Fri Mar 11 00:34:48 2005
@@ -152,8 +152,9 @@
      */
     public void testGetString() throws RepositoryException {
         Value val = PropertyUtil.getValue(prop);
-        String ref = val.getString();
-        assertTrue("Reference property has not correct UUID format.", PropertyUtil.isUUID(ref));
+        // format of reference value is implementation specifc. but at least
+        // must not throw
+        val.getString();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SessionReadMethodsTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SessionReadMethodsTest.java?view=diff&r1=157056&r2=157057
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SessionReadMethodsTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SessionReadMethodsTest.java
Fri Mar 11 00:34:48 2005
@@ -117,6 +117,50 @@
                 referenced.isSame(node));
     }
 
+    /**
+     * Tests if getAttribute(String name) returns not null if the requested
+     * attribute is existing
+     */
+    public void testGetAttribute() throws NotExecutableException {
+        String names[] = session.getAttributeNames();
+        if (names.length == 0) {
+            throw new NotExecutableException("No attributes set in this session.");
+        }
+        for (int i = 0; i < names.length; i++) {
+            assertNotNull("getAttribute(String name) returned null although the " +
+                    "requested attribute is existing.",
+                    session.getAttribute(names[i]));
+        }
+    }
+
+    /**
+     * Tests if getAttribute(String name) returns null if the requested attribute
+     * is not existing
+     */
+    public void testGetAttributeFailure() {
+        String names[] = session.getAttributeNames();
+        StringBuffer notExistingName = new StringBuffer("X");
+        for (int i = 0; i < names.length; i++) {
+            notExistingName.append(names[i]);
+        }
+        assertNull("getAttribute(String name) must return null if the " +
+                "requested attribute is not existing",
+                session.getAttribute(notExistingName.toString()));
+    }
+
+    /**
+     * Tests if attribute names returned by getAttributeNames() do not return
+     * null if used for getAttribute(String name)
+     */
+    public void testGetAttributeNames() {
+        String names[] = session.getAttributeNames();
+        for (int i = 0; i < names.length; i++) {
+            assertNotNull("An attribute name returned by getAttributeNames() " +
+                    "does not exist.",
+                    session.getAttribute(names[i]));
+        }
+    }
+
     //----------------------< internal >----------------------------------------
 
     /**
@@ -161,4 +205,4 @@
         }
         return referenced;
     }
-}
\ No newline at end of file
+}

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/StringPropertyTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/StringPropertyTest.java?view=diff&r1=157056&r2=157057
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/StringPropertyTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/StringPropertyTest.java
Fri Mar 11 00:34:48 2005
@@ -204,17 +204,7 @@
      */
     public void testAsReference() throws RepositoryException, NotExecutableException {
         if (!multiple) {
-            if (!PropertyUtil.isUUID(prop.getString())) {
-                try {
-                    prop.getNode();
-                    fail("Conversion from a Path value to a Reference value " +
-                            "should throw a ValueFormatException.");
-                } catch (ValueFormatException vfe) {
-                    //ok
-                }
-            } else {
-                prop.getNode();
-            }
+            // not testable since format of ID is implementation specific
         } else {
             try {
                 prop.getNode();



Mime
View raw message