Author: fdesbois
Date: 2010-03-01 22:03:37 +0000 (Mon, 01 Mar 2010)
New Revision: 366
Added:
trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java
Removed:
trunk/wao-business/src/main/resources/oldmappings/
Modified:
trunk/changelog.txt
trunk/pom.xml
trunk/wao-business/pom.xml
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ContactDAOImpl.java
trunk/wao-ui/pom.xml
Log:
- Ano #2124 : problem with contact unvalidation : problem in nuiton-utils DateUtils class -> change version to 1.1.5
- Change version snapshot to 1.0.1 to release
- Delete oldmappings (no migration needed yet)
- Add test class for contact errors involved by ano #2124
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2010-02-17 13:30:02 UTC (rev 365)
+++ trunk/changelog.txt 2010-03-01 22:03:37 UTC (rev 366)
@@ -3,6 +3,12 @@
Historique des versions
+1.0.1 (patch)
+-------------
+
+- [fdesbois] Ano #2124 : Problème sur la dévalidation d'une ligne de contact
+ Changement de version de Nuiton-utils vers 1.1.5
+
1.0.0
-----
@@ -52,15 +58,9 @@
Ceci permet de modifier l'ensemble des topiaId existants pour garder la
cohérence avec la version 1.0.
-0.4.1
------
+0.4.1 (patch)
+-------------
-Evolutions
-++++++++++
-
-Anomalies
-+++++++++
-
- [fdesbois] Ano #2073 : Contacts : Erreur tableau contact sur commentaire refus
0.4.0
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-17 13:30:02 UTC (rev 365)
+++ trunk/pom.xml 2010-03-01 22:03:37 UTC (rev 366)
@@ -15,7 +15,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
<modules>
<module>wao-ui</module>
@@ -214,7 +214,7 @@
<labs.id>154</labs.id>
<!-- libraries version -->
- <nuitonutils.version>1.1.3</nuitonutils.version>
+ <nuitonutils.version>1.1.5</nuitonutils.version>
<topia.version>2.3.0-beta-8</topia.version>
<eugene.version>2.0.0-beta-4</eugene.version>
<tapestry.version>5.1.0.5</tapestry.version>
Modified: trunk/wao-business/pom.xml
===================================================================
--- trunk/wao-business/pom.xml 2010-02-17 13:30:02 UTC (rev 365)
+++ trunk/wao-business/pom.xml 2010-03-01 22:03:37 UTC (rev 366)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.wao</groupId>
@@ -140,7 +140,7 @@
<goal>smart-generate</goal>
</goals>
</execution>
- <execution>
+<!-- <execution>
<phase>generate-sources</phase>
<id>copy-version-files</id>
<configuration>
@@ -153,7 +153,7 @@
<goals>
<goal>copyVersionFiles</goal>
</goals>
- </execution>
+ </execution>-->
</executions>
</plugin>
</plugins>
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ContactDAOImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ContactDAOImpl.java 2010-02-17 13:30:02 UTC (rev 365)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/ContactDAOImpl.java 2010-03-01 22:03:37 UTC (rev 366)
@@ -70,8 +70,8 @@
* Only the validate contacts by company will be count. The param fromDate can be null,
* in this case, all contacts will be given (no matter which date then started).
*
- * @param boat the boat concerned by the contact
- * @param fromDate the date to start
+ * @param boat the boat concerned by the contact (can be null)
+ * @param fromDate the date to start (can be null)
* @return the TopiaQuery created
*/
@Override
@@ -79,6 +79,7 @@
TopiaQuery query = createQuery("C").
add("C." + Contact.STATE, ContactState.BOARDING_DONE.toString()).
add("C." + Contact.VALIDATION_COMPANY, Boolean.TRUE).
+ // TODO : use addNullOr method with Topia version 2.3.0-beta-9
add("C." + Contact.VALIDATION_PROGRAM + " IS NULL OR " + "C." + Contact.VALIDATION_PROGRAM + " = :booleanTrue").
addParam("booleanTrue", Boolean.TRUE);
Added: trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java
===================================================================
--- trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java (rev 0)
+++ trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java 2010-03-01 22:03:37 UTC (rev 366)
@@ -0,0 +1,148 @@
+
+package fr.ifremer.wao;
+
+import fr.ifremer.wao.entity.Contact;
+import fr.ifremer.wao.entity.ContactDAO;
+import fr.ifremer.wao.entity.SampleMonth;
+import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.SampleRowDAO;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.Writer;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.apache.commons.io.IOUtils;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.util.ArgumentsParserException;
+import org.nuiton.util.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ErrorDB1_0
+ *
+ * Error #2124 : problem with between comparison to give the correct SampleMonth
+ * from a given contact date.
+ *
+ * This problem may cause errors in database on sampleRow.realTideTime calcul.
+ *
+ * This class is used to test all sampleRows who have a bad calcul on contacts.
+ *
+ * Created: 1 mars 2010
+ *
+ * @author fdesbois
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$
+ * par : $Author$
+ */
+ at Ignore
+public class ErrorDB1_0Test {
+
+ private static WaoRunner runner;
+
+ private static final Logger log = LoggerFactory.getLogger(ErrorDB1_0Test.class);
+
+ private static Writer writerAll;
+
+ private static Writer writerKos;
+
+ public ErrorDB1_0Test() {
+ runner = new WaoRunnerImpl();
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ String filename = "/tmp/wao/test_db/error_db1";
+ File file = new File(filename);
+ file.getParentFile().mkdirs();
+ if (file.exists()) {
+ file.delete();
+ file.createNewFile();
+ }
+ writerAll = new BufferedWriter(new FileWriter(filename));
+ writerKos = new BufferedWriter(new FileWriter(filename + "_ko"));
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+
+ }
+
+ @Before
+ public void setUp() throws WaoException, ArgumentsParserException {
+ runner.start();
+ }
+
+ @After
+ public void tearDown() throws WaoException, TopiaException {
+ runner.stop();
+ }
+
+ @Test
+ public void testExecute() throws Exception {
+
+ TopiaContext transaction =
+ WaoContext.getTopiaRootContext().beginTransaction();
+
+ ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction);
+
+
+ SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction);
+
+ DateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
+
+ for (SampleRow curr : rowDAO.findAll()) {
+ TopiaQuery query =
+ dao.createQueryDoneContactsFromDate(null, null);
+ String contact = query.getMainAlias();
+ String tideBegin = contact + "." + Contact.TIDE_BEGIN_DATE;
+
+ String sampleRow = contact + "." + Contact.SAMPLE_ROW;
+ query.add(sampleRow, curr);
+
+ query.addGroup(sampleRow);
+
+ for (SampleMonth month : curr.getSampleMonth()) {
+ Date begin = DateUtils.setFirstDayOfMonth(month.getPeriodDate());
+ Date end = DateUtils.setLastDayOfMonth(month.getPeriodDate());
+
+ query.add(tideBegin + " BETWEEN :begin AND :end").
+ addParam("begin", begin).addParam("end", end);
+
+ int nbRealTides = query.executeCount();
+
+ boolean ok = month.getRealTidesValue() == nbRealTides;
+ String ko = ok ? "" : "## KO ";
+
+ String msg = "[" + curr.getCode() + "] " +
+ dateFormat.format(month.getPeriodDate()) + " : " +
+ "currValue = " + month.getRealTidesValue() + " _ " +
+ "expectedValue = " + nbRealTides + "\n";
+
+ if (!ok) {
+ writerKos.write(msg);
+ writerKos.flush();
+ }
+
+ writerAll.write(ko + msg);
+ writerAll.flush();
+ }
+ }
+
+ IOUtils.closeQuietly(writerAll);
+ IOUtils.closeQuietly(writerKos);
+ transaction.closeContext();
+ }
+
+}
Property changes on: trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Modified: trunk/wao-ui/pom.xml
===================================================================
--- trunk/wao-ui/pom.xml 2010-02-17 13:30:02 UTC (rev 365)
+++ trunk/wao-ui/pom.xml 2010-03-01 22:03:37 UTC (rev 366)
@@ -10,7 +10,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <version>1.0.1-SNAPSHOT</version>
</parent>
<groupId>fr.ifremer.wao</groupId>