Package org.codehaus.enunciate.contract.jaxb

Examples of org.codehaus.enunciate.contract.jaxb.RootElementDeclaration


      }
      else {
        debug("%s is a potential schema type definition, but we're not going to add it directly to the model. (It could still be indirectly added, though.)", typeDef.getQualifiedName());
      }

      RootElementDeclaration rootElement = createRootElementDeclaration((ClassDeclaration) typeDef.getDelegate(), typeDef);
      if (rootElement != null) {
        debug("%s to be considered as a root element", typeDef.getQualifiedName());
        model.add(rootElement);
      }
    }
View Full Code Here


  public RootElementDeclaration createRootElementDeclaration(ClassDeclaration declaration, TypeDefinition typeDefinition) {
    if (!isRootSchemaElement(declaration)) {
      return null;
    }
    else {
      return new RootElementDeclaration(declaration, typeDefinition);
    }
  }
View Full Code Here

  /**
   * tests the explicit web fault.
   */
  public void testExplicitWebFault() throws Exception {
    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    model.add(new RootElementDeclaration((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.BeanThree"), null));
    FreemarkerModel.set(model);
    WebFault webFault = new WebFault((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.services.ExplicitFaultBean"));
    assertNotNull(webFault.getExplicitFaultBeanType());
    assertEquals("ExplicitFaultBean", webFault.getMessageName());
    assertNull(webFault.getElementName());
View Full Code Here

    };
    FreemarkerModel.set(model);
    int nsCount = model.getNamespacesToPrefixes().size();
    ClassDeclaration declaration = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.BeanThree");
    TypeDefinition typeDef1 = new ComplexTypeDefinition(declaration);
    RootElementDeclaration element1 = new RootElementDeclaration(declaration, typeDef1);
    String targetNamespace = element1.getNamespace();
    assertNull(model.findRootElementDeclaration(element1));
    model.add(element1);
    SchemaInfo schemaInfo = model.getNamespacesToSchemas().get(targetNamespace);
    assertNull("The element form default should not have been set.", schemaInfo.getElementFormDefault());
    assertNull("The attribute form default should not have been set.", schemaInfo.getAttributeFormDefault());
    assertNotNull("The model should have created a schema information associated with a new type definition.", schemaInfo);
    assertTrue(model.rootElements.contains(element1));
    assertNotNull(model.findRootElementDeclaration(element1));
    assertEquals(targetNamespace, schemaInfo.getNamespace());

    nsCount += 1;
    assertEquals("There should have been one and only one new namespace added", nsCount, model.getNamespacesToPrefixes().size());

    declaration = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanThree");
    ComplexTypeDefinition typeDef2 = new ComplexTypeDefinition(declaration);
    RootElementDeclaration element2 = new RootElementDeclaration(declaration, typeDef2);
    targetNamespace = element2.getNamespace();
    assertNull(model.findRootElementDeclaration(element2));
    model.add(element2);
    schemaInfo = model.getNamespacesToSchemas().get(targetNamespace);
    assertNotNull("The model should have created a schema information associated with a new type definition.", schemaInfo);
    assertTrue(model.rootElements.contains(element2));
    assertNotNull(model.findRootElementDeclaration(element2));
    assertEquals(targetNamespace, schemaInfo.getNamespace());
    assertEquals("qualified", schemaInfo.getElementFormDefault());
    assertEquals("qualified", schemaInfo.getAttributeFormDefault());
    nsCount += 3;
    assertEquals("There should have been three new namespaces added, as specified in the package info for the schema.", nsCount, model.getNamespacesToPrefixes().size());

    declaration = (ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanFour");
    ComplexTypeDefinition typeDef3 = new ComplexTypeDefinition(declaration);
    RootElementDeclaration element3 = new RootElementDeclaration(declaration, typeDef3);
    targetNamespace = element3.getNamespace();
    assertNull(model.findRootElementDeclaration(element3));
    model.add(element3);
    schemaInfo = model.getNamespacesToSchemas().get(targetNamespace);
    assertNotNull("The model should have created a schema information associated with a new type definition.", schemaInfo);
    assertTrue(model.rootElements.contains(element3));
View Full Code Here

    FreemarkerModel.set(model);

    final ComplexTypeDefinition beanThree = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanThree"));
    final ComplexTypeDefinition beanFour = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanFour"));
    final ComplexTypeDefinition simpleTypeComplexContentBean = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.SimpleTypeComplexContentBean"));
    final RootElementDeclaration beanThreeElement = new RootElementDeclaration((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanThree"), beanThree);
    final RootElementDeclaration beanFourElement = new RootElementDeclaration((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanFour"), beanFour);

    SchemaInfo schemaInfo = new SchemaInfo() {
      @Override
      public Collection<TypeDefinition> getTypeDefinitions() {
        return Arrays.asList((TypeDefinition) beanThree, beanFour, simpleTypeComplexContentBean);
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.contract.jaxb.RootElementDeclaration

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.