Search in sources :

Example 21 with EndpointAdminServiceProxy

use of org.wso2.carbon.apimgt.gateway.utils.EndpointAdminServiceProxy in project carbon-apimgt by wso2.

the class EndpointAdminServiceProxyTestCase method testDeleteEndpoint.

@Test
public void testDeleteEndpoint() {
    EndpointAdminServiceProxy endpointAdminServiceProxy = null;
    try {
        endpointAdminServiceProxy = new EndpointAdminServiceProxy(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
        EndpointAdmin endpointAdmin = Mockito.mock(EndpointAdmin.class);
        Mockito.when(endpointAdmin.deleteEndpoint(Mockito.anyString())).thenReturn(true);
        Mockito.when(endpointAdmin.getEndPointsNames()).thenReturn(null);
        Mockito.when(endpointAdmin.getEndPointsNamesForTenant(Mockito.anyString())).thenReturn(null);
        endpointAdminServiceProxy.setEndpointAdmin(endpointAdmin);
    } catch (Exception e) {
        Assert.fail("Exception while testing deleteEndpoint");
    }
    try {
        endpointAdminServiceProxy.deleteEndpoint("PizzaShackAPI--v1.0.0_APIproductionEndpoint");
    } catch (AxisFault e) {
        Assert.fail("AxisFault while testing deleteEndpoint");
    }
    try {
        endpointAdminServiceProxy.deleteEndpoint("PizzaShackAPI--v1.0.0_APIproductionEndpoint");
    } catch (AxisFault e) {
        Assert.fail("AxisFault while testing deleteEndpoint");
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) EndpointAdmin(org.wso2.carbon.endpoint.service.EndpointAdmin) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)17 EndpointAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.EndpointAdminServiceProxy)14 RESTAPIAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy)10 SequenceAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.SequenceAdminServiceProxy)10 AxisFault (org.apache.axis2.AxisFault)7 OMElement (org.apache.axiom.om.OMElement)4 EndpointAdmin (org.wso2.carbon.endpoint.service.EndpointAdmin)4 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)3 OMFactory (org.apache.axiom.om.OMFactory)2 API (org.wso2.carbon.apimgt.api.model.API)2 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)2 LocalEntryServiceProxy (org.wso2.carbon.apimgt.gateway.utils.LocalEntryServiceProxy)2 MediationSecurityAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.MediationSecurityAdminServiceProxy)2 CertificateManager (org.wso2.carbon.apimgt.impl.certificatemgt.CertificateManager)2 ArrayList (java.util.ArrayList)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 CredentialDto (org.wso2.carbon.apimgt.api.gateway.CredentialDto)1 GatewayContentDTO (org.wso2.carbon.apimgt.api.gateway.GatewayContentDTO)1