From jackrabbit-commits-return-511-apmail-incubator-jackrabbit-commits-archive=www.apache.org@incubator.apache.org Wed Mar 09 16:37:18 2005 Return-Path: Delivered-To: apmail-incubator-jackrabbit-commits-archive@www.apache.org Received: (qmail 24798 invoked from network); 9 Mar 2005 16:37:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Mar 2005 16:37:18 -0000 Received: (qmail 21508 invoked by uid 500); 9 Mar 2005 16:37:17 -0000 Mailing-List: contact jackrabbit-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-commits@incubator.apache.org Received: (qmail 21493 invoked by uid 500); 9 Mar 2005 16:37:17 -0000 Delivered-To: apmail-incubator-jackrabbit-cvs@incubator.apache.org Received: (qmail 21490 invoked by uid 99); 9 Mar 2005 16:37:17 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 09 Mar 2005 08:37:17 -0800 Received: (qmail 24786 invoked by uid 65534); 9 Mar 2005 16:37:15 -0000 Message-ID: <20050309163715.24785.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Wed, 09 Mar 2005 16:37:15 -0000 Subject: svn commit: r156654 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/PropertyReadMethodsTest.java To: jackrabbit-cvs@incubator.apache.org From: mreutegg@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: mreutegg Date: Wed Mar 9 08:37:14 2005 New Revision: 156654 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D156654 Log: Adding more level 1 property test cases. Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Prop= ertyReadMethodsTest.java Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/PropertyReadMethodsTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/PropertyReadMethodsTest.java?view=3Ddiff&r1=3D15= 6653&r2=3D156654 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Prop= ertyReadMethodsTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Prop= ertyReadMethodsTest.java Wed Mar 9 08:37:14 2005 @@ -26,6 +26,9 @@ import javax.jcr.RepositoryException; import javax.jcr.ItemNotFoundException; import javax.jcr.ItemVisitor; +import javax.jcr.Value; +import javax.jcr.ValueFormatException; +import javax.jcr.PropertyType; import java.util.NoSuchElementException; =20 /** @@ -216,6 +219,67 @@ }; =20 p.accept(itemVisitor); + } + + /** + * Tests that no null value property exists in a given node tree. + */ + public void testNoNullValue() throws RepositoryException { + assertFalse("Single property with null value found.", + PropertyUtil.nullValues(rootNode)); + } + + /** + * Tests that all values of a multivalue property have the same proper= ty + * type. + */ + public void testMultiValueType() throws RepositoryException, NotExecut= ableException { + Property multiValProp =3D PropertyUtil.searchMultivalProp(rootNode= ); + if (multiValProp !=3D null) { + Value[] vals =3D multiValProp.getValues(); + if (vals.length > 0) { + int type =3D vals[0].getType(); + for (int i =3D 1; i < vals.length; i++) { + assertEquals("Multivalue property has values with diff= erent types.", + type, vals[i].getType()); + } + } + } else { + throw new NotExecutableException(); + } + } + + /** + * Tests failure of Property.getValue() method for a multivalue proper= ty. + */ + public void testGetValue() throws RepositoryException, NotExecutableEx= ception { + Property multiValProp =3D PropertyUtil.searchMultivalProp(rootNode= ); + if (multiValProp !=3D null) { + try { + multiValProp.getValue(); + fail("Property.getValue() called on a multivalue property = " + + "should throw a ValueFormatException."); + } catch (ValueFormatException vfe) { + // ok + } + } else { + throw new NotExecutableException(); + } + } + + /** + * Tests failure of Property.getValues() method for a single value + * property. + */ + public void testGetValues() throws RepositoryException { + Property singleProp =3D PropertyUtil.searchProp(session, rootNode,= PropertyType.STRING); + try { + singleProp.getValues(); + fail("Property.getValues() called on a single property " + + "should throw a ValueFormatException."); + } catch (ValueFormatException vfe) { + // ok + } } =20 }