org.neuclear.ledger.tests
Class AbstractLedgerTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.neuclear.ledger.tests.AbstractLedgerTest
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractLedgerTest
extends junit.framework.TestCase

(C) 2003 Antilles Software Ventures SA User: pelleb Date: Jan 22, 2003 Time: 4:18:35 PM $Id: AbstractLedgerTest.java,v 1.16 2004/07/23 18:55:27 pelle Exp $ $Log: AbstractLedgerTest.java,v $ Revision 1.16 2004/07/23 18:55:27 pelle Added an improved complete method which allows you to specify a book to change to another book when completing a transaction. This is used by the NeuClear Pay Complete Exchange Order process which changes the benificiary book from the agent to the final recipient. Revision 1.15 2004/06/17 15:18:32 pelle Added support for Ledger object within the LedgerController. This is only really implemented in the HibernateLedgerController.

Revision 1.14 2004/05/03 23:54:18 pelle HibernateLedgerController now supports multiple ledgers. Fixed many unit tests.

Revision 1.13 2004/05/01 00:23:40 pelle Added Ledger field to Transaction as well as to getBalance() and friends.

Revision 1.12 2004/04/27 15:23:54 pelle Due to a new API change in 0.5 I have changed the name of Ledger and it's implementers to LedgerController.

Revision 1.11 2004/04/23 19:09:16 pelle Lots of cleanups and improvements to the userinterface and look of the bux application.

Revision 1.10 2004/04/19 18:57:27 pelle Updated Ledger to support more advanced book information. You can now create a book or fetch a book by doing getBook(String id) on the ledger. You can register a book or upddate an existing one using registerBook() SimpleLedger now works and passes all tests. HibernateLedger has been implemented, but there are a few things that dont work yet.

Revision 1.9 2004/04/12 19:26:37 pelle Hibernate and Pervayler implementations of the Ledger all pass now for both currency and ledger tests.

Revision 1.8 2004/04/06 22:50:14 pelle Updated Unit Tests

Revision 1.7 2004/04/05 22:06:46 pelle added setHeldReceiptId() method to ledger

Revision 1.6 2004/03/31 23:11:09 pelle Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach.

Revision 1.5 2004/03/25 21:39:43 pelle Modified expire tests a bit to eliminate one cause for an error

Revision 1.4 2004/03/25 19:03:23 pelle PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why.

Revision 1.3 2004/03/25 16:44:21 pelle Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql.

Revision 1.2 2004/03/24 23:12:34 pelle Working on Hibernate Implementation.

Revision 1.1 2004/03/22 23:20:51 pelle Working on Hibernate Implementation.

Revision 1.2 2004/03/22 21:59:38 pelle SimpleLedger now passes all unit tests

Revision 1.1 2004/03/22 20:08:24 pelle Added simple ledger for unit testing and in memory use

Revision 1.12 2004/03/22 17:33:02 pelle Added a verified transfer to neuclear-ledger. Added InsufficientFundsException to be thrown if transfer isnt verified. HeldTransfers also are now verified.

Revision 1.11 2004/03/21 00:48:36 pelle The problem with Enveloped signatures has now been fixed. It was a problem in the way transforms work. I have bandaided it, but in the future if better support for transforms need to be made, we need to rethink it a bit. Perhaps using the new crypto channel's in neuclear-commons.

Revision 1.10 2004/01/02 23:18:35 pelle Added StatementFactory pattern and refactored the ledger to use it.

Revision 1.9 2003/12/31 00:39:05 pelle Added Drivers for handling different Database dialects in the entity model. Added BookBrowser pattern to ledger, simplifying the statement writing process.

Revision 1.8 2003/12/26 22:50:52 pelle Mainly fixes to SQLLedger to support the schema generated by the new EntityModel

Revision 1.7 2003/12/24 00:24:33 pelle Created a kind of poor man's version of ofbiz.org's EntityEngine. It doesnt use xml to configure it, but code. Should mainly be used to create tables. Can also insert rows, but hasnt been thoroughly tested. At some point I will improve that part and add some kind of smart querying engine to it. Similar to EntityEngine. But I dont need that myself right now. SQLLedger now uses this to create its tables. It is not fully working yet, but will be shortly.

Revision 1.6 2003/12/03 23:21:43 pelle Got rid of ofbiz support. Way over the top for our use.

Revision 1.5 2003/11/21 04:43:21 pelle EncryptedFileStore now works. It uses the PBECipher with DES3 afair. Otherwise You will Finaliate. Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final. This should hopefully make everything more stable (and secure).

Revision 1.4 2003/11/11 21:17:32 pelle Further vital reshuffling. org.neudist.crypto.* and org.neudist.utils.* have been moved to respective areas under org.neuclear.commons org.neuclear.signers.* as well as org.neuclear.passphraseagents have been moved under org.neuclear.commons.crypto as well. Did a bit of work on the Canonicalizer and changed a few other minor bits.

