use of org.wso2.carbon.apimgt.core.dao.ApplicationDAO in project carbon-apimgt by wso2.
the class TestUtil method addTestApplication.
public static Application addTestApplication() throws APIMgtDAOException {
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
Application application = SampleTestObjectCreator.createDefaultApplication();
applicationDAO.addApplication(application);
return application;
}
use of org.wso2.carbon.apimgt.core.dao.ApplicationDAO in project carbon-apimgt by wso2.
the class TestUtil method addTestApplicationWithPermissions.
public static Application addTestApplicationWithPermissions() throws APIMgtDAOException {
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
Application application = SampleTestObjectCreator.createApplicationWithPermissions();
applicationDAO.addApplication(application);
return application;
}
use of org.wso2.carbon.apimgt.core.dao.ApplicationDAO in project carbon-apimgt by wso2.
the class ApplicationDAOImplIT method testGetApplicationByName.
@Test
public void testGetApplicationByName() throws Exception {
// add app
Application app = TestUtil.addTestApplication();
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
// get app by name
Application appFromDB = applicationDAO.getApplicationByName(app.getName(), app.getCreatedUser());
Assert.assertNotNull(appFromDB);
// compare
Assert.assertEquals(appFromDB, app, TestUtil.printDiff(appFromDB, app));
validateAppTimestamps(appFromDB, app);
}
use of org.wso2.carbon.apimgt.core.dao.ApplicationDAO in project carbon-apimgt by wso2.
the class ApplicationDAOImplIT method testUpdateApplicationWithPermissions.
@Test
public void testUpdateApplicationWithPermissions() throws Exception {
// add new app
Application currentApp = TestUtil.addTestApplication();
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
// create new app with permissions
HashMap permissionMap = new HashMap();
permissionMap.put(APIMgtConstants.Permission.UPDATE, APIMgtConstants.Permission.UPDATE_PERMISSION);
Application newApp = SampleTestObjectCreator.createAlternativeApplication();
newApp.setId(currentApp.getId());
newApp.setCreatedTime(currentApp.getCreatedTime());
newApp.setPermissionMap(permissionMap);
// update app
applicationDAO.updateApplication(currentApp.getId(), newApp);
// get app
Application appFromDB = applicationDAO.getApplication(newApp.getId());
Assert.assertNotNull(appFromDB);
// compare
Assert.assertEquals(appFromDB, newApp, TestUtil.printDiff(appFromDB, newApp));
validateAppTimestamps(appFromDB, newApp);
}
use of org.wso2.carbon.apimgt.core.dao.ApplicationDAO in project carbon-apimgt by wso2.
the class ApplicationDAOImplIT method testIsApplicationNameExists.
@Test
public void testIsApplicationNameExists() throws Exception {
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
// check for a non-existing application
Assert.assertFalse(applicationDAO.isApplicationNameExists("ExistingApp"));
// add new app
Application app = TestUtil.addTestApplication();
// check for the existing application
Assert.assertTrue(applicationDAO.isApplicationNameExists(app.getName()));
}
Aggregations