Package org.uddi.api_v2

Examples of org.uddi.api_v2.TModel


    public void CreateTmodelnoKeyGen() throws DispositionReportFaultMessage, RemoteException {
        System.out.println("CreateTmodelnoKeyGen");

        SaveTModel st = new SaveTModel();
        st.setAuthInfo(authInfoJoe);
        TModel tm = new TModel();
        tm.setName(new Name());
        tm.getName().setValue("My Cool Company's tmodel");
        tm.getName().setLang("en");

        tm.setTModelKey("uddi:uddi.joepublisher.com:nokeygenerator:customkey");
        st.getTModel().add(tm);
        try {
          @SuppressWarnings("unused")
            TModelDetail saveTModel = publication.saveTModel(st);
            Assert.fail("request should have been rejected");
View Full Code Here


    @Test
    public void testSignTmodel() throws CertificateException {
        Default();
        System.out.println("testSignTmodel signing");
        TModel be = new TModel();
        be.setTModelKey("uddi:juddi.apache.org:testkey");

        be.getDescription().add(new Description("a description", "en"));
        be.setName(new Name("My biz", "en"));

        TModel signUDDI_JAXBObject = ds.signUddiEntity(be);
        Assert.assertNotSame("items are the same", be, signUDDI_JAXBObject);
        //System.out.println("verifing");
        AtomicReference<String> msg = new AtomicReference<String>();
        boolean verifySigned_UDDI_JAXB_Object = ds.verifySignedUddiEntity(signUDDI_JAXBObject, msg);
        if (verifySigned_UDDI_JAXB_Object) {
            //System.out.println("signature validation passed (expected)");
        } else {
            System.out.println("signature validation failed (not expected)");
            Assert.fail(msg.get());
        }
        validAllSignatureElementsArePresent(signUDDI_JAXBObject.getSignature());
    }
View Full Code Here

    public void CreateKeyGenMaxLengthTest() throws DispositionReportFaultMessage, RemoteException {
        System.out.println("CreateKeyGenMaxLengthTest");

        SaveTModel st = new SaveTModel();
        st.setAuthInfo(authInfoJoe);
        TModel tm = new TModel();
        tm.setName(new Name());
        tm.getName().setValue("My Cool Company Keymodel generator");
        tm.getName().setLang("en");
        tm.setCategoryBag(new CategoryBag());
        KeyedReference kr = new KeyedReference();
        kr.setTModelKey("uddi:uddi.org:categorization:types");
        kr.setKeyName("uddi-org:keyGenerator");
        kr.setKeyValue("keyGenerator");
        tm.getCategoryBag().getKeyedReference().add(kr);
        tm.setTModelKey(validTmodelKeyGenMax);
        st.getTModel().add(tm);
       
        @SuppressWarnings("unused")
    TModelDetail saveTModel = publication.saveTModel(st);
        DeleteTModel dm = new DeleteTModel();
View Full Code Here

                Set<TModel> portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
                tModels.addAll(portTypeTModels);

                Assert.assertEquals(1, tModels.size());

                TModel tModel = tModels.iterator().next();
                System.out.println("UDDI PortType TModel " + tModel.getName().getValue());
                if (serialize) {
                        System.out.println(pTModel.print(tModel));
                }

                //now compare to the spec example
                String porttypeXml = "wsdl/uddiv3-xml/3_2_1_porttype.xml";
                TModel specTModel = (org.uddi.api_v3.TModel) EntityCreator.buildFromDoc(porttypeXml, EntityCreator.UDDIv3_Package);

                //making sure the names are the same
                Assert.assertEquals(specTModel.getName().getValue(), tModel.getName().getValue());
                //We should have a overviewDoc with one overviewURL which should end with "/sample.wsdl"
                Assert.assertNotNull(tModel.getOverviewDoc());
                Assert.assertEquals(1, tModel.getOverviewDoc().size());
                Assert.assertNotNull(tModel.getOverviewDoc().get(0).getOverviewURL());

                Assert.assertTrue(specTModel.getOverviewDoc().get(0).getOverviewURL().getValue().endsWith("/sample.wsdl"));
                Assert.assertTrue(tModel.getOverviewDoc().get(0).getOverviewURL().getValue().endsWith("/sample.wsdl"));

                //We should have a categoryBag with 2 keyedReferences
                Assert.assertNotNull(tModel.getCategoryBag());
                Assert.assertNotNull(tModel.getCategoryBag().getKeyedReference());
                Assert.assertEquals(2, tModel.getCategoryBag().getKeyedReference().size());
                for (KeyedReference keyedReference : tModel.getCategoryBag().getKeyedReference()) {
                        boolean match = false;
                        Iterator<KeyedReference> iter = specTModel.getCategoryBag().getKeyedReference().iterator();
                        while (iter.hasNext() && match == false) {
                                KeyedReference specKeyedRef = iter.next();
                                if (specKeyedRef.getTModelKey().equals(keyedReference.getTModelKey())) {
                                        match = true;
                                        Assert.assertEquals(specKeyedRef.getKeyName(), keyedReference.getKeyName());
View Full Code Here

                Set<TModel> tModels = wsdl2UDDI.createWSDLBindingTModels(wsdlURL, bindings);

                //Now check
                Assert.assertEquals(1, tModels.size());

                TModel tModel = tModels.iterator().next();
                System.out.println("UDDI Binding TModel " + tModel.getName().getValue());
                if (serialize) {
                        System.out.println(pTModel.print(tModel));
                }

                //Compare to the spec example
                String bindingtmodelXml = "wsdl/uddiv3-xml/3_2_2_bindingtmodel.xml";
                TModel specTModel = (org.uddi.api_v3.TModel) EntityCreator.buildFromDoc(bindingtmodelXml, EntityCreator.UDDIv3_Package);

                //Make sure the names are the same
                Assert.assertEquals(specTModel.getName().getValue(), tModel.getName().getValue());
                //We should have a overviewDoc with one overviewURL which should end with "/sample.wsdl"
                Assert.assertNotNull(tModel.getOverviewDoc());
                Assert.assertEquals(1, tModel.getOverviewDoc().size());
                Assert.assertNotNull(tModel.getOverviewDoc().get(0).getOverviewURL());

                //We should have a categoryBag with 6 keyedReferences
                Assert.assertNotNull(tModel.getCategoryBag());
                Assert.assertNotNull(tModel.getCategoryBag().getKeyedReference());
                Assert.assertEquals(6, tModel.getCategoryBag().getKeyedReference().size());
                for (KeyedReference keyedReference : tModel.getCategoryBag().getKeyedReference()) {
                        boolean match = false;
                        Iterator<KeyedReference> iter = specTModel.getCategoryBag().getKeyedReference().iterator();
                        while (iter.hasNext() && match == false) {
                                KeyedReference specKeyedRef = iter.next();
                                if (specKeyedRef.getTModelKey().equals(keyedReference.getTModelKey())) {
                                        match = true;
                                        Assert.assertEquals(specKeyedRef.getKeyName(), keyedReference.getKeyName());
View Full Code Here

                //Register a tModel for each portType
                for (QName qName : bindings.keySet()) {
                        String localpart = qName.getLocalPart();
                        String namespace = qName.getNamespaceURI();
                        // Build the tModel
                        TModel tModel = new TModel();
                        // Set the Key
                        tModel.setTModelKey(keyDomainURI + localpart);
                        // Set the Name
                        Name name = new Name();
                        name.setLang(lang);
                        name.setValue(localpart);
                        tModel.setName(name);
                        // Set the OverviewURL
                        OverviewURL overviewURL = new OverviewURL();
                        overviewURL.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
                        overviewURL.setValue(wsdlURL);
                        OverviewDoc overviewDoc = new OverviewDoc();
                        overviewDoc.setOverviewURL(overviewURL);
                        tModel.getOverviewDoc().add(overviewDoc);
                        // Set the categoryBag
                        CategoryBag categoryBag = new CategoryBag();

                        if (namespace != null && !"".equals(namespace)) {
                                // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                                KeyedReference namespaceReference = newKeyedReference(
                                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
                                categoryBag.getKeyedReference().add(namespaceReference);
                        }

                        // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                        KeyedReference typesReference = newKeyedReference(
                                "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding");
                        categoryBag.getKeyedReference().add(typesReference);

            // A keyedReference with a tModelKey of the WSDL portType Reference category system and a keyValue
                        // of the tModelKey that models the wsdl:portType to which the wsdl:binding relates.
                        Binding binding = bindings.get(qName);
                        String portTypeKey = keyDomainURI + binding.getPortType().getQName().getLocalPart();
                        KeyedReference namespaceReference = newKeyedReference(
                                "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference",
                                portTypeKey);
                        categoryBag.getKeyedReference().add(namespaceReference);

            //  A keyedReference with a tModelKey of the UDDI Types category system and a keyValue of
                        // "wsdlSpec" for backward compatibility.
                        KeyedReference typesReferenceBackwardsCompatible = newKeyedReference(
                                "uddi:uddi.org:categorization:types", "uddi-org:types", "wsdlSpec");
                        categoryBag.getKeyedReference().add(typesReferenceBackwardsCompatible);

                        // One or two keyedReferences as required to capture the protocol
                        for (Object object : binding.getExtensibilityElements()) {
                                SOAPBinding sb = null;
                                SOAP12Binding sb12 = null;
                                HTTPBinding hb = null;

                                try {
                                        hb = (HTTPBinding) object;
                                } catch (Exception x) {
                                }
                                try {
                                        sb = (SOAPBinding) object;
                                } catch (Exception x) {
                                }
                                try {
                                        sb12 = (SOAP12Binding) object;
                                } catch (Exception x) {
                                }
                                if (sb != null) {
                    // If the wsdl:binding contains a soap:binding extensibility element from the
                                        // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                                        //include a keyedReference with a tModelKey of the Protocol Categorization
                                        // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.
                                        SOAPBinding soapBinding = sb;
                                        KeyedReference soapProtocol = newKeyedReference(
                                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                                        categoryBag.getKeyedReference().add(soapProtocol);
                    // If the value of the transport attribute of the soap:binding element
                                        // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                                        // include a keyedReference with a tModelKey of the Transport Categorization
                                        // category system and a keyValue of the tModelKey of the HTTP Transport tModel.
                                        if ("http://schemas.xmlsoap.org/soap/http".equals(soapBinding.getTransportURI())) {
                                                KeyedReference httpTransport = newKeyedReference(
                                                        "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                                                categoryBag.getKeyedReference().add(httpTransport);
                                        } else if (soapBinding.getTransportURI() != null) {
                        // TODO If the value of the transport attribute is anything else,
                                                // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                                                // of the Transport Categorization category system and a keyValue of the tModelKey of
                                                // an appropriate transport tModel.
                                                log.warn("not implemented, binding transport is " + soapBinding.getTransportURI());
                                        }

                                } else if (hb != null) {

                    // If the wsdl:binding contains an http:binding extensibility element from the
                                        // http://schemas.xmlsoap.org/wsdl/http/ namespace then the categoryBag MUST
                                        // include a keyedReference with a tModelKey of the Protocol Categorization
                                        // category system and a keyValue of the tModelKey of the HTTP Protocol tModel.
                                        KeyedReference soapProtocol = newKeyedReference(
                                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:http", "uddi:uddi.org:protocol:http");
                                        categoryBag.getKeyedReference().add(soapProtocol);
                                } else if (sb12 != null) {
                    // If the wsdl:binding contains a soap:binding extensibility element from the
                                        // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                                        //include a keyedReference with a tModelKey of the Protocol Categorization
                                        // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.

                                        KeyedReference soapProtocol = newKeyedReference(
                                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                                        categoryBag.getKeyedReference().add(soapProtocol);
                    // If the value of the transport attribute of the soap:binding element
                                        // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                                        // include a keyedReference with a tModelKey of the Transport Categorization
                                        // category system and a keyValue of the tModelKey of the HTTP Transport tModel.
                                        if ("http://schemas.xmlsoap.org/soap/http".equals(sb12.getTransportURI())) {
                                                KeyedReference httpTransport = newKeyedReference(
                                                        "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                                                categoryBag.getKeyedReference().add(httpTransport);
                                        } else if (sb12.getTransportURI() != null) {
                        // TODO If the value of the transport attribute is anything else,
                                                // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                                                // of the Transport Categorization category system and a keyValue of the tModelKey of
                                                // an appropriate transport tModel.
                                                log.warn("not implemented, binding transport is " + sb12.getTransportURI());
                                        }

                                } else {
                                        log.warn("Unrecongnized binding type: " + object.getClass().getCanonicalName() + ". Generated"
                                                + "binding tModel may be missing the required (according to WSDL2UDDI spec) "
                                                + "uddi:uddi.org:wsdl:categorization:protocol keyedReference.");

                                }
                        }

                        tModel.setCategoryBag(categoryBag);
                        tModels.add(tModel);
                }
                return tModels;
        }
View Full Code Here

        public Set<TModel> createWSDLPortTypeTModels(String wsdlURL, Map<QName, PortType> portTypes) throws WSDLException {
                Set<TModel> tModels = new HashSet<TModel>();
                // Create a tModel for each portType
                for (QName qName : portTypes.keySet()) {
                        // Build the tModel
                        TModel tModel = new TModel();
                        String localpart = qName.getLocalPart();
                        String namespace = qName.getNamespaceURI();
                        // Set the Key
                        tModel.setTModelKey(keyDomainURI + localpart);
            // Set the Name. The uddi:name element of the tModel MUST be the value of
                        // the name attribute of the wsdl:portType.
                        Name name = new Name();
                        name.setLang(lang);
                        name.setValue(localpart);
                        tModel.setName(name);
            // Set the OverviewURL. The tModel MUST contain an overviewDoc with an
                        // overviewURL containing the location of the WSDL document that
                        // describes the wsdl:portType.
                        OverviewURL overviewURL = new OverviewURL();
                        overviewURL.setUseType(AccessPointType.WSDL_DEPLOYMENT.toString());
                        overviewURL.setValue(wsdlURL);
                        OverviewDoc overviewDoc = new OverviewDoc();
                        overviewDoc.setOverviewURL(overviewURL);
                        tModel.getOverviewDoc().add(overviewDoc);
                        // Create the categoryBag, The tModel MUST contain a categoryBag
                        CategoryBag categoryBag = new CategoryBag();

            // the categoryBag MUST contain a keyedReference with a tModelKey of the WSDL
                        // Entity Type category system and a keyValue of "portType".
                        KeyedReference typesReference = newKeyedReference(
                                "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "portType");
                        categoryBag.getKeyedReference().add(typesReference);

            // If the wsdl:portType has a targetNamespace then the categoryBag MUST also contain an
                        // additional keyedReference with a tModelKey of the XML Namespace category system and a
                        // keyValue of the target namespace of the wsdl:definitions element that contains the
                        // wsdl:portType. If the targetNamespace is absent from the portType, a categoryBag
                        // MUST NOT contain a keyedReference to the XML Namespace category system.
                        if (namespace != null && !"".equals(namespace)) {
                                KeyedReference namespaceReference = newKeyedReference(
                                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
                                categoryBag.getKeyedReference().add(namespaceReference);
                        }

                        tModel.setCategoryBag(categoryBag);
                        tModels.add(tModel);
                }
                return tModels;
        }
View Full Code Here

      tModels.addAll(createWSDLPortTypeTModels(genericWSDLURL, portTypes));
      // Create the Binding tModels
      Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
      tModels.addAll(createWSDLBindingTModels(genericWSDLURL, bindings));
      // Create the BPEL4WS tModel
      TModel bpel4WSTModel = createBPEL4WSProcessTModel(serviceName, targetNamespace, portTypes, bpelOverviewURL);
        tModels.add(bpel4WSTModel);
        // Register these tModels
        for (TModel tModel : tModels) {
        clerk.register(tModel);
      }
View Full Code Here

            GetTModelDetail findAllPortTypesForProcess = createFindAllPortTypesForProcess_1(bpel4WSTModelKey);
            TModelDetail tModelDetail = clerk.getTModelDetail(findAllPortTypesForProcess);
            if (tModelDetail!=null) {
              List<TModel> tModelPortTypeList = tModelDetail.getTModel();
              if (tModelPortTypeList!=null && tModelPortTypeList.size()>0) {
                TModel bpel4WSTModel = tModelPortTypeList.get(0);
                CategoryBag categoryBag = bpel4WSTModel.getCategoryBag();
                if (categoryBag!=null && categoryBag.getKeyedReference()!=null) {
                  List<KeyedReference> portTypeTModelKeys = new ArrayList<KeyedReference>();
                  KeyedReference namespaceRef = null;
                  for (KeyedReference keyedReference : categoryBag.getKeyedReference()) {
                    if ("uddi:uddi.org:wsdl:porttypereference".equals(keyedReference.getTModelKey()) ) {
View Full Code Here

   * @param portTypes
   * @param bpelOverviewURL
   * @return tmodels
   */
    public TModel createBPEL4WSProcessTModel(QName serviceName, String targetNamespace, Map<QName,PortType> portTypes, String bpelOverviewURL) {
      TModel tModel = new TModel();
      // Set the Key
      tModel.setTModelKey(keyDomainURI + serviceName.getLocalPart() + "Process");
      // Set the Name
      Name name = new Name();
      name.setLang("en");
      name.setValue(serviceName.getLocalPart());
      tModel.setName(name);
      // Set the OverviewURL
      OverviewURL overviewURL = new OverviewURL();
      overviewURL.setValue("http://localhost:8080/bpel-console/"); //should point to the bpel of this process, maybe in guvnor
      OverviewDoc overviewDoc = new OverviewDoc();
      overviewDoc.setOverviewURL(overviewURL);
      tModel.getOverviewDoc().add(overviewDoc);
      // Set the categoryBag
      CategoryBag categoryBag = new CategoryBag();
     
      if (targetNamespace!=null) {
        KeyedReference namespaceReference = WSDL2UDDI.newKeyedReference(
          "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", targetNamespace);
        categoryBag.getKeyedReference().add(namespaceReference);
      }
      KeyedReference typesReference = WSDL2UDDI.newKeyedReference(
          "uddi:uddi.org:bpel:types", "uddi-org:bpel:types", "process");
      categoryBag.getKeyedReference().add(typesReference);
      for (QName qName : portTypes.keySet()) {
        String portTypeKey = keyDomainURI + qName.getLocalPart();
        KeyedReference portTypeReference = WSDL2UDDI.newKeyedReference(
            "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference", portTypeKey);
        categoryBag.getKeyedReference().add(portTypeReference);
      }
     
      tModel.setCategoryBag(categoryBag);
     
      if (log.isDebugEnabled()) {
        log.debug(new PrintUDDI<TModel>().print(tModel));
      }
     
View Full Code Here

TOP

Related Classes of org.uddi.api_v2.TModel

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.