Revision 1.3 2003/10/29 21:15:13 pelle Refactored the whole signing process. Now we have an interface called Signer which is the old SignerStore. To use it you pass a byte array and an alias. The sign method then returns the signature. If a Signer needs a passphrase it uses a PassPhraseAgent to present a dialogue box, read it from a command line etc. This new Signer pattern allows us to use secure signing hardware such as N-Cipher in the future for server applications as well as SmartCards for end user applications.

Revision 1.2 2003/10/28 23:43:15 pelle The GuiDialogAgent now works. It simply presents itself as a simple modal dialog box asking for a passphrase. The two Signer implementations both use it for the passphrase.

Revision 1.1.1.1 2003/09/20 23:16:21 pelle First revision of neuclear-ledger in /cvsroot/neuclear Older versions can be found /cvsroot/neuclear

Revision 1.15 2003/08/08 23:05:12 pelle Updated to use PicoContainer. This will be made more elegant as we go along.

Revision 1.14 2003/08/06 19:16:32 pelle Updated various missing items.

Revision 1.13 2003/08/06 16:41:22 pelle Fixed a few implementation bugs with regards to the Held Transactions

Revision 1.12 2003/08/01 21:59:47 pelle More changes to the way helds are managed.

Revision 1.11 2003/07/30 16:27:55 pelle Final fixes for unit tests. Renamed implementHeld() => complete() Had to override reverse() to make complete work. Note: had to "fix" a unit test to make SimpleLedger pass I dont have time to fix it at the moment. I suspect its simple.

Revision 1.10 2003/07/29 22:57:50 pelle New version with refactored support for HeldTransactions. Please note that this causes a sql exception when adding held_item rows.

Revision 1.9 2003/07/28 21:29:15 pelle Changed a few things in the LedgerFactory. Still not quite there yet.

Revision 1.8 2003/07/23 17:19:26 pelle Ledgers now have a required display name.

Revision 1.7 2003/07/21 19:43:39 pelle Moved the Revisioning tests into the main AbstractLedgerTest. Fixed the getTransactionTime method in SQLLedger.

Revision 1.6 2003/07/21 18:35:15 pelle Completed Exception handling refactoring

Revision 1.5 2003/07/21 17:47:37 pelle Held transactions now work in SQL

Revision 1.4 2003/07/18 20:27:39 pelle *** empty log message ***

Revision 1.3 2003/07/17 22:33:57 pelle Fixed various problems. Lets see how we do. I waiting for the autoincrement to work on the entries.

Revision 1.2 2003/07/16 18:08:49 pelle Adding the first parts of sql support.

Revision 1.1 2003/01/25 19:14:47 pelle The ridiculously simple SimpleLedger now passes initial test. I've split the Transaction Class into two sub classes and made Transaction abstract. The two new Transaction Classes reflect the state of the Transaction and their methods reflect this.


Field Summary
(package private) static java.lang.String ALICE
           
(package private) static java.lang.String BOB
           
(package private) static java.lang.String CAROL
           
protected  LedgerController ledger
           
 
Constructor Summary
AbstractLedgerTest(java.lang.String s)
           
 
Method Summary
abstract  LedgerController createLedger()
           
 PostedHeldTransaction hold(java.lang.String from, java.lang.String to, java.util.Date expires, double amount, java.lang.String comment)
           
protected  void setUp()
          Sets up the fixture, for example, open a network connection.
protected  void tearDown()
          Tears down the fixture, for example, close a network connection.
 void testBalance()
           
 void testCreateLedger()
           
 void testHeldTransactionExists()
           
 void testHoldAndCancelTransfer()
           
 void testHoldAndCompleteTransfer()
           
 void testHoldAndCompleteTransferWithBookChange()
           
 void testHoldAndExpireTransfer()
           
 void testHoldAndInsufficientFunds()
           
 void testMultiLedger()
           
 void testMultiTransfer()
           
 void testNaiveBenchmark()
           
 void testRegisterBook()
           
 void testSetHeldReceiptId()
           
 void testSetReceiptId()
           
 void testTransactionExists()
           
 void testTransfer()
           
 void testVerifiedTransfer()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BOB

static final java.lang.String BOB
See Also:
Constant Field Values

ALICE

static final java.lang.String ALICE
See Also:
Constant Field Values

CAROL

static final java.lang.String CAROL
See Also:
Constant Field Values

ledger

protected LedgerController ledger
Constructor Detail

AbstractLedgerTest

public AbstractLedgerTest(java.lang.String s)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Sets up the fixture, for example, open a network connection. This method is called before a test is executed.

Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Tears down the fixture, for example, close a network connection. This method is called after a test is executed.

Throws:
java.lang.Exception

createLedger

public abstract LedgerController createLedger()
                                       throws LowlevelLedgerException,
                                              UnknownLedgerException
