Package org.jboss.ws.metadata.wsdl.xsd

Examples of org.jboss.ws.metadata.wsdl.xsd.SchemaUtils


    * and an array of a custom type
    * @throws Exception
    */
   public void testCustomTypesArraySchema() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      String typeNS = "http://org.jboss/types";
      String arrTypeNS = "http://org.jboss/types/arrays/org/jboss/test/ws/tools/jbws_161/custom";

      Map map = new HashMap();
      map.put(typeNS,new File("resources/tools/wsdlfixture/customtype/CustomTypeObj.xsd").toURL());
      map.put(arrTypeNS,new File("resources/tools/wsdlfixture/customtype/CustomTypeArrays.xsd").toURL());

      XSModel xsmodel = new JavaToXSD().parseSchema(map);
      assertNotNull("XSModel is null?", xsmodel);

      XSNamedMap xsnamedmap = getXSNamedMap(xsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      XSObject xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

      xsnamedmap = getXSNamedMap(xsmodel, arrTypeNS);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObjArray", xobj.getName());
      assertTrue("HelloObjArray is a complex type?",xobj instanceof XSComplexTypeDefinition);
      XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) xobj;
      XSModelGroupImpl sequence = (XSModelGroupImpl) complexType.getParticle().getTerm();
      XSElementDecl valueElement = (XSElementDecl) ((XSParticleDecl) sequence.getParticles().item(0)).getTerm();
      String name = valueElement.getTypeDefinition().getName();

      assertEquals("HelloObj", name);

      //Test the case when the schema files are parsed one by one
      XSModel newxsmodel = utils.parseSchema("resources/tools/wsdlfixture/customtype/CustomTypeObj.xsd");
      assertNotNull("XSModel is null?", newxsmodel);
      xsnamedmap = getXSNamedMap(newxsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

      newxsmodel = utils.parseSchema("resources/tools/wsdlfixture/customtype/CustomTypeArrays.xsd");
      assertNotNull("XSModel is null?", newxsmodel);
      xsnamedmap = getXSNamedMap(newxsmodel, arrTypeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
View Full Code Here


   }

   public void testJBossXBSchemaParsing() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      String typeNS = "http://org.jboss/types";
      String arrTypeNS = "http://org.jboss/types/arrays/org/jboss/test/ws/tools/jbws_161/custom";
      String arr[] = {"resources/tools/wsdlfixture/customtype/CustomTypeObj.xsd",
                      "resources/tools/wsdlfixture/customtype/CustomTypeArrays.xsd"};
      XSLoader xsloader = utils.getXSLoader();
      Map map = new HashMap();
      map.put(typeNS,new File("resources/tools/wsdlfixture/customtype/CustomTypeObj.xsd").toURL());
      map.put(arrTypeNS,new File("resources/tools/wsdlfixture/customtype/CustomTypeArrays.xsd").toURL());

      ((XMLSchemaLoader)xsloader).setEntityResolver(new JBossXSEntityResolver(new JBossWSEntityResolver(), map));
View Full Code Here

      super.setUp();
   }

   public void testCircularReferences() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      File f = new File("resources/jaxrpc/xop/circular.xsd");
      assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());

      XSModel xsModel = utils.parseSchema(f.toURL());
      assertNotNull(xsModel);
      WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://complex.jsr181.jaxws.ws.test.jboss.org/jaws");
      JBossXSModel schemaModel = wsUtil.getJBossXSModel(xsModel);

      XSTypeDefinition xsType = schemaModel.getTypeDefinition("Customer", "http://complex.jsr181.jaxws.ws.test.jboss.org/jaws");
View Full Code Here

      }
   }

   public void testXOPElementScan() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      File f = new File("resources/jaxrpc/xop/schema.xsd");
      assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());

      XSModel xsModel = utils.parseSchema(f.toURL());
      assertNotNull(xsModel);
      WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://jboss.org/test/ws/xop/doclit");
      JBossXSModel schemaModel = wsUtil.getJBossXSModel(xsModel);

      // test custom binary declaration
View Full Code Here

   }

   public void testMSFTElementScan() throws Exception
   {     

      SchemaUtils utils = SchemaUtils.getInstance();
      File f = new File("resources/jaxrpc/xop/schema.xsd");
      assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());

      XSModel xsModel = utils.parseSchema(f.toURL());
      assertNotNull(xsModel);
      WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://jboss.org/test/ws/xop/doclit");
      JBossXSModel schemaModel = wsUtil.getJBossXSModel(xsModel);

      XSTypeDefinition xsType = schemaModel.getTypeDefinition(">MSFTBinary", "http://jboss.org/test/ws/xop/doclit");
