]> SALOME platform Git repositories - tools/siman.git/commitdiff
Salome HOME
*** empty log message ***
authorrkv <rkv@opencascade.com>
Tue, 16 Oct 2012 06:59:40 +0000 (06:59 +0000)
committerrkv <rkv@opencascade.com>
Tue, 16 Oct 2012 06:59:40 +0000 (06:59 +0000)
Workspace/DaoGenerator/bin/config.properties [deleted file]
Workspace/DaoGenerator/bin/org/siman/generator/DaoGenerator.class [deleted file]
Workspace/DaoGenerator/bin/templates/DAO.java.vm [deleted file]
Workspace/DaoGenerator/bin/templates/DAOImpl.java.vm [deleted file]
Workspace/DaoGenerator/bin/templates/TestKnowledgeElementDAO.java.vm [deleted file]
Workspace/DaoGenerator/bin/templates/daoContext.xml.vm [deleted file]

diff --git a/Workspace/DaoGenerator/bin/config.properties b/Workspace/DaoGenerator/bin/config.properties
deleted file mode 100644 (file)
index 9793835..0000000
+++ /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 (file)
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 (file)
index 59e05a8..0000000
+++ /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 <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
- *
- */
-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 (file)
index 42d44a8..0000000
+++ /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 (file)
index d90ec94..0000000
+++ /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 <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
- * 
- */
-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.<BR>
-        * <B>Description :</B> <BR>
-        * <i>Create an object.</i><BR>
-        * <B>Action : </B><BR>
-        * <i>1. call DAO's create method for a good transient object.</i><BR>
-        * <i>2. call DAO's create method for an object with non-zero id.</i><BR>
-        * <B>Test data : </B><BR>
-        * <i>no input parameters</i><BR>
-        * <i>no input parameters</i><BR>
-        * 
-        * <B>Outcome results:</B><BR>
-        * <i>
-        * <ul>
-        * <li>Object is created in the database successfully<BR>
-        * </li>
-        * <li>Exception is thrown<BR>
-        * </li>
-        * </ul>
-        * </i>
-        * 
-        * @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.<BR>
-        * <B>Description :</B> <BR>
-        * <i>Create an object and try to get it from the database.</i><BR>
-        * <B>Action : </B><BR>
-        * <i>1. call DAO's read method for an existing id.</i><BR>
-        * <i>2. call DAO's read method for a not existing id.</i><BR>
-        * <B>Test data : </B><BR>
-        * <i>no input parameters</i><BR>
-        * <i>no input parameters</i><BR>
-        * 
-        * <B>Outcome results:</B><BR>
-        * <i>
-        * <ul>
-        * <li>Object is found in the database successfully<BR>
-        * </li>
-        * <li>Exception is thrown<BR>
-        * </li>
-        * </ul>
-        * </i>
-        * 
-        * @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.<BR>
-        * <B>Description :</B> <BR>
-        * <i>Create an object and try to update it with another data.</i><BR>
-        * <B>Action : </B><BR>
-        * <i>1. call DAO's update method for an existing id.</i><BR>
-        * <i>2. call DAO's update method for a not existing id.</i><BR>
-        * <i>3. call DAO's update method for wrong data.</i><BR>
-        * <B>Test data : </B><BR>
-        * <i>no input parameters</i><BR>
-        * <i>no input parameters</i><BR>
-        * <i>no input parameters</i><BR>
-        * 
-        * <B>Outcome results:</B><BR>
-        * <i>
-        * <ul>
-        * <li>Object is update in the database successfully<BR>
-        * </li>
-        * <li>Exception is thrown<BR>
-        * </li>
-        * <li>Exception is thrown<BR>
-        * </li>
-        * </ul>
-        * </i>
-        * 
-        * @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.<BR>
-        * <B>Description :</B> <BR>
-        * <i>Create an object and try to delete it.</i><BR>
-        * <B>Action : </B><BR>
-        * <i>1. call DAO's delete method for an existing id.</i><BR>
-        * <i>2. call DAO's delete method for a not existing id.</i><BR>
-        * <B>Test data : </B><BR>
-        * <i>no input parameters</i><BR>
-        * <i>no input parameters</i><BR>
-        * 
-        * <B>Outcome results:</B><BR>
-        * <i>
-        * <ul>
-        * <li>Object is found in the database successfully<BR>
-        * </li>
-        * <li>Exception is thrown<BR>
-        * </li>
-        * </ul>
-        * </i>
-        * 
-        * @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 (file)
index d748ec4..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-http://www.springframework.org/schema/beans
-http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-
-#foreach( $dao in $daos )
-    <bean id="$dao.beanName" parent="genericDAO"
-        class="$dao.implClass">
-    </bean>
-    
-#end
-</beans>
\ No newline at end of file