use of org.wso2.carbon.apimgt.core.dao.LabelDAO in project carbon-apimgt by wso2.
the class APIStoreImplTestCase method getAllLabels.
@Test(description = "get all labels")
public void getAllLabels() throws Exception {
LabelDAO labelDao = Mockito.mock(LabelDAO.class);
APIStore apiStore = getApiStoreImpl(labelDao);
List<Label> labels = new ArrayList<>();
Label label = new Label.Builder().id("123").name("Default").type("STORE").accessUrls(new ArrayList<>()).build();
labels.add(label);
Mockito.when(labelDao.getLabels()).thenReturn(labels);
List<Label> returnedLabels = apiStore.getAllLabels();
Assert.assertNotNull(returnedLabels);
Mockito.verify(labelDao, Mockito.atLeastOnce()).getLabels();
}
use of org.wso2.carbon.apimgt.core.dao.LabelDAO in project carbon-apimgt by wso2.
the class APIStoreImplTestCase method testUpdateDedicatedGatewayWhenDedicatedGatewayIsDisabled.
@Test(description = "Update dedicated gateway when dedicated gateway is disabled")
public void testUpdateDedicatedGatewayWhenDedicatedGatewayIsDisabled() throws APIManagementException {
ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
LabelDAO labelDAO = Mockito.mock(LabelDAO.class);
API api = SampleTestObjectCreator.createDefaultAPI().lifeCycleStatus(APIStatus.PUBLISHED.getStatus()).build();
String uuid = api.getId();
Mockito.when(apiDAO.getAPI(uuid)).thenReturn(api);
String autoGenLabelName = ContainerBasedGatewayConstants.PRIVATE_JET_API_PREFIX + uuid;
APIStoreImpl apiStore = getApiStoreImpl(apiDAO, labelDAO);
DedicatedGateway dedicatedGateway = SampleTestObjectCreator.createDedicatedGateway(uuid, false, api.getCreatedBy());
apiStore.updateDedicatedGateway(dedicatedGateway);
List<String> labelSet = new ArrayList<>();
labelSet.add(autoGenLabelName);
Mockito.verify(apiDAO, Mockito.times(0)).updateDedicatedGateway(dedicatedGateway, labelSet);
}
Aggregations