use of org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy 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.utils.RESTAPIAdminServiceProxy 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);
}
use of org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method addDefaultAPIForTenant.
@Test
public void addDefaultAPIForTenant() throws Exception {
RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
restapiAdminServiceProxy.setTenantDomain(tenantDomain);
Mockito.when(restapiAdminServiceProxy.addApi(config)).thenReturn(true);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
Assert.assertTrue(apiGatewayAdmin.addDefaultAPIForTenant(provider, name, version, config, tenantDomain));
}
use of org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method getApiForTenant.
@Test
public void getApiForTenant() throws Exception {
APIData apiData = new APIData();
apiData.setContext("/abc");
apiData.setName(name);
apiData.setFileName(name);
RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
restapiAdminServiceProxy.setTenantDomain(tenantDomain);
Mockito.when(restapiAdminServiceProxy.getApi(apiName)).thenReturn(apiData);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
Assert.assertNotNull(apiGatewayAdmin.getApiForTenant(name, version, tenantDomain));
}
use of org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy in project carbon-apimgt by wso2.
the class APIGatewayAdminTest method updateApi.
@Test
public void updateApi() throws Exception {
RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
Mockito.when(restapiAdminServiceProxy.updateApi(apiName, config)).thenReturn(true);
APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
Assert.assertTrue(apiGatewayAdmin.updateApi(name, version, config));
}
Aggregations