Examples of EndPointManager


Examples of org.wso2.carbon.governance.api.endpoints.EndpointManager

public class EndpointTest extends BaseTestCase {
   
    public void testAddEndpoint() throws Exception {
        // first add an endpoint, get it delete it, simply stuff like that.
        EndpointManager endpointManager = new EndpointManager(registry);

        Endpoint endpoint1 = endpointManager.newEndpoint("http://localhost/papapa/booom");
        endpoint1.addAttribute("status", "QA");

        endpointManager.addEndpoint(endpoint1);
        assertEquals("/endpoints/localhost/papapa/ep-booom", endpoint1.getPath());

        // now get the endpoint back.
        Endpoint endpoint2 = endpointManager.getEndpoint(endpoint1.getId());
        assertEquals("http://localhost/papapa/booom", endpoint2.getUrl());
        assertEquals("QA", endpoint1.getAttribute("status"));

        // so we will be deleting the endpoint
        endpointManager.removeEndpoint(endpoint2.getId());
        assertTrue(true);

        endpoint2 = endpointManager.getEndpoint(endpoint2.getId());

        assertNull(endpoint2);
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.endpoints.EndpointManager

        assertEquals("http://localhost:8080/axis2/services/BizService", endpoints[0].getUrl());
        assertEquals(1, endpoints[0].getAttributeKeys().length);
        assertEquals("true", endpoints[0].getAttribute(CommonConstants.SOAP11_ENDPOINT_ATTRIBUTE));

        // now we are trying to remove the endpoint
        EndpointManager endpointManager = new EndpointManager(registry);

        try {
            endpointManager.removeEndpoint(endpoints[0].getId());
            assertTrue(false);
        } catch (Exception e) {
            assertTrue(true);
        }
        GovernanceArtifact[] artifacts = wsdl.getDependents();
        // delete the wsdl
        wsdlManager.removeWsdl(wsdl.getId());

        ServiceManager serviceManager = new ServiceManager(registry);

        for (GovernanceArtifact artifact: artifacts) {
            if (artifact instanceof Service) {
                // getting the service.
                Service service2 = (Service)artifact;
                serviceManager.removeService(service2.getId());
            }
        }       

        // now try to remove the endpoint
        endpointManager.removeEndpoint(endpoints[0].getId());
        assertTrue(true);
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.endpoints.EndpointManager

    public void testAttachEndpointsToService() throws Exception {
        ServiceManager serviceManager = new ServiceManager(registry);
        Service service = serviceManager.newService(new QName("http://wso2.com/test234/xxxxx", "myServicxcde"));
        serviceManager.addService(service);

        EndpointManager endpointManager = new EndpointManager(registry);
        Endpoint ep1 = endpointManager.newEndpoint("http://endpoint1xx");
        endpointManager.addEndpoint(ep1);

        Endpoint ep2 = endpointManager.newEndpoint("http://endpoint2xx");
        ep2.setAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR, "QA");
        endpointManager.addEndpoint(ep2);

        service.attachEndpoint(ep1);
        service.attachEndpoint(ep2);

        Endpoint[] endpoints = service.getAttachedEndpoints();
        assertEquals(2, endpoints.length);

        assertEquals("http://endpoint1xx", endpoints[0].getUrl());
        assertEquals(0, endpoints[0].getAttributeKeys().length);

        assertEquals("http://endpoint2xx", endpoints[1].getUrl());
        assertEquals(1, endpoints[1].getAttributeKeys().length);
        assertEquals("QA", endpoints[1].getAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR));

        service.detachEndpoint(ep1.getId());
        endpoints = service.getAttachedEndpoints();
        assertEquals(1, endpoints.length);
       
