use of org.wso2.carbon.lcm.sql.beans.LifecycleHistoryBean in project carbon-apimgt by wso2.
the class APIPublisherImplTestCase method testGetLifeCycleEvents.
@Test(description = "Get lifecycle events list of an API")
public void testGetLifeCycleEvents() throws APIManagementException, LifecycleException {
ApiDAO apiDAO = Mockito.mock(ApiDAO.class);
APILifecycleManager apiLifecycleManager = Mockito.mock(APILifecycleManager.class);
APIGateway gateway = Mockito.mock(APIGateway.class);
APIPublisherImpl apiPublisher = getApiPublisherImpl(apiDAO, apiLifecycleManager, gateway);
API api = SampleTestObjectCreator.createDefaultAPI().build();
String uuid = api.getId();
String lifecycleId = api.getLifecycleInstanceId();
List<LifecycleHistoryBean> lifecycleHistoryBeanList = new ArrayList<>();
LifecycleHistoryBean bean = new LifecycleHistoryBean();
bean.setPreviousState(APIStatus.CREATED.getStatus());
bean.setPostState(APIStatus.DEPRECATED.getStatus());
bean.setUser(USER);
lifecycleHistoryBeanList.add(bean);
Mockito.when(apiDAO.getAPISummary(uuid)).thenReturn(api);
Mockito.doReturn(lifecycleHistoryBeanList).when(apiLifecycleManager).getLifecycleHistory(lifecycleId);
apiPublisher.getLifeCycleEvents(uuid);
}
Aggregations