r3389 - in trunk: lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/test/java/org/chorem/lima/business lima-business/src/test/java/org/chorem/lima/business/accountingrules lima-business/src/test/java/org/chorem/lima/entity lima-callao/src/main/java/org/chorem/lima/entity
Author: echatellier Date: 2012-04-24 18:25:00 +0200 (Tue, 24 Apr 2012) New Revision: 3389 Url: http://chorem.org/repositories/revision/lima/3389 Log: Test may be now fixed, but styll unstable between maven and IDE :( Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-04-24 14:50:09 UTC (rev 3388) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2012-04-24 16:25:00 UTC (rev 3389) @@ -66,13 +66,13 @@ String accountNumber = account.getAccountNumber(); // ledger account must be located in 411 account - if (!StringUtils.isNumeric(accountNumber) && accountNumber.startsWith("4")) { + if (!StringUtils.isNumeric(accountNumber) && !accountNumber.startsWith("4")) { throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountnumbernotnumeric", account.getAccountNumber())); } // Check root account starts with 1 to 8 - if (accountNumber.length() == 1 && accountNumber.matches("[1-8]")) { + if (accountNumber.length() == 1 && !accountNumber.matches("[1-8]")) { throw new LimaBusinessException(_("lima-business.franceaccountingrules.accountstartnumbererror", account.getAccountNumber())); } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java 2012-04-24 14:50:09 UTC (rev 3388) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java 2012-04-24 16:25:00 UTC (rev 3389) @@ -35,6 +35,7 @@ import org.chorem.lima.entity.FinancialTransactionImpl; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.math.BigDecimal; @@ -43,7 +44,11 @@ /** * Test le service de génération des reports. + * + * FIXME echatellier 20120424 les tests sont désactivés car le code qui genere + * les rapports dans ReportService est commenté. */ +@Ignore public class ReportServiceImplTest extends AbstractLimaTest { @Before Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2012-04-24 14:50:09 UTC (rev 3388) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2012-04-24 16:25:00 UTC (rev 3389) @@ -67,10 +67,9 @@ * @throws LimaException */ @Test(expected=LimaException.class) - @Override - public void testCreateAccountWrongNumber() throws LimaException { + public void testCreateAccountWrongStart() throws LimaException { Account myAccount = new AccountImpl(); - myAccount.setAccountNumber("42"); + myAccount.setAccountNumber("10TEST"); accountService.createAccount(myAccount); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2012-04-24 14:50:09 UTC (rev 3388) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2012-04-24 16:25:00 UTC (rev 3389) @@ -27,6 +27,7 @@ import org.chorem.lima.business.ReportServiceImplTest; import org.junit.Assert; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; /** @@ -41,7 +42,10 @@ * * Last update : $Date$ * By : $Author$ + * + * FIXME echatellier 20120424 fix parent test first */ +@Ignore public class ReportServiceRuleFrTest extends ReportServiceImplTest { @BeforeClass Modified: trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2012-04-24 14:50:09 UTC (rev 3388) +++ trunk/lima-business/src/test/java/org/chorem/lima/entity/AccountDAOTest.java 2012-04-24 16:25:00 UTC (rev 3389) @@ -27,7 +27,9 @@ import org.chorem.lima.business.AbstractLimaTest; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; +import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import java.util.List; @@ -43,18 +45,30 @@ */ public class AccountDAOTest extends AbstractLimaTest { + @Before + public void initTest() throws Exception { + initTestDatabase(); + } + /** * Test la recherche de compte par interval. * @throws TopiaException */ @Test public void testStringToListAccounts() throws TopiaException { - AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(getTestContext()); + TopiaContext tx = getTestContext().beginTransaction(); + AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(tx); + List<Account> accounts = accountDAO.stringToListAccounts("50..511", false); - Assert.assertEquals(3, accounts.size()); + for (Account account : accounts) { + System.out.println(account.getAccountNumber()); + } + Assert.assertEquals(5, accounts.size()); accounts = accountDAO.stringToListAccounts("60..99", false); Assert.assertEquals(0, accounts.size()); + + tx.closeContext(); } } Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-24 14:50:09 UTC (rev 3388) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/AccountDAO.java 2012-04-24 16:25:00 UTC (rev 3389) @@ -88,8 +88,9 @@ */ protected List<Account> findIntervalAccountByNumber(String accountNumberLow, String accountNumberHigh) throws TopiaException { - String query = "FROM " + Account.class.getName() + " WHERE ? < accountNumber AND accountNumber > ?"; - return (List<Account>) context.find(query, accountNumberLow, accountNumberHigh); + String query = "FROM " + Account.class.getName() + " WHERE :accountNumberLow <= accountNumber AND accountNumber <= :accountNumberHigh"; + return (List<Account>) context.find(query, "accountNumberLow", + accountNumberLow, "accountNumberHigh", accountNumberHigh); } /**
participants (1)
-
echatellier@users.chorem.org