Package org.apache.jackrabbit.ocm.mapper.impl.digester

Examples of org.apache.jackrabbit.ocm.mapper.impl.digester.DigesterMapperImpl


   * Test interface setting
   */
  public void testInterfaceWithDiscriminator() {
    try {
      String[] files = {"./src/test/test-config/jcrmapping-inheritance.xml"};
      Mapper mapper = new DigesterMapperImpl(files);

      assertNotNull("Mapper is null", mapper);
      ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(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.jackrabbit.ocm.testmodel.inheritance.AnotherDescendant");
      assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
      assertFalse("Incalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
     
      classDescriptor = mapper.getClassDescriptorByClass(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.jackrabbit.ocm.testmodel.interfaces.Interface");
View Full Code Here


   */
  public void testInterfaceWithoutDiscriminator()
  {
    try {
      String[] files = {"./src/test/test-config/jcrmapping-inheritance.xml"};
      Mapper mapper = new DigesterMapperImpl(files);

      assertNotNull("Mapper is null", mapper);
      ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(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.getClassDescriptorByClass(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.getClassDescriptorByClass(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);       
View Full Code Here

   */
  public void testProxy() {
    try {
      String[] files = { "./src/test/test-config/jcrmapping-proxy.xml" };

      Mapper mapper = new DigesterMapperImpl(files);
      assertNotNull("Mapper is null", mapper);

      ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(Main.class);
      assertNotNull("ClassDescriptor is null", classDescriptor);
      assertTrue("Invalid proxy setting for bean field proxyDetail ", classDescriptor.getBeanDescriptor("proxyDetail").isProxy());
      assertFalse("Invalid proxy setting for bean field detail  ", classDescriptor.getBeanDescriptor("detail").isProxy());
      assertTrue("Invalid proxy setting for collection field proxyDetail ", classDescriptor.getCollectionDescriptor("proxyCollection").isProxy());
     
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.mapper.impl.digester.DigesterMapperImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.