From: rkv Date: Tue, 16 Oct 2012 06:59:40 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: Root_Delivery1_2012_12_06~157 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=26a17ef401f684ee0413bd4f73277e6fb9861fe1;p=tools%2Fsiman.git *** empty log message *** --- diff --git a/Workspace/DaoGenerator/bin/config.properties b/Workspace/DaoGenerator/bin/config.properties deleted file mode 100644 index 9793835..0000000 --- a/Workspace/DaoGenerator/bin/config.properties +++ /dev/null @@ -1,4 +0,0 @@ -datasource.context=../Siman-Common/src/spring/datasourceContext.xml -source.path=../Siman-Common/src/ -output.path=../Siman-Common/src/ -factory.id=simanSessionFactory diff --git a/Workspace/DaoGenerator/bin/org/siman/generator/DaoGenerator.class b/Workspace/DaoGenerator/bin/org/siman/generator/DaoGenerator.class deleted file mode 100644 index a056268..0000000 Binary files a/Workspace/DaoGenerator/bin/org/siman/generator/DaoGenerator.class and /dev/null differ diff --git a/Workspace/DaoGenerator/bin/templates/DAO.java.vm b/Workspace/DaoGenerator/bin/templates/DAO.java.vm deleted file mode 100644 index 59e05a8..0000000 --- a/Workspace/DaoGenerator/bin/templates/DAO.java.vm +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - * Company EURIWARE - * Application SIMAN - * File $Id$ - * Creation date 06.10.2012 - * @author $Author$ - * @version $Revision$ - *****************************************************************************/ - -package ${DAOPackage}; - -import ${EntityPackage}.${EntityClass}; -import org.splat.dal.dao.kernel.GenericDAO; - -/** - * ${EntityClass} DAO class implementation. - * @author Roman Kozlov (RKV) - * - */ -public interface ${EntityClass}DAO extends GenericDAO<${EntityClass}, Long> { -} diff --git a/Workspace/DaoGenerator/bin/templates/DAOImpl.java.vm b/Workspace/DaoGenerator/bin/templates/DAOImpl.java.vm deleted file mode 100644 index 42d44a8..0000000 --- a/Workspace/DaoGenerator/bin/templates/DAOImpl.java.vm +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************************** - * Company EURIWARE - * Application SIMAN - * File $Id$ - * Creation date 06.10.2012 - * @author $Author$ - * @version $Revision$ - *****************************************************************************/ - -package ${DAOPackage}; - -import ${EntityPackage}.${EntityClass}; -import org.splat.dal.dao.kernel.GenericDAOImpl; - -/** - * ${EntityClass} DAO. - * @author RKV - * - */ -public class ${EntityClass}DAOImpl extends - GenericDAOImpl<${EntityClass}, Long> implements ${EntityClass}DAO { - - /** - * {@inheritDoc} - * @see org.splat.dal.dao.kernel.GenericDAOImpl#getType() - */ - @Override - protected Class<${EntityClass}> getType() { - return ${EntityClass}.class; - } - -} \ No newline at end of file diff --git a/Workspace/DaoGenerator/bin/templates/TestKnowledgeElementDAO.java.vm b/Workspace/DaoGenerator/bin/templates/TestKnowledgeElementDAO.java.vm deleted file mode 100644 index d90ec94..0000000 --- a/Workspace/DaoGenerator/bin/templates/TestKnowledgeElementDAO.java.vm +++ /dev/null @@ -1,395 +0,0 @@ -/***************************************************************************** - * Company EURIWARE - * Application SIMAN - * File $Id$ - * Creation date 12 Oct 2012 - * @author $Author$ - * @version $Revision$ - *****************************************************************************/ -package test.splat.dao; - -import java.util.Date; - -import org.splat.dal.bo.kernel.User; -import org.splat.dal.bo.som.${EntityClass}; -import org.splat.dal.dao.som.${EntityClass}DAO; -import org.splat.kernel.InvalidPropertyException; -import org.splat.kernel.MissedPropertyException; -import org.splat.kernel.MultiplyDefinedException; -import org.splat.log.AppLogger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.orm.hibernate3.HibernateTemplate; -import org.testng.Assert; -import org.testng.annotations.Test; - -import test.splat.common.BaseTest; - -/** - * Test class for ${EntityClass}DAO. - * - * @author Roman Kozlov (RKV) - * - */ -public class Test${EntityClass}DAO extends BaseTest { - - /** - * Logger for the class. - */ - private static final AppLogger LOG = AppLogger - .getLogger(Test${EntityClass}DAO.class); - - /** - * The tested ${EntityClass}DAO. Later injected by Spring. - */ - @Autowired - @Qualifier("${DAOBean}") - private transient ${EntityClass}DAO _${DAOBean}; - - /** - * Test creation of an object.
- * Description :
- * Create an object.
- * Action :
- * 1. call DAO's create method for a good transient object.
- * 2. call DAO's create method for an object with non-zero id.
- * Test data :
- * no input parameters
- * no input parameters
- * - * Outcome results:
- * - * - * - * - * @throws InvalidPropertyException - * if an invalid property is used when creating objects - * @throws MultiplyDefinedException - * when trying to create an object with already existing id - * @throws MissedPropertyException - * if a mandatory property is not defined for an object to be created - * - */ - @Test - public void testCreate() throws InvalidPropertyException, - MissedPropertyException, MultiplyDefinedException { - LOG.debug(">>>>> BEGIN testCreate()"); - - ${EntityClass} anObject = get${EntityClass}(); - // Call DAO's create method for a good transient object. - Long id = _${DAOBean}.create(anObject); - Assert.assertNotNull(id, - "Create method returns null instead of a new id."); - Assert.assertTrue(id > 0, "The new id is not a positive number."); - ${EntityClass} anObjectFound = getHibernateTemplate().get( - ${EntityClass}.class, id); - compareObjects(anObjectFound, anObject); - - // Call DAO's create method for an object with non-zero id. - // TODO: Fill the object's properties - ${EntityClass} aBadObj = new ${EntityClass}( - (new ${EntityClass}.Properties())); - aBadObj.setIndex(anObjectFound.getIndex()); - try { - _${DAOBean}.create(aBadObj); - getHibernateTemplate().flush(); - Assert.fail("Creation with existing id must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - LOG.debug(">>>>> END testCreate()"); - } - - /** - * Test of getting an object.
- * Description :
- * Create an object and try to get it from the database.
- * Action :
- * 1. call DAO's read method for an existing id.
- * 2. call DAO's read method for a not existing id.
- * Test data :
- * no input parameters
- * no input parameters
- * - * Outcome results:
- * - * - * - * - * @throws InvalidPropertyException - * if an invalid property is used when creating objects - * @throws MultiplyDefinedException - * when trying to create an object with already existing id - * @throws MissedPropertyException - * if a mandatory property is not defined for an object to be created - * - */ - @Test - public void testGet() throws InvalidPropertyException, - MissedPropertyException, MultiplyDefinedException { - LOG.debug(">>>>> BEGIN testGet()"); - ${EntityClass} anObject = get${EntityClass}(); - // Call DAO's create method for a good transient object. - Long id = _${DAOBean}.create(anObject); - Assert.assertNotNull(id, - "Create method returns null instead of a new id."); - Assert.assertTrue(id > 0, "The new id is not a positive number."); - - // Call DAO's get method for an existing id. - ${EntityClass} anObjectFound = _${DAOBean}.get(id); - - compareObjects(anObjectFound, anObject); - - // Call DAO's get method for a not existing id. - try { - anObjectFound = _${DAOBean}.get(-1L); - getHibernateTemplate().flush(); - Assert - .fail("Getting an object with not existing id must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - try { - anObjectFound = _${DAOBean}.get(0L); - getHibernateTemplate().flush(); - Assert - .fail("Getting an object with not existing id must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - try { - anObjectFound = _${DAOBean}.get(id + 1); - getHibernateTemplate().flush(); - Assert - .fail("Getting an object with not existing id must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - LOG.debug(">>>>> END testGet()"); - } - - /** - * Test of updating an object.
- * Description :
- * Create an object and try to update it with another data.
- * Action :
- * 1. call DAO's update method for an existing id.
- * 2. call DAO's update method for a not existing id.
- * 3. call DAO's update method for wrong data.
- * Test data :
- * no input parameters
- * no input parameters
- * no input parameters
- * - * Outcome results:
- * - * - * - * - * @throws InvalidPropertyException - * if an invalid property is used when creating objects - * @throws MultiplyDefinedException - * when trying to create an object with already existing id - * @throws MissedPropertyException - * if a mandatory property is not defined for an object to be created - * - */ - @Test - public void testUpdate() throws InvalidPropertyException, - MissedPropertyException, MultiplyDefinedException { - LOG.debug(">>>>> BEGIN testUpdate()"); - ${EntityClass} anObject = get${EntityClass}(); - // Call DAO's create method for a good transient object. - Long id = _${DAOBean}.create(anObject); - Assert.assertNotNull(id, - "Create method returns null instead of a new id."); - Assert.assertTrue(id > 0, "The new id is not a positive number."); - - // Call DAO's update method for an existing id. - // TODO: Modify some object's properties to update it later -/* Assert - .assertTrue(anObject.getProgressState() != ProgressState.APPROVED, - "The initial state of the object should not be APPROVED."); - anObject.setProgressState(ProgressState.APPROVED); - anObject.setTitle(anObject.getTitle() + " updated");*/ - - _${DAOBean}.update(anObject); - - // Check that the object has been updated. - ${EntityClass} anObjectFound = _${DAOBean}.get(id); - - compareObjects(anObjectFound, anObject); - - // Call DAO's create method for an object with non-zero id. - // TODO: Fill the object's properties - ${EntityClass} aBadObj = new ${EntityClass}( - (new ${EntityClass}.Properties())); - // aBadObj.setIndex(anObjectFound.getIndex()); - try { - _${DAOBean}.update(aBadObj); - getHibernateTemplate().flush(); - Assert.fail("Update with not existing id must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - // Call update with bad data (null title). - aBadObj.setIndex(anObjectFound.getIndex()); - aBadObj.setTitle(null); - try { - _${DAOBean}.update(aBadObj); - getHibernateTemplate().flush(); - Assert.fail("Update with null title must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - // Call update with bad data (null state). - aBadObj.setTitle(anObjectFound.getTitle()); - aBadObj.setProgressState(null); - try { - _${DAOBean}.update(aBadObj); - getHibernateTemplate().flush(); - Assert.fail("Update with null state must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - LOG.debug(">>>>> END testUpdate()"); - } - - /** - * Test of deleting an object.
- * Description :
- * Create an object and try to delete it.
- * Action :
- * 1. call DAO's delete method for an existing id.
- * 2. call DAO's delete method for a not existing id.
- * Test data :
- * no input parameters
- * no input parameters
- * - * Outcome results:
- * - * - * - * - * @throws InvalidPropertyException - * if an invalid property is used when creating objects - * @throws MultiplyDefinedException - * when trying to create an object with already existing id - * @throws MissedPropertyException - * if a mandatory property is not defined for an object to be created - * - */ - @Test - public void testDelete() throws InvalidPropertyException, - MissedPropertyException, MultiplyDefinedException { - LOG.debug(">>>>> BEGIN testDelete()"); - ${EntityClass} anObject = get${EntityClass}(); - // Call DAO's create method for a good transient object. - Long id = _${DAOBean}.create(anObject); - Assert.assertNotNull(id, - "Create method returns null instead of a new id."); - Assert.assertTrue(id > 0, "The new id is not a positive number."); - - // Call DAO's delete method for an existing id. - _${DAOBean}.delete(anObject); - - // Check that the object has been deleted. - ${EntityClass} anObjectFound = _${DAOBean}.get(id); - - Assert.assertNull(anObjectFound, "Deleted object must not be found."); - // Call DAO's delete method for a not existing id. - try { - _${DAOBean}.delete(anObject); - getHibernateTemplate().flush(); - Assert.fail("Delete with with not existing id must be failed."); - } catch (Exception e) { - LOG.debug("Expected exception is thrown: " - + e.getClass().getSimpleName() + ": " + e.getMessage()); - } - LOG.debug(">>>>> END testDelete()"); - } - - /** - * Create a transient ${EntityClass} for tests. - * - * @return a transient ${EntityClass} - * @throws InvalidPropertyException - * if an invalid property is used when creating objects - * @throws MultiplyDefinedException - * when trying to create an object with already existing id - * @throws MissedPropertyException - * if a mandatory property is not defined for an object to be created - */ - private ${EntityClass} get${EntityClass}() - throws InvalidPropertyException, MissedPropertyException, - MultiplyDefinedException { - // Create a test knowledge type - HibernateTemplate ht = getHibernateTemplate(); - - ${EntityClass}.Properties kprops = new ${EntityClass}.Properties(); - // Prepare a transient object - - return new ${EntityClass}(kprops); - } - - /** - * Check that given objects are equal. - * - * @param anActual - * the object to check - * @param anExpected - * the expected object - */ - private void compareObjects(${EntityClass} anActual, - ${EntityClass} anExpected) { - Assert.assertNotNull(anActual, - "Created object is not found in the database."); - Assert.assertEquals(anActual.getAuthor(), anExpected.getAuthor(), - "object author is not saved."); - Assert.assertEquals(anActual.getDate(), anExpected.getDate(), - "object date is not saved."); - Assert - .assertEquals(anActual.getOwnerScenario(), anExpected - .getOwnerScenario(), - "object scenario is not saved."); - Assert.assertEquals(anActual.getProgressState(), anExpected - .getProgressState(), "object state is not saved."); - Assert.assertEquals(anActual.getTitle(), anExpected.getTitle(), - "object title is not saved."); - Assert.assertEquals(anActual.getType(), anExpected.getType(), - "object type is not saved."); - Assert.assertEquals(anActual.getValue(), anExpected.getValue(), - "object value is not saved."); - Assert.assertEquals(anActual.getIndex(), anExpected.getIndex(), - "object index is not saved."); - } -} diff --git a/Workspace/DaoGenerator/bin/templates/daoContext.xml.vm b/Workspace/DaoGenerator/bin/templates/daoContext.xml.vm deleted file mode 100644 index d748ec4..0000000 --- a/Workspace/DaoGenerator/bin/templates/daoContext.xml.vm +++ /dev/null @@ -1,14 +0,0 @@ - - - -#foreach( $dao in $daos ) - - - -#end - \ No newline at end of file