Search in sources :

Example 6 with APIGatewayAdmin

use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.

the class APIGatewayAdminTest method deleteApiForTenant.

@Test
public void deleteApiForTenant() throws Exception {
    RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
    restapiAdminServiceProxy.setTenantDomain(tenantDomain);
    Mockito.when(restapiAdminServiceProxy.deleteApi(apiName)).thenReturn(true);
    APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
    Assert.assertTrue(apiGatewayAdmin.deleteApiForTenant(provider, name, version, tenantDomain));
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) Test(org.junit.Test)

Example 7 with APIGatewayAdmin

use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.

the class APIGatewayAdminTest method deleteApi.

@Test
public void deleteApi() throws Exception {
    RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
    Mockito.when(restapiAdminServiceProxy.deleteApi(apiName)).thenReturn(true);
    APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
    Assert.assertTrue(apiGatewayAdmin.deleteApi(provider, name, version));
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) Test(org.junit.Test)

Example 8 with APIGatewayAdmin

use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.

the class APIGatewayAdminTest method getDefaultApi.

@Test
public void getDefaultApi() throws Exception {
    APIData apiData = new APIData();
    apiData.setContext("/abc");
    apiData.setName(name);
    apiData.setFileName(name);
    RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
    Mockito.when(restapiAdminServiceProxy.getApi(apiDefaultName)).thenReturn(apiData);
    APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
    Assert.assertNotNull(apiGatewayAdmin.getDefaultApi(name, version));
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) APIData(org.wso2.carbon.rest.api.APIData) Test(org.junit.Test)

Example 9 with APIGatewayAdmin

use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.

the class APIGatewayAdminTest method deleteDefaultApi.

@Test
public void deleteDefaultApi() throws Exception {
    RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
    Mockito.when(restapiAdminServiceProxy.deleteApi(apiDefaultName)).thenReturn(true);
    APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, null, null);
    Assert.assertTrue(apiGatewayAdmin.deleteDefaultApi(name, version));
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) Test(org.junit.Test)

Example 10 with APIGatewayAdmin

use of org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin in project carbon-apimgt by wso2.

the class APIGatewayAdminTest method deleteSequenceForTenant.

@Test
public void deleteSequenceForTenant() throws Exception {
    RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
    EndpointAdminServiceProxy endpointAdminServiceProxy = Mockito.mock(EndpointAdminServiceProxy.class);
    SequenceAdminServiceProxy sequenceAdminServiceProxy = Mockito.mock(SequenceAdminServiceProxy.class);
    APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, endpointAdminServiceProxy, sequenceAdminServiceProxy);
    apiGatewayAdmin.deleteSequenceForTenant("name", tenantDomain);
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) EndpointAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.EndpointAdminServiceProxy) SequenceAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.SequenceAdminServiceProxy) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)32 RESTAPIAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy)28 EndpointAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.EndpointAdminServiceProxy)12 SequenceAdminServiceProxy (org.wso2.carbon.apimgt.gateway.utils.SequenceAdminServiceProxy)8 APIData (org.wso2.carbon.rest.api.APIData)4 OMElement (org.apache.axiom.om.OMElement)3 GatewayAPIDTO (org.wso2.carbon.apimgt.api.gateway.GatewayAPIDTO)3 APIGatewayAdmin (org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin)3 ArtifactSynchronizerException (org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException)3 OMFactory (org.apache.axiom.om.OMFactory)2 AxisFault (org.apache.axis2.AxisFault)2 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 API (org.wso2.carbon.apimgt.api.model.API)1 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)1 APIProductIdentifier (org.wso2.carbon.apimgt.api.model.APIProductIdentifier)1 APIEvent (org.wso2.carbon.apimgt.impl.notifier.events.APIEvent)1 ResourceData (org.wso2.carbon.rest.api.ResourceData)1