use of org.wso2.carbon.endpoint.service.EndpointAdmin in project carbon-apimgt by wso2.
the class EndpointAdminServiceProxyTestCase method testRemoveEndpointsToUpdate.
@Test
public void testRemoveEndpointsToUpdate() throws Exception {
EndpointAdminServiceProxy endpointAdminServiceProxy = null;
APIIdentifier identifier = null;
API api = null;
try {
endpointAdminServiceProxy = new EndpointAdminServiceProxy(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
EndpointAdmin endpointAdmin = Mockito.mock(EndpointAdmin.class);
String[] endpointNames = { "API1--v1.0.0_APIproductionEndpoint", "API1--v1.0.0_APIsandboxEndpoint" };
identifier = new APIIdentifier("P1_API1_1.0.0");
api = new API(identifier);
Mockito.when(endpointAdmin.getEndPointsNames()).thenReturn(endpointNames);
Mockito.when(endpointAdmin.getEndPointsNamesForTenant(Mockito.anyString())).thenReturn(endpointNames);
Mockito.when(endpointAdmin.deleteEndpoint(Mockito.anyString())).thenReturn(true);
Mockito.when(endpointAdmin.deleteEndpointForTenant(Mockito.anyString(), Mockito.anyString())).thenReturn(true);
endpointAdminServiceProxy.setEndpointAdmin(endpointAdmin);
} catch (Exception e) {
Assert.fail("Exception while testing removeEndpointsToUpdate");
}
try {
endpointAdminServiceProxy.removeEndpointsToUpdate(api.getId().getApiName(), api.getId().getVersion());
endpointAdminServiceProxy.removeEndpointsToUpdate(api.getId().getApiName(), api.getId().getVersion());
endpointAdminServiceProxy.removeEndpointsToUpdate(api.getId().getApiName(), api.getId().getVersion());
} catch (AxisFault e) {
Assert.fail("AxisFault while testing removeEndpointsToUpdate");
}
try {
endpointAdminServiceProxy.removeEndpointsToUpdate(api.getId().getApiName(), api.getId().getVersion());
} catch (AxisFault e) {
Assert.fail("AxisFault while testing removeEndpointsToUpdate for tenant");
}
}
use of org.wso2.carbon.endpoint.service.EndpointAdmin in project carbon-apimgt by wso2.
the class EndpointAdminServiceProxyTestCase method testCheckEndpointExistBeforeDelete.
@Test
public void testCheckEndpointExistBeforeDelete() {
EndpointAdminServiceProxy endpointAdminServiceProxy = null;
String endpointName = "PizzaShackAPI--v1.0.0_APIproductionEndpoint";
String[] endpointArray = { "PizzaShackAPI--v1.0.0_APIproductionEndpoint", "PizzaShackAPI--v1.0.0_APIsandboxEndpoint" };
String tenantDomain = "wso2.com";
try {
endpointAdminServiceProxy = new EndpointAdminServiceProxy(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
EndpointAdmin endpointAdmin = Mockito.mock(EndpointAdmin.class);
Mockito.when(endpointAdmin.deleteEndpoint(endpointName)).thenReturn(true);
Mockito.when(endpointAdmin.deleteEndpointForTenant(endpointName, tenantDomain)).thenReturn(true);
Mockito.when(endpointAdmin.getEndPointsNames()).thenReturn(endpointArray);
Mockito.when(endpointAdmin.getEndPointsNamesForTenant(tenantDomain)).thenReturn(endpointArray);
endpointAdminServiceProxy.setEndpointAdmin(endpointAdmin);
} catch (Exception e) {
Assert.fail("Exception while testing CheckEndpointExistBeforeDelete");
}
}
use of org.wso2.carbon.endpoint.service.EndpointAdmin in project carbon-apimgt by wso2.
the class EndpointAdminServiceProxyTestCase method testAddEndpoint.
@Test
public void testAddEndpoint() {
EndpointAdminServiceProxy endpointAdminServiceProxy = null;
try {
endpointAdminServiceProxy = new EndpointAdminServiceProxy(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
EndpointAdmin endpointAdmin = Mockito.mock(EndpointAdmin.class);
Mockito.when(endpointAdmin.addEndpoint(Mockito.anyString())).thenReturn(true);
endpointAdminServiceProxy.setEndpointAdmin(endpointAdmin);
} catch (Exception e) {
Assert.fail("Exception while testing addEndpoint");
}
try {
endpointAdminServiceProxy.addEndpoint(Mockito.anyString());
} catch (AxisFault e) {
Assert.fail("AxisFault while testing addEndpoint");
}
try {
endpointAdminServiceProxy.addEndpoint(Mockito.anyString());
} catch (AxisFault e) {
Assert.fail("AxisFault while testing addEndpoint");
}
}
use of org.wso2.carbon.endpoint.service.EndpointAdmin 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");
}
}
Aggregations