Throws:
LowlevelLedgerException
UnknownLedgerException

hold

public final PostedHeldTransaction hold(java.lang.String from,
                                        java.lang.String to,
                                        java.util.Date expires,
                                        double amount,
                                        java.lang.String comment)
                                 throws InvalidTransactionException,
                                        UnBalancedTransactionException,
                                        LowlevelLedgerException,
                                        UnknownBookException
Throws:
InvalidTransactionException
UnBalancedTransactionException
LowlevelLedgerException
UnknownBookException

testTransfer

public final void testTransfer()
                        throws LedgerException
Throws:
LedgerException

testVerifiedTransfer

public final void testVerifiedTransfer()
                                throws LedgerException
Throws:
LedgerException

testMultiTransfer

public final void testMultiTransfer()
                             throws UnBalancedTransactionException,
                                    LowlevelLedgerException,
                                    InvalidTransactionException,
                                    UnknownTransactionException,
                                    UnknownBookException
Throws:
UnBalancedTransactionException
LowlevelLedgerException
InvalidTransactionException
UnknownTransactionException
UnknownBookException

testBalance

public final void testBalance()
                       throws LedgerException
Throws:
LedgerException

testHoldAndExpireTransfer

public final void testHoldAndExpireTransfer()
                                     throws LowlevelLedgerException,
                                            UnBalancedTransactionException,
                                            InvalidTransactionException,
                                            UnknownBookException
Throws:
LowlevelLedgerException
UnBalancedTransactionException
InvalidTransactionException
UnknownBookException

testHoldAndCancelTransfer

public final void testHoldAndCancelTransfer()
                                     throws LowlevelLedgerException,
                                            UnBalancedTransactionException,
                                            InvalidTransactionException,
                                            UnknownTransactionException,
                                            UnknownBookException
Throws:
LowlevelLedgerException
UnBalancedTransactionException
InvalidTransactionException
UnknownTransactionException
UnknownBookException

testHoldAndCompleteTransfer

public final void testHoldAndCompleteTransfer()
                                       throws LowlevelLedgerException,
                                              UnBalancedTransactionException,
                                              InvalidTransactionException,
                                              UnknownTransactionException,
                                              TransactionExpiredException,
                                              UnknownBookException
Throws:
LowlevelLedgerException
UnBalancedTransactionException
InvalidTransactionException
UnknownTransactionException
TransactionExpiredException
UnknownBookException

testHoldAndCompleteTransferWithBookChange

public final void testHoldAndCompleteTransferWithBookChange()
                                                     throws LowlevelLedgerException,
                                                            UnBalancedTransactionException,
                                                            InvalidTransactionException,
                                                            UnknownTransactionException,
                                                            TransactionExpiredException,
                                                            UnknownBookException
Throws:
LowlevelLedgerException
UnBalancedTransactionException
InvalidTransactionException
UnknownTransactionException
TransactionExpiredException
UnknownBookException

testHoldAndInsufficientFunds

public final void testHoldAndInsufficientFunds()
                                        throws LowlevelLedgerException,
                                               UnBalancedTransactionException,
                                               InvalidTransactionException,
                                               UnknownTransactionException,
                                               UnknownBookException
Throws:
LowlevelLedgerException
UnBalancedTransactionException
InvalidTransactionException
UnknownTransactionException
UnknownBookException

testSetReceiptId

public final void testSetReceiptId()
                            throws LedgerException
Throws:
LedgerException

testTransactionExists

public final void testTransactionExists()
                                 throws LedgerException
Throws:
LedgerException

testHeldTransactionExists

public final void testHeldTransactionExists()
                                     throws LedgerException
Throws:
LedgerException

testSetHeldReceiptId

public final void testSetHeldReceiptId()
                                throws LedgerException
Throws:
LedgerException

testNaiveBenchmark

public final void testNaiveBenchmark()
                              throws UnBalancedTransactionException,
                                     LowlevelLedgerException,
                                     InvalidTransactionException,
                                     UnknownBookException
Throws:
UnBalancedTransactionException
LowlevelLedgerException
InvalidTransactionException
UnknownBookException

testRegisterBook

public void testRegisterBook()
                      throws LowlevelLedgerException,
                             UnknownBookException
Throws:
LowlevelLedgerException
UnknownBookException

testMultiLedger

public void testMultiLedger()
                     throws UnknownBookException,
                            InvalidTransactionException,
                            LowlevelLedgerException,
                            UnknownTransactionException
Throws:
UnknownBookException
InvalidTransactionException
LowlevelLedgerException
UnknownTransactionException

testCreateLedger

public void testCreateLedger()
                      throws UnknownLedgerException,
                             LowlevelLedgerException
Throws:
UnknownLedgerException
LowlevelLedgerException


Copyright © 2003-2004 Antilles Software Ventures SA. All Rights Reserved.