Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/controllers/currency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11839/src/test/org/neuclear/asset/controllers/currency Modified Files: CurrencyTests.java Added Files: HibernateCurrencyTests.java PrevalentCurrencyTests.java Removed Files: PersistentCurrencyTests.java Log Message: Added Hibernate and Prevalent tests for Currency Controllers Index: CurrencyTests.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/controllers/currency/CurrencyTests.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CurrencyTests.java 6 Apr 2004 23:01:01 -0000 1.10 --- CurrencyTests.java 12 Apr 2004 15:27:52 -0000 1.11 *************** *** 28,31 **** --- 28,32 ---- import org.neuclear.tests.AbstractSigningTest; + import java.io.IOException; import java.security.GeneralSecurityException; import java.util.Date; *************** *** 37,55 **** */ public class CurrencyTests extends AbstractSigningTest { - public CurrencyTests(final String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException { - this(s, new SimpleLedger("asset"), new SimpleLedger("test")); - } ! public CurrencyTests(final String s, final Ledger assetLedger, final Ledger auditLedger) throws LowlevelLedgerException, GeneralSecurityException, NeuClearException { super(s); asset = createTestAsset(); shoes = createShoeAsset(); agent = createTestExchangeAgent(); ! ledger = assetLedger; proc = new CurrencyController(ledger, asset, getSigner(), "neu://test/bux"); - this.auditLedger = auditLedger; auditor = new Auditor(asset, auditLedger); } public void testTransfer() throws InvalidTransferException, NeuClearException, InvalidTransactionException, LowlevelLedgerException { fundAccount(); --- 38,81 ---- */ public class CurrencyTests extends AbstractSigningTest { ! public CurrencyTests(final String s) throws LowlevelLedgerException, GeneralSecurityException, NeuClearException { super(s); asset = createTestAsset(); shoes = createShoeAsset(); agent = createTestExchangeAgent(); ! } ! ! /** ! * Sets up the fixture, for example, open a network connection. ! * This method is called before a test is executed. ! */ ! protected void setUp() throws Exception { ! ledger = createControllerLedger(); ! auditLedger = createAuditLedger(); proc = new CurrencyController(ledger, asset, getSigner(), "neu://test/bux"); auditor = new Auditor(asset, auditLedger); } + protected Ledger createControllerLedger() throws IOException, ClassNotFoundException, LowlevelLedgerException { + return new SimpleLedger("asset"); + } + + protected Ledger createAuditLedger() { + return new SimpleLedger("audit"); + } + + /** + * Tears down the fixture, for example, close a network connection. + * This method is called after a test is executed. + */ + protected void tearDown() throws Exception { + proc = null; + auditor = null; + ledger.close(); + auditLedger.close(); + ledger = null; + auditLedger = null; + } + public void testTransfer() throws InvalidTransferException, NeuClearException, InvalidTransactionException, LowlevelLedgerException { fundAccount(); --- NEW FILE: PrevalentCurrencyTests.java --- package org.neuclear.asset.controllers.currency; import org.neuclear.commons.NeuClearException; import org.neuclear.ledger.Ledger; import org.neuclear.ledger.LowlevelLedgerException; import org.neuclear.ledger.prevalent.PrevalentLedger; import java.io.IOException; import java.security.GeneralSecurityException; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: PrevalentCurrencyTests.java,v 1.1 2004/04/12 15:27:52 pelle Exp $ $Log: PrevalentCurrencyTests.java,v $ Revision 1.1 2004/04/12 15:27:52 pelle Added Hibernate and Prevalent tests for Currency Controllers Revision 1.1 2004/04/06 23:01:01 pelle Create new PrevalentCurrencyTests TestCase for doing integration testing with various persistent ledgers. */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 8:11:02 PM */ public class PrevalentCurrencyTests extends CurrencyTests { public PrevalentCurrencyTests(String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException, IOException, ClassNotFoundException { super(s); } protected Ledger createControllerLedger() throws IOException, ClassNotFoundException { return new PrevalentLedger("asset", "target/test-data/pl"); } } --- PersistentCurrencyTests.java DELETED --- --- NEW FILE: HibernateCurrencyTests.java --- package org.neuclear.asset.controllers.currency; import org.neuclear.commons.NeuClearException; import org.neuclear.ledger.Ledger; import org.neuclear.ledger.LowlevelLedgerException; import org.neuclear.ledger.hibernate.HibernateLedger; import java.io.IOException; import java.security.GeneralSecurityException; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: HibernateCurrencyTests.java,v 1.1 2004/04/12 15:27:52 pelle Exp $ $Log: HibernateCurrencyTests.java,v $ Revision 1.1 2004/04/12 15:27:52 pelle Added Hibernate and Prevalent tests for Currency Controllers Revision 1.1 2004/04/06 23:01:01 pelle Create new PrevalentCurrencyTests TestCase for doing integration testing with various persistent ledgers. */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 8:11:02 PM */ public class HibernateCurrencyTests extends CurrencyTests { public HibernateCurrencyTests(String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException, IOException, ClassNotFoundException { super(s); } protected Ledger createControllerLedger() throws IOException, ClassNotFoundException, LowlevelLedgerException { return new HibernateLedger("test"); } } |