[Suiviobsmer-commits] r851 - in trunk: wao-business/src/test/java/fr/ifremer/wao wao-business/src/test/resources wao-ui/src/test/resources
Author: bleny Date: 2010-12-23 14:49:12 +0000 (Thu, 23 Dec 2010) New Revision: 851 Log: remove strange file Removed: trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java Modified: trunk/wao-business/src/test/resources/log4j.properties trunk/wao-ui/src/test/resources/log4j.properties Deleted: trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java 2010-12-23 14:48:19 UTC (rev 850) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/ErrorDB1_0Test.java 2010-12-23 14:49:12 UTC (rev 851) @@ -1,165 +0,0 @@ -/* - * #%L - * Wao :: Business - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -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 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.DateUtil; - -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; - -/** - * 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 <fdesbois at codelutin.com> - */ - at Ignore -public class ErrorDB1_0Test { - - private static TestManager manager; - - //FIXME tchemit 2010-10-13 : on ne met pas ce genre d'objet en attibut, ou bien on s'assure qu'ils seront bien fermer dans une AfterClass - private static Writer writerAll; - - private static Writer writerKos; - - public ErrorDB1_0Test() { - manager = new TestManager(); - } - - @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 ArgumentsParserException { - manager.start(); - } - - @After - public void tearDown() throws TopiaException { - manager.stop(); - } - - @Test - public void testExecute() throws Exception { - - TopiaContext transaction = - manager.getContext().beginTransaction(); - - ContactDAO dao = WaoDAOHelper.getContactDAO(transaction); - - - SampleRowDAO rowDAO = WaoDAOHelper.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.PROPERTY_TIDE_BEGIN_DATE; - - String sampleRow = contact + "." + Contact.PROPERTY_SAMPLE_ROW; - query.addEquals(sampleRow, curr); - - query.addGroup(sampleRow); - - for (SampleMonth month : curr.getSampleMonth()) { - Date begin = DateUtil.setFirstDayOfMonth(month.getPeriodDate()); - Date end = DateUtil.setLastDayOfMonth(month.getPeriodDate()); - - query.addWhere(tideBegin + " BETWEEN :begin AND :end"). - addParam("begin", begin).addParam("end", end); - - int nbRealTides = dao.countByQuery(query); - - 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(); - } - -} Modified: trunk/wao-business/src/test/resources/log4j.properties =================================================================== --- trunk/wao-business/src/test/resources/log4j.properties 2010-12-23 14:48:19 UTC (rev 850) +++ trunk/wao-business/src/test/resources/log4j.properties 2010-12-23 14:49:12 UTC (rev 851) @@ -31,6 +31,6 @@ log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d [%p] %c{2} %m%n -log4j.logger.fr.ifremer.wao=INFO +log4j.logger.fr.ifremer.wao=DEBUG log4j.logger.org.nuiton.util=INFO log4j.logger.org.nuiton.util.beans.BinderProvider=ERROR Modified: trunk/wao-ui/src/test/resources/log4j.properties =================================================================== --- trunk/wao-ui/src/test/resources/log4j.properties 2010-12-23 14:48:19 UTC (rev 850) +++ trunk/wao-ui/src/test/resources/log4j.properties 2010-12-23 14:49:12 UTC (rev 851) @@ -30,5 +30,9 @@ #log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss} %5p (%F:%L) %m%n log4j.appender.console.Threshold=DEBUG -log4j.logger.test.fr.ifremer.wao=DEBUG +#log4j.logger.test.fr.ifremer.wao=INFO +#log4j.logger.fr.ifremer.wao=INFO +log4j.logger.test.fr.ifremer.wao=TRACE log4j.logger.fr.ifremer.wao=TRACE + +log4j.logger.org.apache.tapestry5.internal.pageload=INFO
participants (1)
-
bleny@users.labs.libre-entreprise.org