View Full Code Here

    * and an array of a custom type
    * @throws Exception
    */
   public void testCustomTypesArraySchema() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      String typeNS = "http://org.jboss/types";
      String arrTypeNS = "http://org.jboss/types/arrays/org/jboss/test/ws/tools/jbws_161/custom";

      Map map = new HashMap();
      map.put(typeNS,getResourceURL("/tools/wsdlfixture/customtype/CustomTypeObj.xsd"));
      map.put(arrTypeNS,getResourceURL("/tools/wsdlfixture/customtype/CustomTypeArrays.xsd"));

      XSModel xsmodel = new JavaToXSD().parseSchema(map);
      assertNotNull("XSModel is null?", xsmodel);

      XSNamedMap xsnamedmap = getXSNamedMap(xsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      XSObject xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

      xsnamedmap = getXSNamedMap(xsmodel, arrTypeNS);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObjArray", xobj.getName());
      assertTrue("HelloObjArray is a complex type?",xobj instanceof XSComplexTypeDefinition);
      XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) xobj;
      XSModelGroupImpl sequence = (XSModelGroupImpl) complexType.getParticle().getTerm();
      XSElementDecl valueElement = (XSElementDecl) ((XSParticleDecl) sequence.getParticles().item(0)).getTerm();
      String name = valueElement.getTypeDefinition().getName();

      assertEquals("HelloObj", name);

      //Test the case when the schema files are parsed one by one
      XSModel newxsmodel = utils.parseSchema(getResourceFile("tools/wsdlfixture/customtype/CustomTypeObj.xsd").getAbsolutePath());
      assertNotNull("XSModel is null?", newxsmodel);
      xsnamedmap = getXSNamedMap(newxsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

      newxsmodel = utils.parseSchema(getResourceFile("tools/wsdlfixture/customtype/CustomTypeArrays.xsd").getAbsolutePath());
      assertNotNull("XSModel is null?", newxsmodel);
      xsnamedmap = getXSNamedMap(newxsmodel, arrTypeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
View Full Code Here

   }

   public void testJBossXBSchemaParsing() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      String typeNS = "http://org.jboss/types";
      String arrTypeNS = "http://org.jboss/types/arrays/org/jboss/test/ws/tools/jbws_161/custom";
      String arr[] = {getResourceFile("tools/wsdlfixture/customtype/CustomTypeObj.xsd").getAbsolutePath(),
                      getResourceFile("tools/wsdlfixture/customtype/CustomTypeArrays.xsd").getAbsolutePath()};
      XSLoader xsloader = utils.getXSLoader();
      Map map = new HashMap();
      map.put(typeNS,getResourceURL("/tools/wsdlfixture/customtype/CustomTypeObj.xsd"));
      map.put(arrTypeNS,getResourceURL("/tools/wsdlfixture/customtype/CustomTypeArrays.xsd"));

      ((XMLSchemaLoader)xsloader).setEntityResolver(new JBossXSEntityResolver(new JBossWSEntityResolver(), map));
View Full Code Here

*/
public class XOPTypeDefTestCase extends JBossWSTest
{
   public void testCircularReferences() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      File f = getResourceFile("jaxrpc/xop/circular.xsd");
      assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());

      XSModel xsModel = utils.parseSchema(f.toURL());
      assertNotNull(xsModel);
      WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://complex.jsr181.jaxws.ws.test.jboss.org/jaws");
      JBossXSModel schemaModel = wsUtil.getJBossXSModel(xsModel);

      XSTypeDefinition xsType = schemaModel.getTypeDefinition("Customer", "http://complex.jsr181.jaxws.ws.test.jboss.org/jaws");
View Full Code Here

      }
   }

   public void testXOPElementScan() throws Exception
   {
      SchemaUtils utils = SchemaUtils.getInstance();
      File f = getResourceFile("jaxrpc/xop/schema.xsd");
      assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());

      XSModel xsModel = utils.parseSchema(f.toURL());
      assertNotNull(xsModel);
      WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://jboss.org/test/ws/xop/doclit");
      JBossXSModel schemaModel = wsUtil.getJBossXSModel(xsModel);

      // test custom binary declaration
View Full Code Here

   }

   public void testMSFTElementScan() throws Exception
   {

      SchemaUtils utils = SchemaUtils.getInstance();
      File f = getResourceFile("jaxrpc/xop/schema.xsd");
      assertTrue("Unable to load schema file " + f.getAbsolutePath(), f.exists());

      XSModel xsModel = utils.parseSchema(f.toURL());
      assertNotNull(xsModel);
      WSSchemaUtils wsUtil = WSSchemaUtils.getInstance(new NamespaceRegistry(), "http://jboss.org/test/ws/xop/doclit");
      JBossXSModel schemaModel = wsUtil.getJBossXSModel(xsModel);

      XSTypeDefinition xsType = schemaModel.getTypeDefinition(">MSFTBinary", "http://jboss.org/test/ws/xop/doclit");
View Full Code Here

TOP

Related Classes of org.jboss.ws.metadata.wsdl.xsd.SchemaUtils

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.