        assertEquals("http://endpoint2xx", endpoints[0].getUrl());
        assertEquals(1, endpoints[0].getAttributeKeys().length);
        assertEquals("QA", endpoints[0].getAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR));


        // now update the endpoints in the service
        service.setAttributes("endpoints_entry", new String[] {
                "Dev:http://endpoint3",
                "Production:http://endpoint4",
                "QA:http://endpoint2xx",
        });
        serviceManager.updateService(service);

        endpoints = service.getAttachedEndpoints();
        assertEquals(3, endpoints.length);


        assertEquals("http://endpoint3", endpoints[0].getUrl());
        assertEquals(1, endpoints[0].getAttributeKeys().length);
        assertEquals("Dev", endpoints[0].getAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR));

        assertEquals("http://endpoint4", endpoints[1].getUrl());
        assertEquals(1, endpoints[1].getAttributeKeys().length);
        assertEquals("Production", endpoints[1].getAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR));

        assertEquals("http://endpoint2xx", endpoints[2].getUrl());
        assertEquals(1, endpoints[2].getAttributeKeys().length);
        assertEquals("QA", endpoints[2].getAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR));

        Endpoint ep5 = endpointManager.getEndpointByUrl("http://endpoint2");
        assertEquals("QA", ep5.getAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR));
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.endpoints.EndpointManager

        ServiceManager serviceManager = new ServiceManager(registry);
        Service service = serviceManager.newService(new QName("http://done.ding/dong/doodo", "bangService343"));

        serviceManager.addService(service);

        EndpointManager endpointManager = new EndpointManager(registry);
        Endpoint endpoint = endpointManager.newEndpoint("http://dos.dis/doos/safdsf/ppeekk");
        endpointManager.addEndpoint(endpoint);
        service.attachEndpoint(endpoint);

        // retrieve the service
        Service service2 = serviceManager.getService(service.getId());
        Endpoint[] endpoints = service2.getAttachedEndpoints();
View Full Code Here

Examples of org.wso2.carbon.governance.api.endpoints.EndpointManager

    public void testDetachEndpointsToService() throws Exception {
        ServiceManager serviceManager = new ServiceManager(registry);
        Service service = serviceManager.newService(new QName("http://wso2.com/test234/xxxxx", "myServicxcde"));
        serviceManager.addService(service);

        EndpointManager endpointManager = new EndpointManager(registry);
        Endpoint ep1 = endpointManager.newEndpoint("http://endpoint1");
        endpointManager.addEndpoint(ep1);

        Endpoint ep2 = endpointManager.newEndpoint("http://endpoint2");
        ep2.setAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR, "QA");
        endpointManager.addEndpoint(ep2);

        service.attachEndpoint(ep1);
        service.attachEndpoint(ep2);

        Endpoint[] endpoints = service.getAttachedEndpoints();
View Full Code Here

Examples of org.wso2.carbon.governance.api.endpoints.EndpointManager

    public void testNonHttpEndpointsToService() throws Exception {
        ServiceManager serviceManager = new ServiceManager(registry);
        Service service = serviceManager.newService(new QName("http://wso2.com/doadf/spidf", "myServisdfcxcde"));
        serviceManager.addService(service);

        EndpointManager endpointManager = new EndpointManager(registry);
        Endpoint ep1 = endpointManager.newEndpoint("jms:/Service1");
        endpointManager.addEndpoint(ep1);

        Endpoint ep2 = endpointManager.newEndpoint("jms:/Service2");
        ep2.setAttribute(CommonConstants.ENDPOINT_ENVIRONMENT_ATTR, "QA");
        endpointManager.addEndpoint(ep2);

        service.attachEndpoint(ep1);
        service.attachEndpoint(ep2);

        Endpoint[] endpoints = service.getAttachedEndpoints();
View Full Code Here

Examples of org.wso2.carbon.multiple.instance.endpoint.mgt.EndPointManager

    protected void activate(ComponentContext ctxt) {
        /* We need this code to run only on master, otherwise instances started by the master will
            start trying load balancing between endpoints written in to the file.
         */
        if (!CarbonUtils.isChildNode()) {
            EndPointManager endPointManager = new EndPointManager();
            try {
                endPointManager.start();
            } catch (Exception e) {
                log.error("Error Occure while running Multiple Instance Port updator", e);
            }
        }
    }
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.