From graffito-commits-return-678-apmail-incubator-graffito-commits-archive=www.apache.org@incubator.apache.org Sat May 13 15:08:39 2006 Return-Path: Delivered-To: apmail-incubator-graffito-commits-archive@www.apache.org Received: (qmail 66973 invoked from network); 13 May 2006 15:08:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 May 2006 15:08:39 -0000 Received: (qmail 19304 invoked by uid 500); 13 May 2006 15:08:38 -0000 Mailing-List: contact graffito-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: graffito-dev@incubator.apache.org Delivered-To: mailing list graffito-commits@incubator.apache.org Received: (qmail 19274 invoked by uid 99); 13 May 2006 15:08:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 May 2006 08:08:38 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 13 May 2006 08:08:34 -0700 Received: (qmail 66911 invoked by uid 65534); 13 May 2006 15:08:13 -0000 Message-ID: <20060513150813.66910.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r406118 [2/2] - in /incubator/graffito/trunk/jcr/jcr-mapping/src: dtd/ java/org/apache/portals/graffito/jcr/mapper/impl/ java/org/apache/portals/graffito/jcr/mapper/model/ java/org/apache/portals/graffito/jcr/persistence/ java/org/apache/po... Date: Sat, 13 May 2006 15:08:06 -0000 To: graffito-commits@incubator.apache.org From: clombart@apache.org X-Mailer: svnmailer-1.0.8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java?rev=406118&r1=406117&r2=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java Sat May 13 08:08:04 2006 @@ -31,10 +31,14 @@ import org.apache.portals.graffito.jcr.testmodel.A; import org.apache.portals.graffito.jcr.testmodel.B; import org.apache.portals.graffito.jcr.testmodel.inheritance.Ancestor; -import org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject; +import org.apache.portals.graffito.jcr.testmodel.inheritance.AnotherDescendant; import org.apache.portals.graffito.jcr.testmodel.inheritance.Descendant; -import org.apache.portals.graffito.jcr.testmodel.inheritance.Document; import org.apache.portals.graffito.jcr.testmodel.inheritance.SubDescendant; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentImpl; +import org.apache.portals.graffito.jcr.testmodel.interfaces.CmsObject; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Document; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Interface; import org.apache.portals.graffito.jcr.testmodel.proxy.Main; /** @@ -172,7 +176,8 @@ String[] files = { "./src/test-config/jcrmapping.xml", "./src/test-config/jcrmapping-atomic.xml", "./src/test-config/jcrmapping-beandescriptor.xml", - "./src/test-config/jcrmapping-inheritance.xml" }; + "./src/test-config/jcrmapping-inheritance.xml" }; + Mapper mapper = new DigesterMapperImpl(files).buildMapper(); assertNotNull("Mapper is null", mapper); @@ -182,17 +187,12 @@ assertNotNull("Classdescriptor is null", classDescriptor); assertEquals("Incorrect path field", classDescriptor .getPathFieldDescriptor().getFieldName(), "path"); - assertEquals("Incorrect discriminator field", classDescriptor - .getDiscriminatorFieldDescriptor().getFieldName(), - "discriminator"); assertTrue("The ancestor class has no discriminator", - classDescriptor.hasDiscriminatorField()); + classDescriptor.hasDiscriminator()); assertTrue("The ancestor class is not abstract", classDescriptor .isAbstract()); assertNull("The ancestor class has an ancestor", classDescriptor .getSuperClassDescriptor()); - assertEquals("Incorrect JcrName", classDescriptor - .getJcrName("discriminator"), "discriminator"); assertTrue( "Ancestor class doesn't have a node type per hierarchy strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); @@ -209,11 +209,8 @@ assertNotNull("Classdescriptor is null", classDescriptor); assertEquals("Incorrect path field", classDescriptor .getPathFieldDescriptor().getFieldName(), "path"); - assertEquals("Incorrect discriminator field", classDescriptor - .getDiscriminatorFieldDescriptor().getFieldName(), - "discriminator"); assertTrue("The descendant class has no discriminator", - classDescriptor.hasDiscriminatorField()); + classDescriptor.hasDiscriminator()); assertNotNull("ancerstorField is null in the descendant class", classDescriptor.getFieldDescriptor("ancestorField")); assertFalse("The descendant class is abstract", classDescriptor @@ -223,8 +220,6 @@ assertEquals("Invalid ancestor class for the descendant class", classDescriptor.getSuperClassDescriptor().getClassName(), "org.apache.portals.graffito.jcr.testmodel.inheritance.Ancestor"); - assertEquals("Incorrect JcrName", classDescriptor - .getJcrName("discriminator"), "discriminator"); descendandDescriptors = classDescriptor .getDescendantClassDescriptors(); assertEquals("Invalid number of descendants", descendandDescriptors @@ -240,11 +235,8 @@ assertNotNull("Classdescriptor is null", classDescriptor); assertEquals("Incorrect path field", classDescriptor .getPathFieldDescriptor().getFieldName(), "path"); - assertEquals("Incorrect discriminator field", classDescriptor - .getDiscriminatorFieldDescriptor().getFieldName(), - "discriminator"); assertTrue("The subdescendant class has no discriminator", - classDescriptor.hasDiscriminatorField()); + classDescriptor.hasDiscriminator()); assertNotNull("ancestorField is null in the descendant class", classDescriptor.getFieldDescriptor("ancestorField")); assertFalse("The subdescendant class is abstract", classDescriptor @@ -254,8 +246,6 @@ assertEquals("Invalid ancestor class for the descendant class", classDescriptor.getSuperClassDescriptor().getClassName(), "org.apache.portals.graffito.jcr.testmodel.inheritance.Descendant"); - assertEquals("Incorrect JcrName", classDescriptor - .getJcrName("discriminator"), "discriminator"); descendandDescriptors = classDescriptor .getDescendantClassDescriptors(); assertEquals("Invalid number of descendants", descendandDescriptors @@ -276,7 +266,7 @@ /** * * Test Node Type per concrete class setting - */ + */ public void testMapperNtConcreteClass() { try { String[] files = { "./src/test-config/jcrmapping.xml", @@ -289,15 +279,12 @@ assertNotNull("Mapper is null", mapper); - ClassDescriptor classDescriptor = mapper - .getClassDescriptor(CmsObject.class); + ClassDescriptor classDescriptor = mapper.getClassDescriptor(CmsObjectImpl.class); assertNotNull("Classdescriptor is null", classDescriptor); assertEquals("Incorrect path field", classDescriptor .getPathFieldDescriptor().getFieldName(), "path"); assertFalse("The cms object class has discriminator", - classDescriptor.hasDiscriminatorField()); - assertNull("The cms object class has an discriminator field", - classDescriptor.getDiscriminatorFieldDescriptor()); + classDescriptor.hasDiscriminator()); assertTrue("The cmsobject class is not abstract", classDescriptor .isAbstract()); assertNull("The cmsobject class has an ancestor", classDescriptor @@ -313,21 +300,19 @@ assertEquals("Invalid number of descendants", classDescriptor .getDescendantClassDescriptors().size(), 2); - classDescriptor = mapper.getClassDescriptor(Document.class); + classDescriptor = mapper.getClassDescriptor(DocumentImpl.class); assertNotNull("Classdescriptor is null", classDescriptor); assertEquals("Incorrect path field", classDescriptor .getPathFieldDescriptor().getFieldName(), "path"); assertFalse("The document class has discriminator", - classDescriptor.hasDiscriminatorField()); - assertNull("The document has an discriminator field", - classDescriptor.getDiscriminatorFieldDescriptor()); + classDescriptor.hasDiscriminator()); assertFalse("The document class is abstract", classDescriptor .isAbstract()); assertNotNull("The document class has not an ancestor", classDescriptor.getSuperClassDescriptor()); assertEquals("The document class has an invalid ancestor ancestor", classDescriptor.getSuperClassDescriptor().getClassName(), - "org.apache.portals.graffito.jcr.testmodel.inheritance.Content"); + "org.apache.portals.graffito.jcr.testmodel.inheritance.impl.ContentImpl"); assertFalse( "The document class have a node type per hierarchy strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); @@ -346,8 +331,98 @@ } /** - * - * Test Node Type per concrete class setting + * Test interface setting + */ + public void testInterfaceWithDiscriminator() { + try { + String[] files = {"./src/test-config/jcrmapping-inheritance.xml"}; + Mapper mapper = new DigesterMapperImpl(files).buildMapper(); + + assertNotNull("Mapper is null", mapper); + ClassDescriptor classDescriptor = mapper.getClassDescriptor(Interface.class); + assertNotNull("Classdescriptor is null", classDescriptor); + assertTrue("Interface is not an interface", classDescriptor.isInterface()); + assertTrue("Interface has not a discriminator", classDescriptor.hasDiscriminator()); + String[] mixinTypes = classDescriptor.getJcrMixinTypes(); + assertEquals("Invalid mixin type for the interface",mixinTypes.length , 0); + assertNull("The interface has an ancestor", classDescriptor.getSuperClassDescriptor()); + assertTrue("The interface has not implementation/descendant", classDescriptor.hasDescendants()); + Collection descendants = classDescriptor.getDescendantClassDescriptors(); + assertEquals("Invalid number of implementation/descendants", descendants.size(), 1); + assertEquals("Invalid interface implementation",( (ClassDescriptor) descendants.iterator().next()).getClassName(), "org.apache.portals.graffito.jcr.testmodel.inheritance.AnotherDescendant"); + assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); + assertFalse("Incalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy()); + + classDescriptor = mapper.getClassDescriptor(AnotherDescendant.class); + assertNotNull("Classdescriptor is null", classDescriptor); + assertFalse("Interface is an interface", classDescriptor.isInterface()); + assertTrue("AnotherDescendant has not a discriminator", classDescriptor.hasDiscriminator()); + assertEquals("Invalid number of implemented interface", classDescriptor.getImplements().size(), 1); + assertEquals("Invalid interface name", classDescriptor.getImplements().iterator().next(), "org.apache.portals.graffito.jcr.testmodel.interfaces.Interface"); + assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); + assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy()); + + + } catch (JcrMappingException e) { + e.printStackTrace(); + fail("Impossible to retrieve the converter " + e); + } + } + + /** + * Test interface setting + */ + public void testInterfaceWithoutDiscriminator() + { + try { + String[] files = {"./src/test-config/jcrmapping-inheritance.xml"}; + Mapper mapper = new DigesterMapperImpl(files).buildMapper(); + + assertNotNull("Mapper is null", mapper); + ClassDescriptor classDescriptor = mapper.getClassDescriptor(CmsObject.class); + assertNotNull("Classdescriptor is null", classDescriptor); + assertTrue("CmsObject is not an interface", classDescriptor.isInterface()); + assertFalse("Interface has a discriminator", classDescriptor.hasDiscriminator()); + String[] mixinTypes = classDescriptor.getJcrMixinTypes(); + assertEquals("Invalid mixin type for the interface",mixinTypes.length , 0); + assertNull("The interface has an ancestor", classDescriptor.getSuperClassDescriptor()); + assertTrue("The interface has not implementation/descendant", classDescriptor.hasDescendants()); + Collection descendants = classDescriptor.getDescendantClassDescriptors(); + assertEquals("Invalid number of implementation/descendants", descendants.size(),3); + assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); + assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy()); + + + classDescriptor = mapper.getClassDescriptor(Document.class); + assertNotNull("Classdescriptor is null", classDescriptor); + assertTrue("Document is not an interface", classDescriptor.isInterface()); + assertFalse("Document has a discriminator", classDescriptor.hasDiscriminator()); + assertEquals("Invalid number of implemented interface", classDescriptor.getImplements().size(), 0); + assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); + assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy()); + descendants = classDescriptor.getDescendantClassDescriptors(); + assertEquals("Invalid number of implementation/descendants", descendants.size(),1); + + + classDescriptor = mapper.getClassDescriptor(DocumentImpl.class); + assertNotNull("Classdescriptor is null", classDescriptor); + assertFalse("DocumentImpl is an interface", classDescriptor.isInterface()); + assertFalse("DocumentImpl has a discriminator", classDescriptor.hasDiscriminator()); + assertTrue("DocumentImpl has not interface", classDescriptor.hasInterfaces()); + assertEquals("Invalid number of implemented interface", classDescriptor.getImplements().size(), 1); + assertFalse("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy()); + assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy()); + + + } catch (JcrMappingException e) { + e.printStackTrace(); + fail("Impossible to retrieve the converter " + e); + } + } + + /** + * + * Test Node Type per concrete class setting */ public void testProxy() { try { @@ -368,4 +443,5 @@ fail("Impossible to retrieve the converter " + e); } } + } Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java?rev=406118&r1=406117&r2=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java Sat May 13 08:08:04 2006 @@ -38,10 +38,12 @@ //$JUnit-BEGIN$ suite.addTestSuite(PersistenceManagerAtomicQueryTest.class); suite.addTestSuite(PersistenceManagerBasicVersionningTest.class); + suite.addTestSuite(PersistenceManagerInheritanceConcreteClassTest.class); + suite.addTestSuite(PersistenceManagerInheritanceHierarchyTest.class); + suite.addTestSuite(PersistenceManagerInterfaceConcreteClassTest.class); + suite.addTestSuite(PersistenceManagerInterfaceHierarchyTest.class); suite.addTestSuite(PersistenceManagerIteratorQueryTest.class); - suite.addTestSuite(PersistenceManagerMultiValueQueryTest.class); - suite.addTestSuite(PersistenceManagerNtConcreteClassTest.class); - suite.addTestSuite(PersistenceManagerNtHierarchyTest.class); + suite.addTestSuite(PersistenceManagerMultiValueQueryTest.class); suite.addTestSuite(PersistenceManagerRemoveTest.class); suite.addTestSuite(PersistenceManagerSameNameSiblingTest.class); suite.addTestSuite(PersistenceManagerScopeQueryTest.class); Copied: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java (from r393615, incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java) URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java?p2=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java&p1=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java&r1=393615&r2=406118&rev=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtConcreteClassTest.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java Sat May 13 08:08:04 2006 @@ -30,25 +30,25 @@ import org.apache.portals.graffito.jcr.query.Query; import org.apache.portals.graffito.jcr.query.QueryManager; import org.apache.portals.graffito.jcr.testmodel.Atomic; -import org.apache.portals.graffito.jcr.testmodel.inheritance.CmsObject; -import org.apache.portals.graffito.jcr.testmodel.inheritance.Content; -import org.apache.portals.graffito.jcr.testmodel.inheritance.DocumentStream; -import org.apache.portals.graffito.jcr.testmodel.inheritance.Document; -import org.apache.portals.graffito.jcr.testmodel.inheritance.Folder; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.ContentImpl; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentImpl; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentStream; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.FolderImpl; /** * Test inheritance with node type per concrete class (without discreminator field) * * @author Christophe Lombart */ -public class PersistenceManagerNtConcreteClassTest extends TestBase { - private final static Log log = LogFactory.getLog(PersistenceManagerNtConcreteClassTest.class); +public class PersistenceManagerInheritanceConcreteClassTest extends TestBase { + private final static Log log = LogFactory.getLog(PersistenceManagerInheritanceConcreteClassTest.class); /** *

Defines the test case name for junit.

* @param testName The test case name. */ - public PersistenceManagerNtConcreteClassTest(String testName) throws Exception { + public PersistenceManagerInheritanceConcreteClassTest(String testName) throws Exception { super(testName); } @@ -56,7 +56,7 @@ public static Test suite() { // All methods starting with "test" will be executed in the test suite. return new RepositoryLifecycleTestSetup(new TestSuite( - PersistenceManagerNtConcreteClassTest.class)); + PersistenceManagerInheritanceConcreteClassTest.class)); } public void tearDown() throws Exception { @@ -75,7 +75,7 @@ //--------------------------------------------------------------------------------------------------------- // Insert a Document //--------------------------------------------------------------------------------------------------------- - Document document = new Document(); + DocumentImpl document = new DocumentImpl(); document.setPath("/document1"); document.setName("document name"); document.setContentType("plain/text"); @@ -92,7 +92,7 @@ // Retrieve a document object //--------------------------------------------------------------------------------------------------------- - document = (Document) persistenceManager.getObject(Document.class, "/document1"); + document = (DocumentImpl) persistenceManager.getObject(DocumentImpl.class, "/document1"); assertEquals("Document path is invalid", document.getPath(), "/document1"); assertEquals("Content type is invalid", document.getContentType(), "plain/text"); assertNotNull("document stream is null", document.getDocumentStream()); @@ -109,14 +109,14 @@ //--------------------------------------------------------------------------------------------------------- // Retrieve the updated descendant object //--------------------------------------------------------------------------------------------------------- - document = (Document) persistenceManager.getObject(Document.class, "/document1"); + document = (DocumentImpl) persistenceManager.getObject(DocumentImpl.class, "/document1"); assertEquals("document name is incorrect", document.getName(), "anotherName"); assertEquals("Document path is invalid", document.getPath(), "/document1"); assertEquals("Content type is invalid", document.getContentType(), "plain/text"); assertNotNull("document stream is null", document.getDocumentStream()); assertTrue("Invalid document stream", document.getDocumentStream().getEncoding().equals("utf-8")); - CmsObject cmsObject = (CmsObject) persistenceManager.getObject(CmsObject.class, "/document1"); + CmsObjectImpl cmsObject = (CmsObjectImpl) persistenceManager.getObject(CmsObjectImpl.class, "/document1"); assertEquals("cmsObject name is incorrect", cmsObject.getName(), "anotherName"); assertEquals("cmsObject path is invalid", cmsObject.getPath(), "/document1"); @@ -135,7 +135,7 @@ //--------------------------------------------------------------------------------------------------------- // Insert cmsobjects //--------------------------------------------------------------------------------------------------------- - Document document = new Document(); + DocumentImpl document = new DocumentImpl(); document.setPath("/document1"); document.setName("document name 1"); document.setContentType("plain/text"); @@ -145,7 +145,7 @@ document.setDocumentStream(documentStream); persistenceManager.insert(document); - document = new Document(); + document = new DocumentImpl(); document.setPath("/document2"); document.setName("document name 2"); document.setContentType("plain/text"); @@ -155,7 +155,7 @@ document.setDocumentStream(documentStream); persistenceManager.insert(document); - document = new Document(); + document = new DocumentImpl(); document.setPath("/document3"); document.setName("document 3"); document.setContentType("plain/text"); @@ -165,13 +165,13 @@ document.setDocumentStream(documentStream); persistenceManager.insert(document); - Folder folder = new Folder(); + FolderImpl folder = new FolderImpl(); folder.setPath("/folder1"); folder.setName("folder1"); persistenceManager.insert(folder); - document = new Document(); + document = new DocumentImpl(); document.setName("document4"); document.setContentType("plain/text"); documentStream = new DocumentStream(); @@ -179,10 +179,10 @@ documentStream.setContent("Test Content 4".getBytes()); document.setDocumentStream(documentStream); - Folder subFolder = new Folder(); + FolderImpl subFolder = new FolderImpl(); subFolder.setName("subfolder"); - folder = new Folder(); + folder = new FolderImpl(); folder.setPath("/folder2"); folder.setName("folder2"); folder.addChild(document); @@ -201,94 +201,94 @@ // Retrieve Folders found on the root level //--------------------------------------------------------------------------------------------------------- QueryManager queryManager = persistenceManager.getQueryManager(); - Filter filter = queryManager.createFilter(Folder.class); + Filter filter = queryManager.createFilter(FolderImpl.class); Query query = queryManager.createQuery(filter); filter.setScope("/"); Collection result = persistenceManager.getObjects(query); assertEquals("Invalid number of folders found", result.size(), 2); - assertTrue("Invalid item in the collection", this.contains(result, "/folder1",Folder.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder2", Folder.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2", FolderImpl.class)); //--------------------------------------------------------------------------------------------------------- // Retrieve Documents //--------------------------------------------------------------------------------------------------------- queryManager = persistenceManager.getQueryManager(); - filter = queryManager.createFilter(Document.class); + filter = queryManager.createFilter(DocumentImpl.class); filter.addLike("name", "document name%"); query = queryManager.createQuery(filter); result = persistenceManager.getObjects(query); assertEquals("Invalid number of documents found", result.size(),2); - assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); //--------------------------------------------------------------------------------------------------------- // Retrieve folder2 //--------------------------------------------------------------------------------------------------------- - Folder folder2 = (Folder) persistenceManager.getObject(Folder.class, "/folder2"); + FolderImpl folder2 = (FolderImpl) persistenceManager.getObject(FolderImpl.class, "/folder2"); assertNotNull("folder 2 is null", folder2); assertEquals("Invalid number of cms object found in folder2 children", folder2.getChildren().size() ,2); - assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", Document.class)); - assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", Folder.class)); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class)); - CmsObject cmsObject = (CmsObject) persistenceManager.getObject(CmsObject.class, "/folder2"); + CmsObjectImpl cmsObject = (CmsObjectImpl) persistenceManager.getObject(CmsObjectImpl.class, "/folder2"); assertNotNull("folder 2 is null", cmsObject); - assertTrue("Invalid instance for folder 2", cmsObject instanceof Folder); + assertTrue("Invalid instance for folder 2", cmsObject instanceof FolderImpl); assertEquals("Invalid number of documents found in folder2 children", folder2.getChildren().size(),2); - assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", Document.class)); - assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", Folder.class)); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class)); //--------------------------------------------------------------------------------------------------------- // Retrieve Contents (ancestor of Documents) //--------------------------------------------------------------------------------------------------------- queryManager = persistenceManager.getQueryManager(); - filter = queryManager.createFilter(Content.class); + filter = queryManager.createFilter(ContentImpl.class); filter.addLike("name", "document name%"); query = queryManager.createQuery(filter); result = persistenceManager.getObjects(query); assertEquals("Invalid number of documents found", result.size(),2); - assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); //--------------------------------------------------------------------------------------------------------- // Retrieve all cmsobjects found on the root level //--------------------------------------------------------------------------------------------------------- queryManager = persistenceManager.getQueryManager(); - filter = queryManager.createFilter(CmsObject.class); + filter = queryManager.createFilter(CmsObjectImpl.class); filter.setScope("/"); query = queryManager.createQuery(filter); result = persistenceManager.getObjects(query); assertEquals("Invalid ancestor object found", result.size(),5); - assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/document3", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder1",Folder.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder2",Folder.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class)); //--------------------------------------------------------------------------------------------------------- // Retrieve all cmsobjects found anywhere //--------------------------------------------------------------------------------------------------------- queryManager = persistenceManager.getQueryManager(); - filter = queryManager.createFilter(CmsObject.class); + filter = queryManager.createFilter(CmsObjectImpl.class); query = queryManager.createQuery(filter); result = persistenceManager.getObjects(query); assertEquals("Invalid ancestor object found", result.size(),7); - assertTrue("Invalid item in the collection", this.contains(result, "/document1", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/document2", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/document3", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder2/document4", Document.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder1",Folder.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder2",Folder.class)); - assertTrue("Invalid item in the collection", this.contains(result, "/folder2/subfolder",Folder.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2/document4", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2/subfolder",FolderImpl.class)); } @@ -298,13 +298,13 @@ //--------------------------------------------------------------------------------------------------------- // Insert cmsobjects //--------------------------------------------------------------------------------------------------------- - Folder folder = new Folder(); + FolderImpl folder = new FolderImpl(); folder.setPath("/mainfolder"); folder.setName("Main folder"); for (int i=1; i<=100;i++) { - Document document = new Document(); + DocumentImpl document = new DocumentImpl(); document.setName("document" + i); document.setContentType("plain/text"); DocumentStream documentStream = new DocumentStream(); @@ -313,7 +313,7 @@ document.setDocumentStream(documentStream); folder.addChild(document); - Folder subFolder = new Folder(); + FolderImpl subFolder = new FolderImpl(); subFolder.setName("folder" + i); subFolder.addChild(document); folder.addChild(subFolder); @@ -327,14 +327,14 @@ //--------------------------------------------------------------------------------------------------------- // Retrieve Folder //--------------------------------------------------------------------------------------------------------- - folder = (Folder) persistenceManager.getObject(Folder.class,"/mainfolder"); + folder = (FolderImpl) persistenceManager.getObject(FolderImpl.class,"/mainfolder"); assertNotNull("Folder is null",folder); Collection children = folder.getChildren(); assertEquals("Invalid number of children", children.size(), 200); for (int i=1; i<=100;i++) { - assertTrue("Invalid item in the collection : " +"/mainfolder/document" + i , this.contains(children, "/mainfolder/document" + i,Document.class)); - assertTrue("Invalid item in the collection : " + "/mainfolder/folder" + i, this.contains(children, "/mainfolder/folder" + i, Folder.class)); + assertTrue("Invalid item in the collection : " +"/mainfolder/document" + i , this.contains(children, "/mainfolder/document" + i,DocumentImpl.class)); + assertTrue("Invalid item in the collection : " + "/mainfolder/folder" + i, this.contains(children, "/mainfolder/folder" + i, FolderImpl.class)); } Copied: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java (from r388968, incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtHierarchyTest.java) URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java?p2=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java&p1=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtHierarchyTest.java&r1=388968&r2=406118&rev=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerNtHierarchyTest.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java Sat May 13 08:08:04 2006 @@ -40,14 +40,14 @@ * * @author Christophe Lombart */ -public class PersistenceManagerNtHierarchyTest extends TestBase { - private final static Log log = LogFactory.getLog(PersistenceManagerNtHierarchyTest.class); +public class PersistenceManagerInheritanceHierarchyTest extends TestBase { + private final static Log log = LogFactory.getLog(PersistenceManagerInheritanceHierarchyTest.class); /** *

Defines the test case name for junit.

* @param testName The test case name. */ - public PersistenceManagerNtHierarchyTest(String testName) throws Exception { + public PersistenceManagerInheritanceHierarchyTest(String testName) throws Exception { super(testName); } @@ -55,7 +55,7 @@ public static Test suite() { // All methods starting with "test" will be executed in the test suite. return new RepositoryLifecycleTestSetup(new TestSuite( - PersistenceManagerNtHierarchyTest.class)); + PersistenceManagerInheritanceHierarchyTest.class)); } public void tearDown() throws Exception { Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceConcreteClassTest.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceConcreteClassTest.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceConcreteClassTest.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceConcreteClassTest.java Sat May 13 08:08:04 2006 @@ -0,0 +1,346 @@ +/* ======================================================================== + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== + */ +package org.apache.portals.graffito.jcr.persistence.impl; + +import java.util.Collection; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup; +import org.apache.portals.graffito.jcr.TestBase; +import org.apache.portals.graffito.jcr.persistence.PersistenceManager; +import org.apache.portals.graffito.jcr.query.Filter; +import org.apache.portals.graffito.jcr.query.Query; +import org.apache.portals.graffito.jcr.query.QueryManager; +import org.apache.portals.graffito.jcr.testmodel.Atomic; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentImpl; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentStream; +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.FolderImpl; +import org.apache.portals.graffito.jcr.testmodel.interfaces.CmsObject; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Content; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Document; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Folder; + +/** + * Test interface (with discreminator field) + * + * @author Christophe Lombart + */ +public class PersistenceManagerInterfaceConcreteClassTest extends TestBase { + private final static Log log = LogFactory.getLog(PersistenceManagerInterfaceConcreteClassTest.class); + + /** + *

Defines the test case name for junit.

+ * @param testName The test case name. + */ + public PersistenceManagerInterfaceConcreteClassTest(String testName) throws Exception { + super(testName); + + } + + public static Test suite() { + // All methods starting with "test" will be executed in the test suite. + return new RepositoryLifecycleTestSetup(new TestSuite( + PersistenceManagerInterfaceConcreteClassTest.class)); + } + + public void tearDown() throws Exception { + + cleanUpRepisotory(); + super.tearDown(); + + } + + + public void testRetrieveSingleton() { + + try { + PersistenceManager persistenceManager = this.getPersistenceManager(); + + //--------------------------------------------------------------------------------------------------------- + // Insert + //--------------------------------------------------------------------------------------------------------- + DocumentImpl documentImpl = new DocumentImpl(); + documentImpl.setPath("/document1"); + documentImpl.setName("document name"); + documentImpl.setContentType("plain/text"); + DocumentStream documentStream = new DocumentStream(); + documentStream.setEncoding("utf-8"); + documentStream.setContent("Test Content".getBytes()); + documentImpl.setDocumentStream(documentStream); + Document document = documentImpl; + + persistenceManager.insert(document); + persistenceManager.save(); + + //--------------------------------------------------------------------------------------------------------- + // Retrieve + //--------------------------------------------------------------------------------------------------------- + document = (Document) persistenceManager.getObject(Document.class, "/document1"); + assertTrue("Invalid implementation for Document", document instanceof DocumentImpl); + assertEquals("Document path is invalid", document.getPath(), "/document1"); + assertEquals("Content type is invalid", document.getContentType(), "plain/text"); + assertNotNull("document stream is null", document.getDocumentStream()); + assertTrue("Invalid document stream ", document.getDocumentStream().getEncoding().equals("utf-8")); + + //--------------------------------------------------------------------------------------------------------- + // Update a document + //--------------------------------------------------------------------------------------------------------- + document.setName("anotherName"); + persistenceManager.update(document); + persistenceManager.save(); + + // --------------------------------------------------------------------------------------------------------- + // Retrieve the updated descendant object + //--------------------------------------------------------------------------------------------------------- + document = (Document) persistenceManager.getObject(Document.class, "/document1"); + assertTrue("Invalid implementation for Document", document instanceof DocumentImpl); + assertEquals("document name is incorrect", document.getName(), "anotherName"); + assertEquals("Document path is invalid", document.getPath(), "/document1"); + assertEquals("Content type is invalid", document.getContentType(), "plain/text"); + assertNotNull("document stream is null", document.getDocumentStream()); + assertTrue("Invalid document stream", document.getDocumentStream().getEncoding().equals("utf-8")); + + CmsObject cmsObject = (CmsObject) persistenceManager.getObject(CmsObject.class, "/document1"); + assertEquals("cmsObject name is incorrect", cmsObject.getName(), "anotherName"); + assertEquals("cmsObject path is invalid", cmsObject.getPath(), "/document1"); + + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + + } + + + public void testRetrieveCollection() { + PersistenceManager persistenceManager = this.getPersistenceManager(); + + //--------------------------------------------------------------------------------------------------------- + // Insert cmsobjects + //--------------------------------------------------------------------------------------------------------- + DocumentImpl document = new DocumentImpl(); + document.setPath("/document1"); + document.setName("document name 1"); + document.setContentType("plain/text"); + DocumentStream documentStream = new DocumentStream(); + documentStream.setEncoding("utf-8"); + documentStream.setContent("Test Content".getBytes()); + document.setDocumentStream(documentStream); + persistenceManager.insert(document); + + document = new DocumentImpl(); + document.setPath("/document2"); + document.setName("document name 2"); + document.setContentType("plain/text"); + documentStream = new DocumentStream(); + documentStream.setEncoding("utf-8"); + documentStream.setContent("Test Content".getBytes()); + document.setDocumentStream(documentStream); + persistenceManager.insert(document); + + document = new DocumentImpl(); + document.setPath("/document3"); + document.setName("document 3"); + document.setContentType("plain/text"); + documentStream = new DocumentStream(); + documentStream.setEncoding("utf-8"); + documentStream.setContent("Test Content 3".getBytes()); + document.setDocumentStream(documentStream); + persistenceManager.insert(document); + + FolderImpl folder = new FolderImpl(); + folder.setPath("/folder1"); + folder.setName("folder1"); + persistenceManager.insert(folder); + + + document = new DocumentImpl(); + document.setName("document4"); + document.setContentType("plain/text"); + documentStream = new DocumentStream(); + documentStream.setEncoding("utf-8"); + documentStream.setContent("Test Content 4".getBytes()); + document.setDocumentStream(documentStream); + + FolderImpl subFolder = new FolderImpl(); + subFolder.setName("subfolder"); + + folder = new FolderImpl(); + folder.setPath("/folder2"); + folder.setName("folder2"); + folder.addChild(document); + folder.addChild(subFolder); + persistenceManager.insert(folder); + + + Atomic a = new Atomic(); + a.setPath("/atomic"); + a.setBooleanPrimitive(true); + persistenceManager.insert(a); + + persistenceManager.save(); + + //--------------------------------------------------------------------------------------------------------- + // Retrieve Folders found on the root level + //--------------------------------------------------------------------------------------------------------- + QueryManager queryManager = persistenceManager.getQueryManager(); + Filter filter = queryManager.createFilter(Folder.class); + Query query = queryManager.createQuery(filter); + filter.setScope("/"); + Collection result = persistenceManager.getObjects(query); + assertEquals("Invalid number of folders found", result.size(), 2); + assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2", FolderImpl.class)); + + + //--------------------------------------------------------------------------------------------------------- + // Retrieve Documents + //--------------------------------------------------------------------------------------------------------- + queryManager = persistenceManager.getQueryManager(); + filter = queryManager.createFilter(Document.class); + + filter.addLike("name", "document name%"); + query = queryManager.createQuery(filter); + + result = persistenceManager.getObjects(query); + assertEquals("Invalid number of documents found", result.size(),2); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); + + + //--------------------------------------------------------------------------------------------------------- + // Retrieve folder2 + //--------------------------------------------------------------------------------------------------------- + Folder folder2 = (Folder) persistenceManager.getObject(Folder.class, "/folder2"); + assertNotNull("folder 2 is null", folder2); + assertEquals("Invalid number of cms object found in folder2 children", folder2.getChildren().size() ,2); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class)); + + + CmsObject cmsObject = (CmsObject) persistenceManager.getObject(CmsObject.class, "/folder2"); + assertNotNull("folder 2 is null", cmsObject); + assertTrue("Invalid instance for folder 2", cmsObject instanceof FolderImpl); + assertEquals("Invalid number of documents found in folder2 children", folder2.getChildren().size(),2); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class)); + + //--------------------------------------------------------------------------------------------------------- + // Retrieve Contents (ancestor of Documents) + //--------------------------------------------------------------------------------------------------------- + queryManager = persistenceManager.getQueryManager(); + filter = queryManager.createFilter(Content.class); + filter.addLike("name", "document name%"); + query = queryManager.createQuery(filter); + + result = persistenceManager.getObjects(query); + assertEquals("Invalid number of documents found", result.size(),2); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); + + + //--------------------------------------------------------------------------------------------------------- + // Retrieve all cmsobjects found on the root level + //--------------------------------------------------------------------------------------------------------- + queryManager = persistenceManager.getQueryManager(); + filter = queryManager.createFilter(CmsObject.class); + filter.setScope("/"); + query = queryManager.createQuery(filter); + + result = persistenceManager.getObjects(query); + assertEquals("Invalid ancestor object found", result.size(),5); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class)); + + + //--------------------------------------------------------------------------------------------------------- + // Retrieve all cmsobjects found anywhere + //--------------------------------------------------------------------------------------------------------- + queryManager = persistenceManager.getQueryManager(); + filter = queryManager.createFilter(CmsObject.class); + query = queryManager.createQuery(filter); + + result = persistenceManager.getObjects(query); + assertEquals("Invalid ancestor object found", result.size(),7); + assertTrue("Invalid item in the collection", this.contains(result, "/document1", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document2", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/document3", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2/document4", DocumentImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder1",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2",FolderImpl.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/folder2/subfolder",FolderImpl.class)); + +} + + +public void testBeanCollection() { + PersistenceManager persistenceManager = this.getPersistenceManager(); + + //--------------------------------------------------------------------------------------------------------- + // Insert cmsobjects + //--------------------------------------------------------------------------------------------------------- + Folder folder = new FolderImpl(); + folder.setPath("/mainfolder"); + folder.setName("Main folder"); + + for (int i=1; i<=100;i++) + { + Document document = new DocumentImpl(); + document.setName("document" + i); + document.setContentType("plain/text"); + DocumentStream documentStream = new DocumentStream(); + documentStream.setEncoding("utf-8"); + documentStream.setContent("Test Content".getBytes()); + document.setDocumentStream(documentStream); + folder.addChild(document); + + Folder subFolder = new FolderImpl(); + subFolder.setName("folder" + i); + subFolder.addChild(document); + folder.addChild(subFolder); + + } + log.debug("Save the folder and its 200 children"); + persistenceManager.insert(folder); + persistenceManager.save(); + log.debug("End - Save the folder and its 200 children"); + + //--------------------------------------------------------------------------------------------------------- + // Retrieve Folder + //--------------------------------------------------------------------------------------------------------- + folder = (Folder) persistenceManager.getObject(Folder.class,"/mainfolder"); + assertNotNull("Folder is null",folder); + Collection children = folder.getChildren(); + assertEquals("Invalid number of children", children.size(), 200); + for (int i=1; i<=100;i++) + { + + assertTrue("Invalid item in the collection : " +"/mainfolder/document" + i , this.contains(children, "/mainfolder/document" + i,DocumentImpl.class)); + assertTrue("Invalid item in the collection : " + "/mainfolder/folder" + i, this.contains(children, "/mainfolder/folder" + i, FolderImpl.class)); + } +} + + +} \ No newline at end of file Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceHierarchyTest.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceHierarchyTest.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceHierarchyTest.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceHierarchyTest.java Sat May 13 08:08:04 2006 @@ -0,0 +1,195 @@ +/* ======================================================================== + * Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== + */ +package org.apache.portals.graffito.jcr.persistence.impl; + +import java.util.Collection; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup; +import org.apache.portals.graffito.jcr.TestBase; +import org.apache.portals.graffito.jcr.persistence.PersistenceManager; +import org.apache.portals.graffito.jcr.query.Filter; +import org.apache.portals.graffito.jcr.query.Query; +import org.apache.portals.graffito.jcr.query.QueryManager; +import org.apache.portals.graffito.jcr.testmodel.Atomic; +import org.apache.portals.graffito.jcr.testmodel.inheritance.AnotherDescendant; +import org.apache.portals.graffito.jcr.testmodel.inheritance.Descendant; +import org.apache.portals.graffito.jcr.testmodel.inheritance.SubDescendant; +import org.apache.portals.graffito.jcr.testmodel.interfaces.AnotherInterface; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Interface; + +/** + * Test interface (with discreminator field) + * + * @author Christophe Lombart + */ +public class PersistenceManagerInterfaceHierarchyTest extends TestBase { + private final static Log log = LogFactory.getLog(PersistenceManagerInterfaceHierarchyTest.class); + + /** + *

Defines the test case name for junit.

+ * @param testName The test case name. + */ + public PersistenceManagerInterfaceHierarchyTest(String testName) throws Exception { + super(testName); + + } + + public static Test suite() { + // All methods starting with "test" will be executed in the test suite. + return new RepositoryLifecycleTestSetup(new TestSuite( + PersistenceManagerInterfaceHierarchyTest.class)); + } + + public void tearDown() throws Exception { + + cleanUpRepisotory(); + super.tearDown(); + + } + + + public void testRetrieveSingleton() { + + try { + PersistenceManager persistenceManager = this.getPersistenceManager(); + + //--------------------------------------------------------------------------------------------------------- + // Insert + //--------------------------------------------------------------------------------------------------------- + AnotherDescendant anotherDescendant = new AnotherDescendant(); + anotherDescendant.setAnotherDescendantField("anotherDescendantValue"); + anotherDescendant.setAncestorField("ancestorValue"); + anotherDescendant.setPath("/test"); + persistenceManager.insert(anotherDescendant); + + persistenceManager.save(); + + //--------------------------------------------------------------------------------------------------------- + // Retrieve + //--------------------------------------------------------------------------------------------------------- + Interface result = (Interface) persistenceManager.getObject(Interface.class, "/test"); + assertNotNull("Object is null", result); + anotherDescendant = (AnotherDescendant) result; + + assertEquals("Descendant path is invalid", anotherDescendant.getPath(), "/test"); + assertEquals("Descendant ancestorField is invalid", anotherDescendant.getAncestorField(), "ancestorValue"); + assertEquals("Descendant descendantField is invalid", anotherDescendant .getAnotherDescendantField(), "anotherDescendantValue"); + + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + + } + + + public void testRetrieveCollection() { + + PersistenceManager persistenceManager = this.getPersistenceManager(); + + //--------------------------------------------------------------------------------------------------------- + // Insert descendant objects + //--------------------------------------------------------------------------------------------------------- + Descendant descendant = new Descendant(); + descendant.setDescendantField("descendantValue"); + descendant.setAncestorField("ancestorValue"); + descendant.setPath("/descendant1"); + persistenceManager.insert(descendant); + + descendant = new Descendant(); + descendant.setDescendantField("descendantValue2"); + descendant.setAncestorField("ancestorValue2"); + descendant.setPath("/descendant2"); + persistenceManager.insert(descendant); + + SubDescendant subDescendant = new SubDescendant(); + subDescendant.setDescendantField("descendantValue2"); + subDescendant.setAncestorField("ancestorValue2"); + subDescendant.setPath("/subdescendant"); + subDescendant.setSubDescendantField("subdescendantvalue"); + persistenceManager.insert(subDescendant); + + subDescendant = new SubDescendant(); + subDescendant.setDescendantField("descendantValue3"); + subDescendant.setAncestorField("ancestorValue2"); + subDescendant.setPath("/subdescendant2"); + subDescendant.setSubDescendantField("subdescendantvalue1"); + persistenceManager.insert(subDescendant); + + + AnotherDescendant anotherDescendant = new AnotherDescendant(); + anotherDescendant.setAnotherDescendantField("anotherDescendantValue"); + anotherDescendant.setAncestorField("ancestorValue3"); + anotherDescendant.setPath("/anotherdescendant1"); + persistenceManager.insert(anotherDescendant); + + anotherDescendant = new AnotherDescendant(); + anotherDescendant.setAnotherDescendantField("anotherDescendantValue"); + anotherDescendant.setAncestorField("ancestorValue4"); + anotherDescendant.setPath("/anotherdescendant2"); + persistenceManager.insert(anotherDescendant); + + anotherDescendant = new AnotherDescendant(); + anotherDescendant.setAnotherDescendantField("anotherDescendantValue2"); + anotherDescendant.setAncestorField("ancestorValue5"); + anotherDescendant.setPath("/anotherdescendant3"); + persistenceManager.insert(anotherDescendant); + + + Atomic a = new Atomic(); + a.setPath("/atomic"); + a.setBooleanPrimitive(true); + persistenceManager.insert(a); + + persistenceManager.save(); + + //--------------------------------------------------------------------------------------------------------- + // Retrieve Descendant class (implements Interface.class) + //--------------------------------------------------------------------------------------------------------- + QueryManager queryManager = persistenceManager.getQueryManager(); + Filter filter = queryManager.createFilter(Interface.class); + Query query = queryManager.createQuery(filter); + + Collection result = persistenceManager.getObjects(query); + assertEquals("Invalid number of interface found", result.size(),3); + assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant1", AnotherDescendant.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant2", AnotherDescendant.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/anotherdescendant3", AnotherDescendant.class)); + + + //--------------------------------------------------------------------------------------------------------- + // Retrieve Descendant class and its children (implements AnotherInterface.class) + //--------------------------------------------------------------------------------------------------------- + queryManager = persistenceManager.getQueryManager(); + filter = queryManager.createFilter(AnotherInterface.class); + query = queryManager.createQuery(filter); + + result = persistenceManager.getObjects(query); + assertEquals("Invalid number of interface found", result.size(),4); + assertTrue("Invalid item in the collection", this.contains(result, "/descendant1", Descendant.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/descendant2", Descendant.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant",SubDescendant.class)); + assertTrue("Invalid item in the collection", this.contains(result, "/subdescendant2",SubDescendant.class)); + + } + +} \ No newline at end of file Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/AnotherDescendant.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/AnotherDescendant.java?rev=406118&r1=406117&r2=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/AnotherDescendant.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/AnotherDescendant.java Sat May 13 08:08:04 2006 @@ -15,7 +15,9 @@ */ package org.apache.portals.graffito.jcr.testmodel.inheritance; -public class AnotherDescendant extends Ancestor { +import org.apache.portals.graffito.jcr.testmodel.interfaces.Interface; + +public class AnotherDescendant extends Ancestor implements Interface{ protected String anotherDescendantField; Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Descendant.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Descendant.java?rev=406118&r1=406117&r2=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Descendant.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/Descendant.java Sat May 13 08:08:04 2006 @@ -15,7 +15,9 @@ */ package org.apache.portals.graffito.jcr.testmodel.inheritance; -public class Descendant extends Ancestor { +import org.apache.portals.graffito.jcr.testmodel.interfaces.AnotherInterface; + +public class Descendant extends Ancestor implements AnotherInterface { protected String descendantField; Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/CmsObjectImpl.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/CmsObjectImpl.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/CmsObjectImpl.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/CmsObjectImpl.java Sat May 13 08:08:04 2006 @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.inheritance.impl; + +import org.apache.portals.graffito.jcr.testmodel.interfaces.CmsObject; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Folder; + + + +/** + * CmsObject test + * + * @author Christophe Lombart + * + * + */ +public class CmsObjectImpl implements CmsObject +{ + + protected String path; + protected String name; + protected Folder parentFolder; + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObject#getName() + */ + public String getName() { + return name; + } + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObject#setName(java.lang.String) + */ + public void setName(String name) { + this.name = name; + } + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObject#getPath() + */ + public String getPath() { + return path; + } + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObject#setPath(java.lang.String) + */ + public void setPath(String path) { + this.path = path; + } + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObject#getParentFolder() + */ + public Folder getParentFolder() { + return parentFolder; + } + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObject#setParentFolder(org.apache.portals.graffito.jcr.testmodel.inheritance.impl.FolderImpl) + */ + public void setParentFolder(Folder parentFolder) { + this.parentFolder = parentFolder; + } + + + + +} Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/ContentImpl.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/ContentImpl.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/ContentImpl.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/ContentImpl.java Sat May 13 08:08:04 2006 @@ -0,0 +1,34 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.inheritance.impl; + +import org.apache.portals.graffito.jcr.testmodel.interfaces.Content; + + + + + +/** + * Content object + * + * @author Christophe Lombart + * + */ +public abstract class ContentImpl extends CmsObjectImpl implements Content +{ +} + + Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentImpl.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentImpl.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentImpl.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentImpl.java Sat May 13 08:08:04 2006 @@ -0,0 +1,88 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.inheritance.impl; + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Document; + +/** + * CMS VersionnedDocument implementation. + * + * @author Christophe Lombart + * + */ +public class DocumentImpl extends ContentImpl implements Document +{ + protected final static Log log = LogFactory.getLog(DocumentImpl.class); + + protected long size; + protected String contentType; + + protected DocumentStream documentStream; + + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Document#getContentType() + */ + public String getContentType() + { + return this.contentType; + } + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Document#setContentType(java.lang.String) + */ + public void setContentType(String contentType) + { + this.contentType = contentType; + } + + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Document#getSize() + */ + public long getSize() + { + return size; + } + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Document#setSize(long) + */ + public void setSize(long size) + { + this.size = size; + } + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Document#getDocumentStream() + */ + public DocumentStream getDocumentStream() { + return documentStream; + } + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Document#setDocumentStream(org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentStream) + */ + public void setDocumentStream(DocumentStream documentStream) { + this.documentStream = documentStream; + } + + +} + Copied: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentStream.java (from r390238, incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java) URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentStream.java?p2=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentStream.java&p1=incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java&r1=390238&r2=406118&rev=406118&view=diff ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/DocumentStream.java (original) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/DocumentStream.java Sat May 13 08:08:04 2006 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.portals.graffito.jcr.testmodel.inheritance; +package org.apache.portals.graffito.jcr.testmodel.inheritance.impl; import java.io.ByteArrayInputStream; Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/FolderImpl.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/FolderImpl.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/FolderImpl.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/inheritance/impl/FolderImpl.java Sat May 13 08:08:04 2006 @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.inheritance.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.portals.graffito.jcr.testmodel.interfaces.CmsObject; +import org.apache.portals.graffito.jcr.testmodel.interfaces.Folder; + + + + +/** + * CMS Folder Test + * + * @author Christophe Lombart + * @version $Id: Folder.java,v 1.1 2004/12/22 20:36:59 christophe Exp $ + */ +public class FolderImpl extends CmsObjectImpl implements Folder +{ + + protected List children = new ArrayList(); + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Folder#getChildren() + */ + public List getChildren() { + return children; + } + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Folder#setChildren(java.util.List) + */ + public void setChildren(List children) { + this.children = children; + } + + /* (non-Javadoc) + * @see org.apache.portals.graffito.jcr.testmodel.inheritance.impl.Folder#addChild(org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl) + */ + public void addChild(CmsObject child) + { + children.add(child); + } +} + Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/AnotherInterface.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/AnotherInterface.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/AnotherInterface.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/AnotherInterface.java Sat May 13 08:08:04 2006 @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.interfaces; + +public interface AnotherInterface +{ + +} Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/CmsObject.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/CmsObject.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/CmsObject.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/CmsObject.java Sat May 13 08:08:04 2006 @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.interfaces; + +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.FolderImpl; + + + +public interface CmsObject { + + public String getName(); + + public void setName(String name); + + public String getPath(); + + public void setPath(String path); + + public Folder getParentFolder(); + + public void setParentFolder(Folder parentFolder); + +} \ No newline at end of file Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Content.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Content.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Content.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Content.java Sat May 13 08:08:04 2006 @@ -0,0 +1,20 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.interfaces; + +public interface Content extends CmsObject { + +} \ No newline at end of file Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Document.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Document.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Document.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Document.java Sat May 13 08:08:04 2006 @@ -0,0 +1,48 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.interfaces; + +import org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentStream; + +public interface Document extends Content { + + /** + * @see org.apache.portals.graffito.model.DocumentImpl#getContentType() + */ + public String getContentType(); + + /** + * @see org.apache.portals.graffito.model.DocumentImpl#setContentType(java.lang.String) + */ + public void setContentType(String contentType); + + /** + * + * @see org.apache.portals.graffito.model.DocumentImpl#getSize() + */ + public long getSize(); + + /** + * + * @see org.apache.portals.graffito.model.DocumentImpl#setSize(long) + */ + public void setSize(long size); + + public DocumentStream getDocumentStream(); + + public void setDocumentStream(DocumentStream documentStream); + +} \ No newline at end of file Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Folder.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Folder.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Folder.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Folder.java Sat May 13 08:08:04 2006 @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.interfaces; + +import java.util.List; + +public interface Folder extends CmsObject{ + + public List getChildren(); + + public void setChildren(List children); + + public void addChild(CmsObject child); + +} \ No newline at end of file Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Interface.java URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Interface.java?rev=406118&view=auto ============================================================================== --- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Interface.java (added) +++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/interfaces/Interface.java Sat May 13 08:08:04 2006 @@ -0,0 +1,21 @@ +/* + * Copyright 2000-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.portals.graffito.jcr.testmodel.interfaces; + +public interface Interface +{ + +}