|
|
@ -70,24 +70,19 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
|
|
|
IllegalAccessException {
|
|
|
|
IllegalAccessException {
|
|
|
|
APIConfig apiConfig = new APIConfig();
|
|
|
|
APIConfig apiConfig = new APIConfig();
|
|
|
|
setApiConfigs(apiConfig, "testAPI-1");
|
|
|
|
setApiConfigs(apiConfig, "testAPI-1");
|
|
|
|
|
|
|
|
|
|
|
|
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
|
|
|
|
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
|
|
|
|
getClass(), Mockito.CALLS_REAL_METHODS);
|
|
|
|
getClass(), Mockito.CALLS_REAL_METHODS);
|
|
|
|
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
|
|
|
|
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
|
|
|
|
class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService();
|
|
|
|
doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService();
|
|
|
|
|
|
|
|
|
|
|
|
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
|
|
|
|
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
|
|
|
|
getPublisherClient();
|
|
|
|
getPublisherClient();
|
|
|
|
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
|
|
|
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
|
|
|
|
|
|
|
|
|
|
|
APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
doReturn(apIsApi).when(publisherClient).getApi();
|
|
|
|
doReturn(apIsApi).when(publisherClient).getApi();
|
|
|
|
|
|
|
|
|
|
|
|
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
api.setStatus("CREATED");
|
|
|
|
api.setStatus("CREATED");
|
|
|
|
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
|
|
|
|
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
|
|
|
|
|
|
|
|
|
|
|
|
apiPublisherService.publishAPI(apiConfig);
|
|
|
|
apiPublisherService.publishAPI(apiConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -95,37 +90,28 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
|
|
|
private void publishWithNoAPIListCreated() throws APIManagerPublisherException {
|
|
|
|
private void publishWithNoAPIListCreated() throws APIManagerPublisherException {
|
|
|
|
APIConfig apiConfig = new APIConfig();
|
|
|
|
APIConfig apiConfig = new APIConfig();
|
|
|
|
setApiConfigs(apiConfig, "testAPI-3");
|
|
|
|
setApiConfigs(apiConfig, "testAPI-3");
|
|
|
|
|
|
|
|
|
|
|
|
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
|
|
|
|
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
|
|
|
|
getClass(), Mockito.CALLS_REAL_METHODS);
|
|
|
|
getClass(), Mockito.CALLS_REAL_METHODS);
|
|
|
|
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
|
|
|
|
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
|
|
|
|
class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService();
|
|
|
|
doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService();
|
|
|
|
|
|
|
|
|
|
|
|
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
|
|
|
|
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
|
|
|
|
getPublisherClient();
|
|
|
|
getPublisherClient();
|
|
|
|
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
|
|
|
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
|
|
|
|
|
|
|
|
|
|
|
APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
doReturn(apIsApi).when(publisherClient).getApi();
|
|
|
|
doReturn(apIsApi).when(publisherClient).getApi();
|
|
|
|
|
|
|
|
|
|
|
|
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
api.setStatus("CREATED");
|
|
|
|
api.setStatus("CREATED");
|
|
|
|
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
|
|
|
|
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
|
|
|
|
|
|
|
|
|
|
|
|
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIInfo apiInfo = new APIInfo();
|
|
|
|
APIInfo apiInfo = new APIInfo();
|
|
|
|
|
|
|
|
|
|
|
|
List<APIInfo> apiInfoList = new ArrayList<>();
|
|
|
|
List<APIInfo> apiInfoList = new ArrayList<>();
|
|
|
|
apiInfoList.add(apiInfo);
|
|
|
|
apiInfoList.add(apiInfo);
|
|
|
|
|
|
|
|
|
|
|
|
apiList.list(apiInfoList);
|
|
|
|
apiList.list(apiInfoList);
|
|
|
|
doReturn(apiList).when(apIsApi).apisGet(Mockito.anyInt(), Mockito.anyInt(),
|
|
|
|
doReturn(apiList).when(apIsApi).apisGet(Mockito.anyInt(), Mockito.anyInt(),
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
|
|
|
|
|
|
|
|
doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(),
|
|
|
|
doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(),
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
|
|
|
|
|
|
|
|
apiPublisherService.publishAPI(apiConfig);
|
|
|
|
apiPublisherService.publishAPI(apiConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -133,30 +119,24 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
|
|
|
private void publishWithAPIListCreated() throws APIManagerPublisherException {
|
|
|
|
private void publishWithAPIListCreated() throws APIManagerPublisherException {
|
|
|
|
APIConfig apiConfig = new APIConfig();
|
|
|
|
APIConfig apiConfig = new APIConfig();
|
|
|
|
setApiConfigs(apiConfig, "testAPI-2");
|
|
|
|
setApiConfigs(apiConfig, "testAPI-2");
|
|
|
|
|
|
|
|
|
|
|
|
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
|
|
|
|
APIPublisherDataHolder apiPublisherDataHolder = Mockito.mock(APIPublisherDataHolder.getInstance().
|
|
|
|
getClass(), Mockito.CALLS_REAL_METHODS);
|
|
|
|
getClass(), Mockito.CALLS_REAL_METHODS);
|
|
|
|
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
|
|
|
|
IntegrationClientService integrationClientService = Mockito.mock(IntegrationClientServiceImpl.
|
|
|
|
class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService();
|
|
|
|
doReturn(integrationClientService).when(apiPublisherDataHolder).getIntegrationClientService();
|
|
|
|
|
|
|
|
|
|
|
|
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
|
|
|
|
PublisherClient publisherClient = APIPublisherDataHolder.getInstance().getIntegrationClientService().
|
|
|
|
getPublisherClient();
|
|
|
|
getPublisherClient();
|
|
|
|
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
|
|
|
doReturn(publisherClient).when(integrationClientService).getPublisherClient();
|
|
|
|
|
|
|
|
|
|
|
|
APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIsApi apIsApi = Mockito.mock(Api.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
doReturn(apIsApi).when(publisherClient).getApi();
|
|
|
|
doReturn(apIsApi).when(publisherClient).getApi();
|
|
|
|
|
|
|
|
|
|
|
|
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
API api = Mockito.mock(API.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
api.setStatus("CREATED");
|
|
|
|
api.setStatus("CREATED");
|
|
|
|
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
|
|
|
|
doReturn(api).when(apIsApi).apisPost(Mockito.any(), Mockito.anyString());
|
|
|
|
|
|
|
|
|
|
|
|
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIList apiList = Mockito.mock(APIList.class, Mockito.CALLS_REAL_METHODS);
|
|
|
|
APIInfo apiInfo = new APIInfo();
|
|
|
|
APIInfo apiInfo = new APIInfo();
|
|
|
|
apiInfo.setName("testAPI-2");
|
|
|
|
apiInfo.setName("testAPI-2");
|
|
|
|
apiInfo.setVersion("1.0.0");
|
|
|
|
apiInfo.setVersion("1.0.0");
|
|
|
|
apiInfo.setId("test-one");
|
|
|
|
apiInfo.setId("test-one");
|
|
|
|
|
|
|
|
|
|
|
|
List<APIInfo> apiInfoList = new ArrayList<>();
|
|
|
|
List<APIInfo> apiInfoList = new ArrayList<>();
|
|
|
|
apiInfoList.add(apiInfo);
|
|
|
|
apiInfoList.add(apiInfo);
|
|
|
|
apiList.list(apiInfoList);
|
|
|
|
apiList.list(apiInfoList);
|
|
|
@ -164,7 +144,6 @@ APIPublisherServiceTest extends BaseAPIPublisherTest {
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(),
|
|
|
|
doReturn(api).when(apIsApi).apisApiIdPut(Mockito.anyString(), Mockito.any(),
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
|
|
|
|
|
|
|
|
|
|
|
|
apiConfig.setSharedWithAllTenants(false);
|
|
|
|
apiConfig.setSharedWithAllTenants(false);
|
|
|
|
apiPublisherService.publishAPI(apiConfig);
|
|
|
|
apiPublisherService.publishAPI(apiConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|