use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method getApi.
@Test
public void getApi() throws Exception {
APIData apiData = new APIData();
apiData.setContext("/abc");
apiData.setName(name);
apiData.setFileName(name);
ResourceData resourceData = new ResourceData();
resourceData.setMethods(new String[] { "get" });
resourceData.setContentType("application/json");
resourceData.setUriTemplate("/*");
apiData.setResources(new ResourceData[] { resourceData });
RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
Mockito.when(restapiAdminServiceProxy.getApi(apiName)).thenReturn(apiData);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
Assert.assertNotNull(apiGatewayAdmin.getApi(name, version));
}
use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method addEndpointForTenant.
@Test
public void addEndpointForTenant() throws Exception {
String endpointData = "<endpoint></endpoint>";
EndpointAdminServiceProxy endpointAdminServiceProxy = Mockito.mock(EndpointAdminServiceProxy.class);
Mockito.when(endpointAdminServiceProxy.addEndpoint(Mockito.anyString())).thenReturn(true);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(null, endpointAdminServiceProxy, null);
Assert.assertTrue(apiGatewayAdmin.addEndpoint(endpointData));
}
use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method deleteEndpoint.
@Test
public void deleteEndpoint() throws Exception {
String endpointName = "PizzaShackAPI--v1.0.0_APIproductionEndpoint";
EndpointAdminServiceProxy endpointAdminServiceProxy = Mockito.mock(EndpointAdminServiceProxy.class);
Mockito.when(endpointAdminServiceProxy.deleteEndpoint(Mockito.anyString())).thenReturn(true);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(null, endpointAdminServiceProxy, null);
Assert.assertTrue(apiGatewayAdmin.deleteEndpoint(endpointName));
}
use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method addEndpoint.
@Test
public void addEndpoint() throws Exception {
String endpointData = "<endpoint></endpoint>";
EndpointAdminServiceProxy endpointAdminServiceProxy = Mockito.mock(EndpointAdminServiceProxy.class);
Mockito.when(endpointAdminServiceProxy.addEndpoint(Mockito.anyString())).thenReturn(true);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(null, endpointAdminServiceProxy, null);
Assert.assertTrue(apiGatewayAdmin.addEndpoint(endpointData));
}
use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method isExistingSequenceForTenant.
@Test
public void isExistingSequenceForTenant() throws Exception {
RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
EndpointAdminServiceProxy endpointAdminServiceProxy = Mockito.mock(EndpointAdminServiceProxy.class);
SequenceAdminServiceProxy sequenceAdminServiceProxy = Mockito.mock(SequenceAdminServiceProxy.class);
Mockito.when(sequenceAdminServiceProxy.isExistingSequence(name)).thenReturn(true);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, endpointAdminServiceProxy, sequenceAdminServiceProxy);
Assert.assertEquals(apiGatewayAdmin.isExistingSequenceForTenant(name, tenantDomain), true);
}
Aggregations