Search in sources :

Example 26 with APIGatewayAdmin

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

the class APIGatewayAdminTest method addSequence.

@Test
public void addSequence() throws Exception {
    String sequence = "<api></api>";
    RESTAPIAdminServiceProxy restapiAdminServiceProxy = Mockito.mock(RESTAPIAdminServiceProxy.class);
    EndpointAdminServiceProxy endpointAdminServiceProxy = Mockito.mock(EndpointAdminServiceProxy.class);
    SequenceAdminServiceProxy sequenceAdminServiceProxy = Mockito.mock(SequenceAdminServiceProxy.class);
    Mockito.doNothing().when(sequenceAdminServiceProxy).addSequence(Mockito.any(OMElement.class));
    APIGatewayAdmin apiGatewayAdmin = new APIGatewayAdminWrapper(restapiAdminServiceProxy, endpointAdminServiceProxy, sequenceAdminServiceProxy);
    Assert.assertTrue(apiGatewayAdmin.addSequence(sequence));
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) OMElement(org.apache.axiom.om.OMElement) EndpointAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.EndpointAdminServiceProxy) SequenceAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.SequenceAdminServiceProxy) Test(org.junit.Test)

Example 27 with APIGatewayAdmin

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

the class APIGatewayAdminTest method updateApiForInlineScriptForTenant.

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

Example 28 with APIGatewayAdmin

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

the class APIGatewayAdminTest method deleteSequence.

@Test
public void deleteSequence() 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.deleteSequence("name");
}
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)

Example 29 with APIGatewayAdmin

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

the class APIGatewayAdminTest method updateApiForInlineScript.

@Test
public void updateApiForInlineScript() 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.updateApiForInlineScript(name, version, config));
}
Also used : RESTAPIAdminServiceProxy(org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy) Test(org.junit.Test)

Example 30 with APIGatewayAdmin

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

the class APIGatewayAdminTest method addSequenceForTenant.

@Test
public void addSequenceForTenant() throws Exception {
    String sequence = "<api></api>";
    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);
    Assert.assertTrue(apiGatewayAdmin.addSequenceForTenant(sequence, 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