use of org.wso2.carbon.apimgt.api.model.APIStore in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testSearchAPIByUUID.
@Test(description = "Search API by UUID")
public void testSearchAPIByUUID() throws APIManagementException {
ApiDAO apiDAO = mock(ApiDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiDAO);
API apiFromDAO = new API.APIBuilder(PROVIDER_NAME, API_NAME, API_VERSION).build();
when(apiDAO.getAPI(UUID)).thenReturn(apiFromDAO);
API api = apiStore.getAPIbyUUID(UUID);
Assert.assertEquals(api.getName(), API_NAME);
verify(apiDAO, atLeastOnce()).getAPI(UUID);
}
use of org.wso2.carbon.apimgt.api.model.APIStore in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetDocumentationSummaryException.
@Test(description = "Exception when retrieving documentation summary given the id", expectedExceptions = APIManagementException.class)
public void testGetDocumentationSummaryException() throws APIManagementException {
ApiDAO apiDAO = mock(ApiDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiDAO);
when(apiDAO.getDocumentInfo(UUID)).thenThrow(new APIMgtDAOException("Error occurred while retrieving documents", new SQLException()));
apiStore.getDocumentationSummary(UUID);
}
use of org.wso2.carbon.apimgt.api.model.APIStore in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetLastUpdatedTimeOfApplicationException.
@Test(description = "Exception when getting last updated time of Application", expectedExceptions = APIManagementException.class)
public void testGetLastUpdatedTimeOfApplicationException() throws APIManagementException {
ApplicationDAO applicationDAO = mock(ApplicationDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(applicationDAO);
when(applicationDAO.getLastUpdatedTimeOfApplication(UUID)).thenThrow(new APIMgtDAOException("Error occurred while retrieving the last updated time of the application " + UUID, new SQLException()));
apiStore.getLastUpdatedTimeOfApplication(UUID);
verify(applicationDAO, times(0)).getLastUpdatedTimeOfApplication(UUID);
}
use of org.wso2.carbon.apimgt.api.model.APIStore in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testSearchAPIByUUIDException.
@Test(description = "Exception when getting API by UUID", expectedExceptions = APIManagementException.class)
public void testSearchAPIByUUIDException() throws APIManagementException {
ApiDAO apiDAO = mock(ApiDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiDAO);
when(apiDAO.getAPI(UUID)).thenThrow(new APIMgtDAOException("Error occurred while retrieving API with id " + UUID, new SQLException()));
apiStore.getAPIbyUUID(UUID);
}
use of org.wso2.carbon.apimgt.api.model.APIStore in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetSubscriptionsByAPI.
@Test(description = "Getting subscriptions by API")
public void testGetSubscriptionsByAPI() throws APIManagementException {
APISubscriptionDAO apiSubscriptionDAO = mock(APISubscriptionDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiSubscriptionDAO);
when(apiSubscriptionDAO.getAPISubscriptionsByAPI(UUID)).thenReturn(new ArrayList<Subscription>());
apiStore.getSubscriptionsByAPI(UUID);
verify(apiSubscriptionDAO, times(1)).getAPISubscriptionsByAPI(UUID);
}
Aggregations