use of com.agiletec.aps.services.mock.MockResourcesDAO in project entando-core by entando.
the class TestResourceDAO method testAddDeleteResource.
public void testAddDeleteResource() throws Throwable {
DataSource dataSource = (DataSource) this.getApplicationContext().getBean("portDataSource");
MockResourcesDAO mockResourcesDao = new MockResourcesDAO();
mockResourcesDao.setDataSource(dataSource);
ResourceInterface resource = new ImageResource();
resource.setId("temp");
resource.setDescr("temp");
resource.setMainGroup(Group.FREE_GROUP_NAME);
resource.setType("Image");
resource.setFolder("/temp");
// resource.setBaseURL("temp");
ResourceRecordVO resourceRecordVO = null;
try {
mockResourcesDao.deleteResource("temp");
} catch (Throwable t) {
throw t;
}
_resourceDao.addResource(resource);
resourceRecordVO = _resourceDao.loadResourceVo(resource.getId());
assertEquals(resourceRecordVO.getDescr().equals("temp"), true);
_resourceDao.deleteResource(resource.getId());
resourceRecordVO = _resourceDao.loadResourceVo(resource.getId());
assertNull(resourceRecordVO);
}
Aggregations