use of org.wso2.carbon.apimgt.core.dao.APISubscriptionDAO in project carbon-apimgt by wso2.
the class APIStoreImplTestCase method testDeleteSubscriptionException.
@Test(description = "Exception when deleting subscription", expectedExceptions = APIManagementException.class)
public void testDeleteSubscriptionException() throws APIManagementException {
ApplicationDAO applicationDAO = Mockito.mock(ApplicationDAO.class);
APISubscriptionDAO apiSubscriptionDAO = Mockito.mock(APISubscriptionDAO.class);
APIStore apiStore = getApiStoreImpl(applicationDAO, apiSubscriptionDAO);
Mockito.doThrow(new APIMgtDAOException("Error occurred while deleting api subscription " + UUID, new SQLException())).when(apiSubscriptionDAO).deleteAPISubscription(UUID);
apiStore.deleteAPISubscription(UUID);
}
use of org.wso2.carbon.apimgt.core.dao.APISubscriptionDAO in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetLastUpdatedTimeOfSubscriptionException.
@Test(description = "Exception when getting last updated time of Subscription", expectedExceptions = APIManagementException.class)
public void testGetLastUpdatedTimeOfSubscriptionException() throws APIManagementException {
APISubscriptionDAO apiSubscriptionDAO = mock(APISubscriptionDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiSubscriptionDAO);
when(apiSubscriptionDAO.getLastUpdatedTimeOfSubscription(UUID)).thenThrow(new APIMgtDAOException("Error occurred while retrieving the last updated time of the subscription " + UUID, new SQLException()));
apiStore.getLastUpdatedTimeOfSubscription(UUID);
verify(apiSubscriptionDAO, times(0)).getLastUpdatedTimeOfSubscription(UUID);
}
use of org.wso2.carbon.apimgt.core.dao.APISubscriptionDAO in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetSubscriptionByUUIDException.
@Test(description = "Exception when getting subscription by UUID", expectedExceptions = APIManagementException.class)
public void testGetSubscriptionByUUIDException() throws APIManagementException {
APISubscriptionDAO apiSubscriptionDAO = mock(APISubscriptionDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiSubscriptionDAO);
when(apiSubscriptionDAO.getAPISubscription(UUID)).thenThrow(new APIMgtDAOException("Couldn't retrieve subscription for id " + UUID, new SQLException()));
apiStore.getSubscriptionByUUID(UUID);
verify(apiSubscriptionDAO, times(0)).getAPISubscription(UUID);
}
use of org.wso2.carbon.apimgt.core.dao.APISubscriptionDAO in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetLastUpdatedTimeOfSubscription.
@Test(description = "Getting last updated time of Subscription")
public void testGetLastUpdatedTimeOfSubscription() throws APIManagementException {
APISubscriptionDAO apiSubscriptionDAO = mock(APISubscriptionDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiSubscriptionDAO);
when(apiSubscriptionDAO.getLastUpdatedTimeOfSubscription(UUID)).thenReturn(LAST_UPDATED_TIME);
apiStore.getLastUpdatedTimeOfSubscription(UUID);
verify(apiSubscriptionDAO, times(1)).getLastUpdatedTimeOfSubscription(UUID);
}
use of org.wso2.carbon.apimgt.core.dao.APISubscriptionDAO in project carbon-apimgt by wso2.
the class AbstractAPIManagerTestCase method testGetSubscriptionsByAPIException.
@Test(description = "Exception when getting subscriptions by API", expectedExceptions = APIManagementException.class)
public void testGetSubscriptionsByAPIException() throws APIManagementException {
APISubscriptionDAO apiSubscriptionDAO = mock(APISubscriptionDAO.class);
AbstractAPIManager apiStore = getAPIStoreImpl(apiSubscriptionDAO);
when(apiSubscriptionDAO.getAPISubscriptionsByAPI(UUID)).thenThrow(new APIMgtDAOException("Couldn't find subscriptions for apiId " + UUID, new SQLException()));
apiStore.getSubscriptionsByAPI(UUID);
verify(apiSubscriptionDAO, times(0)).getAPISubscriptionsByAPI(UUID);
}
Aggregations