Examples of Wsdl


Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

        assertEquals(newService.getAttribute("endpoints_entry"),
                ":http://localhost:8080/axis2/services/BizService");

        // now we just add an endpoints
        WsdlManager wsdlManager = new WsdlManager(registry);
        Wsdl wsdl = wsdlManager.newWsdl("http://svn.wso2.org/repos/wso2/trunk/carbon/components/governance/org.wso2.carbon.governance.api/src/test/resources/test-resources/wsdl/MyChangedBizService.wsdl");
        wsdl.addAttribute("boom", "hahahaha");

        wsdlManager.addWsdl(wsdl);

        GovernanceArtifact[] artifacts = wsdl.getDependents();

        for (GovernanceArtifact artifact: artifacts) {
            if (artifact instanceof Service) {
                // getting the service.
                Service service2 = (Service)artifact;
View Full Code Here

Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

public class WSDLTest extends BaseTestCase {
    public void testAddWSDL() throws Exception {
        WsdlManager wsdlManager = new WsdlManager(registry);

        Wsdl wsdl = wsdlManager.newWsdl("http://svn.wso2.org/repos/wso2/trunk/carbon/components/governance/org.wso2.carbon.governance.api/src/test/resources/test-resources/wsdl/BizService.wsdl");
        wsdl.addAttribute("creator", "it is me");
        wsdl.addAttribute("version", "0.01");
        wsdlManager.addWsdl(wsdl);

        Wsdl newWsdl = wsdlManager.getWsdl(wsdl.getId());
        assertEquals(wsdl.getWsdlElement().toString(), newWsdl.getWsdlElement().toString());
        assertEquals("it is me", newWsdl.getAttribute("creator"));
        assertEquals("0.01", newWsdl.getAttribute("version"));

        // change the target namespace and check
        String oldWSDLPath = newWsdl.getPath();
        assertEquals(oldWSDLPath, "/wsdls/com/foo/BizService.wsdl");
        assertTrue(registry.resourceExists("/wsdls/com/foo/BizService.wsdl"));

        OMElement wsdlElement = newWsdl.getWsdlElement();
        wsdlElement.addAttribute("targetNamespace", "http://ww2.wso2.org/test", null);
        wsdlElement.declareNamespace("http://ww2.wso2.org/test", "tns");
        wsdlManager.updateWsdl(newWsdl);

        assertEquals("/wsdls/org/wso2/ww2/test/BizService.wsdl", newWsdl.getPath());
        //assertFalse(registry.resourceExists("/wsdls/http/foo/com/BizService.wsdl"));

        // doing an update without changing anything.
        wsdlManager.updateWsdl(newWsdl);

        assertEquals("/wsdls/org/wso2/ww2/test/BizService.wsdl", newWsdl.getPath());
        assertEquals("0.01", newWsdl.getAttribute("version"));

        newWsdl = wsdlManager.getWsdl(wsdl.getId());
        assertEquals("it is me", newWsdl.getAttribute("creator"));
        assertEquals("0.01", newWsdl.getAttribute("version"));

        // adding a new schema to the wsdl.
        wsdlElement = newWsdl.getWsdlElement();
        OMElement schemaElement = evaluateXPathToElement("//xsd:schema", wsdlElement);

        OMFactory factory = OMAbstractFactory.getOMFactory();

        OMElement importElement = factory.createOMElement(
                new QName("http://www.w3.org/2001/XMLSchema", "import"));
        importElement.addAttribute("schemaLocation",
                "http://svn.wso2.org/repos/wso2/trunk/carbon/components/governance/org.wso2.carbon.governance.api/src/test/resources/test-resources/xsd/purchasing_dup.xsd", null);
        schemaElement.addChild(importElement);
        importElement.addAttribute("namespace", "http://bar.org/purchasing_dup", null);

        wsdlManager.updateWsdl(newWsdl);

        Schema[] schemas = newWsdl.getAttachedSchemas();
        assertEquals("/schemas/org/bar/purchasing_dup/purchasing_dup.xsd",
                schemas[schemas.length - 1].getPath());


        Wsdl[] wsdls = wsdlManager.findWsdls(new WsdlFilter() {
            public boolean matches(Wsdl wsdl) throws GovernanceException {
                Schema[] schemas = wsdl.getAttachedSchemas();
                for (Schema schema: schemas) {
                    if (schema.getPath().equals("/schemas/org/bar/purchasing_dup/purchasing_dup.xsd")) {
                        return true;
                    }
                }
                return false;
            }
        });
        assertEquals(1, wsdls.length);
        assertEquals(newWsdl.getId(), wsdls[0].getId());

        // deleting the wsdl
        wsdlManager.removeWsdl(newWsdl.getId());
        Wsdl deletedWsdl = wsdlManager.getWsdl(newWsdl.getId());
        assertNull(deletedWsdl);

        // add again
        Wsdl anotherWsdl = wsdlManager.newWsdl("http://svn.wso2.org/repos/wso2/trunk/carbon/components/governance/org.wso2.carbon.governance.api/src/test/resources/test-resources/wsdl/BizService.wsdl");
        anotherWsdl.addAttribute("creator", "it is not me");
        anotherWsdl.addAttribute("version", "0.02");
        wsdlManager.addWsdl(anotherWsdl);

        // and delete the wsdl
        wsdlManager.removeWsdl(anotherWsdl.getId());
        assertNull(wsdlManager.getWsdl(anotherWsdl.getId()));
        
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

    }

    public void testEditWSDL() throws Exception {
        WsdlManager wsdlManager = new WsdlManager(registry);

        Wsdl wsdl = wsdlManager.newWsdl("http://svn.wso2.org/repos/wso2/trunk/carbon/components/governance/org.wso2.carbon.governance.api/src/test/resources/test-resources/wsdl/BizService.wsdl");
        wsdl.addAttribute("creator2", "it is me");
        wsdl.addAttribute("version2", "0.01");
        wsdlManager.addWsdl(wsdl);

        // now edit the wsdl
        OMElement contentElement = wsdl.getWsdlElement();
        OMElement addressElement = evaluateXPathToElement("//soap:address", contentElement);
        addressElement.addAttribute("location", "http://my-custom-endpoint/hoooo", null);
        wsdl.setWsdlElement(contentElement);

        // now do an update.
        wsdlManager.updateWsdl(wsdl);

        // now get the wsdl and check the update is there.
        Wsdl wsdl2 = wsdlManager.getWsdl(wsdl.getId());
        assertEquals("it is me", wsdl2.getAttribute("creator2"));
        assertEquals("0.01", wsdl2.getAttribute("version2"));
        OMElement contentElement2 = wsdl.getWsdlElement();
        OMElement addressElement2 = evaluateXPathToElement("//soap:address", contentElement2);

        assertEquals("http://my-custom-endpoint/hoooo", addressElement2.getAttributeValue(new QName("location")));
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

     * @return the artifact added.
     * @throws GovernanceException if the operation failed.
     */
    public Wsdl newWsdl(String url) throws GovernanceException {
        String wsdlId = UUID.randomUUID().toString();
        Wsdl wsdl = new Wsdl(wsdlId, url);
        wsdl.associateRegistry(registry);
        return wsdl;
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

        boolean succeeded = false;
        try {
            registry.beginTransaction();

            // getting the old wsdl.
            Wsdl oldWsdl = getWsdl(wsdl.getId());
            if (oldWsdl == null) {
                addWsdl(wsdl);
                return;
            }
            // we are expecting only the OMElement to be different.
            Resource wsdlResource = registry.newResource();
            wsdlResource.setMediaType(GovernanceConstants.WSDL_MEDIA_TYPE);

            // setting the wsdl content
            setContent(wsdl, wsdlResource);

            // remove the old wsdl resource.
            String tmpPath = oldWsdl.getPath();

            registry.put(tmpPath, wsdlResource);
            wsdl.updatePath();
            wsdl.loadWsdlDetails();
           
View Full Code Here

Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

    public void testServiceAttachments() throws Exception {
        // first put a WSDL
        WsdlManager wsdlManager = new WsdlManager(registry);

        Wsdl wsdl = wsdlManager.newWsdl("http://svn.wso2.org/repos/wso2/trunk/carbon/components/governance/org.wso2.carbon.governance.api/src/test/resources/test-resources/wsdl/BizService.wsdl");
         wsdlManager.addWsdl(wsdl);

        ServiceManager serviceManager = new ServiceManager(registry);
        Service service = serviceManager.newService(new QName("http://test/org/bang", "myservice"));
        serviceManager.addService(service);
View Full Code Here

Examples of org.wso2.carbon.governance.api.wsdls.dataobjects.Wsdl

                SLA sla = new SLA(artifactId, contentElement);
                sla.associateRegistry(registry);
                return sla;*/
            } else if (GovernanceConstants.WSDL_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
                return new Wsdl(artifactId, registry);
            } else if (GovernanceConstants.SCHEMA_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
                return new Schema(artifactId, registry);
            } else if (GovernanceConstants.POLICY_XML_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.