Search in sources :

Example 26 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class ServiceLocatorImplTest method failureWhenGettingServices.

@Test
public void failureWhenGettingServices() throws Exception {
    expect(backend.connect()).andReturn(rootNode);
    expect(rootNode.getServiceNames()).andThrow(new ServiceLocatorException());
    replayAll();
    ServiceLocatorImpl slc = new ServiceLocatorImpl();
    slc.setBackend(backend);
    try {
        slc.getServices();
        fail("A ServiceLocatorException should have been thrown.");
    } catch (ServiceLocatorException e) {
        ignore("Expected exception");
    }
    verifyAll();
}
Also used : ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) Test(org.junit.Test)

Example 27 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class ServiceLocatorImplTest method failureWhenRegisteringService.

@Test
public void failureWhenRegisteringService() throws Exception {
    expect(backend.connect()).andReturn(rootNode);
    expect(rootNode.getServiceNode(SERVICE_QNAME_1)).andReturn(serviceNode);
    serviceNode.ensureExists();
    expectLastCall().andThrow(new ServiceLocatorException());
    replayAll();
    ServiceLocatorImpl slc = new ServiceLocatorImpl();
    slc.setBackend(backend);
    try {
        slc.register(SERVICE_QNAME_1, ENDPOINT_1);
        fail("A ServiceLocatorException should have been thrown.");
    } catch (ServiceLocatorException e) {
        ignore("Expected exception");
    }
    verifyAll();
}
Also used : ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) Test(org.junit.Test)

Example 28 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class LocatorSoapServiceTest method lookUpEndpointsExpectedLocatorException.

@Test(expected = ServiceLocatorFault.class)
public void lookUpEndpointsExpectedLocatorException() throws ServiceLocatorException, InterruptedException, ServiceLocatorFault, InterruptedExceptionFault {
    sl.lookup(SERVICE_NAME);
    EasyMock.expectLastCall().andStubThrow(new ServiceLocatorException("test"));
    replayAll();
    lps.lookupEndpoints(SERVICE_NAME, null);
}
Also used : ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) Test(org.junit.Test)

Example 29 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class LocatorSoapServiceTest method lookUpEndpointExpectedLocatorException.

@Test(expected = ServiceLocatorFault.class)
public void lookUpEndpointExpectedLocatorException() throws ServiceLocatorException, InterruptedException, ServiceLocatorFault, InterruptedExceptionFault {
    sl.lookup(SERVICE_NAME);
    EasyMock.expectLastCall().andStubThrow(new ServiceLocatorException("test"));
    replayAll();
    lps.lookupEndpoint(SERVICE_NAME, null);
}
Also used : ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) Test(org.junit.Test)

Example 30 with ServiceLocatorException

use of org.talend.esb.servicelocator.client.ServiceLocatorException in project tesb-rt-se by Talend.

the class LocatorSoapServiceTest method registerEndpointExpectedLocatorException.

@Test(expected = ServiceLocatorFault.class)
public void registerEndpointExpectedLocatorException() throws ServiceLocatorException, InterruptedException, ServiceLocatorFault, InterruptedExceptionFault {
    sl.register(endpoint(), EasyMock.eq(true));
    EasyMock.expectLastCall().andStubThrow(new ServiceLocatorException("test"));
    replayAll();
    lps.registerEndpoint(SERVICE_NAME, ENDPOINTURL, null, null, null);
}
Also used : ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) Test(org.junit.Test)

Aggregations

ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)35 Test (org.junit.Test)13 QName (javax.xml.namespace.QName)11 SLEndpoint (org.talend.esb.servicelocator.client.SLEndpoint)8 WebApplicationException (javax.ws.rs.WebApplicationException)6 InterruptionFaultDetail (org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail)6 ServiceLocatorFaultDetail (org.talend.schemas.esb.locator._2011._11.ServiceLocatorFaultDetail)6 InterruptedExceptionFault (org.talend.services.esb.locator.v1.InterruptedExceptionFault)6 ServiceLocatorFault (org.talend.services.esb.locator.v1.ServiceLocatorFault)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 ServiceLocatorTracker (org.talend.esb.locator.tracker.ServiceLocatorTracker)4 SLPropertiesMatcher (org.talend.esb.servicelocator.client.SLPropertiesMatcher)4 SimpleEndpoint (org.talend.esb.servicelocator.client.SimpleEndpoint)4 JAXBException (javax.xml.bind.JAXBException)3 Endpoint (org.talend.esb.servicelocator.client.Endpoint)3 DOMResult (javax.xml.transform.dom.DOMResult)2 W3CEndpointReferenceBuilder (javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)2 EndpointReferenceType (org.apache.cxf.ws.addressing.EndpointReferenceType)2 BindingType (org.talend.esb.servicelocator.client.BindingType)2 SLProperties (org.talend.esb.servicelocator.client.SLProperties)2