Search in sources :

Example 6 with RegisterEndpointRequest

use of org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest in project tesb-rt-se by Talend.

the class LocatorRestServiceTest method registerEndpointWithOptParam.

@Test
public void registerEndpointWithOptParam() throws ServiceLocatorException, InterruptedException {
    sl.register(endpoint(), EasyMock.eq(true));
    EasyMock.expectLastCall();
    replayAll();
    RegisterEndpointRequest req = new RegisterEndpointRequest();
    req.setEndpointURL(ENDPOINTURL);
    req.setServiceName(SERVICE_NAME.toString());
    req.setBinding(BindingType.JAXRS);
    req.setTransport(TransportType.HTTPS);
    lps.registerEndpoint(req);
}
Also used : RegisterEndpointRequest(org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest) Test(org.junit.Test)

Example 7 with RegisterEndpointRequest

use of org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest in project tesb-rt-se by Talend.

the class LocatorRestServiceTest method registerEndpointExpectedLocatorException.

@Test(expected = WebApplicationException.class)
public void registerEndpointExpectedLocatorException() throws ServiceLocatorException, InterruptedException {
    sl.register(endpoint(), EasyMock.eq(true));
    EasyMock.expectLastCall().andStubThrow(new ServiceLocatorException("test"));
    replayAll();
    RegisterEndpointRequest req = new RegisterEndpointRequest();
    EntryType entryType = new EntryType();
    entryType.setKey("test");
    entryType.getValue().add("test");
    req.getEntryType().add(entryType);
    req.setEndpointURL(ENDPOINTURL);
    req.setServiceName(SERVICE_NAME.toString());
    lps.registerEndpoint(req);
}
Also used : RegisterEndpointRequest(org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest) EntryType(org.talend.schemas.esb.locator.rest._2011._11.EntryType) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) Test(org.junit.Test)

Example 8 with RegisterEndpointRequest

use of org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest in project tesb-rt-se by Talend.

the class RESTClient method registerExample.

private void registerExample(LocatorService client, String service, String endpoint) {
    System.out.println("------------------------------");
    System.out.println("Register service with endpoint");
    System.out.println("ServiceName: ".concat(service));
    System.out.println("EndpointURL: ".concat(endpoint));
    RegisterEndpointRequest registerEndpointRequest = new RegisterEndpointRequest();
    registerEndpointRequest.setBinding(BindingType.JAXRS);
    registerEndpointRequest.setTransport(TransportType.HTTPS);
    registerEndpointRequest.setEndpointURL(endpoint);
    registerEndpointRequest.setServiceName(service);
    try {
        client.registerEndpointRegisterEndpointRequestXml(registerEndpointRequest);
        System.out.println("Endpoint registered successfully");
    } catch (WebApplicationException ex) {
        System.err.println(ex.getMessage());
    }
}
Also used : RegisterEndpointRequest(org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest) WebApplicationException(javax.ws.rs.WebApplicationException)

Aggregations

RegisterEndpointRequest (org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest)7 Test (org.junit.Test)5 EntryType (org.talend.schemas.esb.locator.rest._2011._11.EntryType)5 WebApplicationException (javax.ws.rs.WebApplicationException)3 ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)2 QName (javax.xml.namespace.QName)1 WebClient (org.apache.cxf.jaxrs.client.WebClient)1 BindingType (org.talend.esb.servicelocator.client.BindingType)1 Endpoint (org.talend.esb.servicelocator.client.Endpoint)1 SLEndpoint (org.talend.esb.servicelocator.client.SLEndpoint)1 SLPropertiesImpl (org.talend.esb.servicelocator.client.SLPropertiesImpl)1 SimpleEndpoint (org.talend.esb.servicelocator.client.SimpleEndpoint)1 TransportType (org.talend.esb.servicelocator.client.TransportType)1