use of org.wso2.carbon.rest.api.APIData 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));
}
use of org.wso2.carbon.rest.api.APIData in project carbon-apimgt by wso2.
the class APIGatewayAdmin method getDefaultApiForTenant.
public org.wso2.carbon.apimgt.gateway.dto.APIData getDefaultApiForTenant(String apiName, String version, String tenantDomain) throws AxisFault {
RESTAPIAdminServiceProxy restClient = getRestapiAdminClient(tenantDomain);
String qualifiedName = GatewayUtils.getQualifiedDefaultApiName(apiName);
APIData apiData = restClient.getApi(qualifiedName);
return convert(apiData);
}
use of org.wso2.carbon.rest.api.APIData in project carbon-apimgt by wso2.
the class APIGatewayAdmin method getApiForTenant.
/**
* Get API from the gateway
*
* @param tenantDomain
* @return
* @throws AxisFault
*/
public org.wso2.carbon.apimgt.gateway.dto.APIData getApiForTenant(String apiName, String version, String tenantDomain) throws AxisFault {
RESTAPIAdminServiceProxy restClient = getRestapiAdminClient(tenantDomain);
String qualifiedName = GatewayUtils.getQualifiedApiName(apiName, version);
APIData apiData = restClient.getApi(qualifiedName);
return convert(apiData);
}
use of org.wso2.carbon.rest.api.APIData in project carbon-apimgt by wso2.
the class APIGatewayAdmin method getDefaultApi.
public org.wso2.carbon.apimgt.gateway.dto.APIData getDefaultApi(String apiName, String version) throws AxisFault {
RESTAPIAdminServiceProxy restClient = getRestapiAdminClient(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
String qualifiedName = GatewayUtils.getQualifiedDefaultApiName(apiName);
APIData apiData = restClient.getApi(qualifiedName);
return convert(apiData);
}
use of org.wso2.carbon.rest.api.APIData in project carbon-apimgt by wso2.
the class APIGatewayAdmin method convert.
private org.wso2.carbon.apimgt.gateway.dto.APIData convert(APIData data) {
if (data == null) {
return null;
}
org.wso2.carbon.apimgt.gateway.dto.APIData apiData = new org.wso2.carbon.apimgt.gateway.dto.APIData();
apiData.setContext(data.getContext());
apiData.setFileName(data.getFileName());
apiData.setHost(data.getHost());
apiData.setName(data.getName());
apiData.setPort(data.getPort());
ResourceData[] resources = data.getResources();
List<org.wso2.carbon.apimgt.gateway.dto.ResourceData> resList = new ArrayList<org.wso2.carbon.apimgt.gateway.dto.ResourceData>();
if (resources != null && resources.length > 0) {
for (ResourceData res : resources) {
if (res == null) {
continue;
}
org.wso2.carbon.apimgt.gateway.dto.ResourceData resource = convert(res);
resList.add(resource);
}
apiData.setResources(resList.toArray(new org.wso2.carbon.apimgt.gateway.dto.ResourceData[0]));
}
return apiData;
}
Aggregations