|
From: <pe...@us...> - 2003-12-03 23:21:47
|
Update of /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger
In directory sc8-pr-cvs1:/tmp/cvs-serv23579/src/test/org/neuclear/ledger
Modified Files:
LedgerTest.java SQLLedgerTest.java
Log Message:
Got rid of ofbiz support. Way over the top for our use.
Index: LedgerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/LedgerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** LedgerTest.java 21 Nov 2003 04:43:21 -0000 1.5
--- LedgerTest.java 3 Dec 2003 23:21:43 -0000 1.6
***************
*** 2,14 ****
import junit.framework.TestCase;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
- import org.neuclear.ledger.implementations.SQLLedger;
- import org.neuclear.commons.sql.DefaultConnectionSource;
-
/**
* (C) 2003 Antilles Software Ventures SA
--- 2,18 ----
import junit.framework.TestCase;
+ import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.sql.DefaultConnectionSource;
+ import org.neuclear.ledger.implementations.SQLLedger;
+ import javax.naming.NamingException;
+ import javax.transaction.UserTransaction;
+ import java.io.IOException;
import java.math.BigInteger;
+ import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
/**
* (C) 2003 Antilles Software Ventures SA
***************
*** 18,21 ****
--- 22,28 ----
* $Id$
* $Log$
+ * 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.
***************
*** 23,27 ****
* 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.
--- 30,34 ----
* 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).
! * <p/>
* Revision 1.4 2003/11/11 21:17:32 pelle
* Further vital reshuffling.
***************
*** 29,33 ****
* 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.
--- 36,40 ----
* 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.
! * <p/>
* 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.
***************
*** 36,40 ****
* 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.
--- 43,47 ----
* 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.
! * <p/>
* 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.
***************
*** 105,109 ****
! public LedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException {
super(s);
ledger = new SQLLedger(new DefaultConnectionSource(), "neu://superbux/reserve");
--- 112,116 ----
! public LedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException, SQLException, NamingException, IOException, NeuClearException {
super(s);
ledger = new SQLLedger(new DefaultConnectionSource(), "neu://superbux/reserve");
***************
*** 117,121 ****
--- 124,130 ----
final Book alice = getNewAliceBook();
final Date t1 = new Date();
+ UserTransaction ut = ledger.beginUT();
bob.transfer(alice, 100, "Loan", t1);
+ ledger.commitUT(ut);
}
***************
*** 136,142 ****
--- 145,153 ----
public final void testAccountCreate() throws LedgerException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
assertNotNull(bob);
assertTrue(ledger.bookExists(bob.getBookID()));
+ ledger.commitUT(ut);
}
***************
*** 148,154 ****
--- 159,168 ----
final double amount = 105;
final Date t1 = new Date();
+ UserTransaction ut = ledger.beginUT();
+
alice.transfer(bob, amount, "Repayment", t1);
assertEquals(aliceBalance - amount, alice.getBalance(), 0);
assertEquals(bobBalance + amount, bob.getBalance(), 0);
+ ledger.commitUT(ut);
}
***************
*** 164,167 ****
--- 178,182 ----
cal.add(Calendar.DAY_OF_YEAR, 1);
final Date t5 = cal.getTime();
+ UserTransaction ut = ledger.beginUT();
final Book alice = getNewAliceBook();
***************
*** 188,191 ****
--- 203,208 ----
assertEquals(aliceBalance - amount, alice.getBalance(t5), 0);
assertEquals(bobBalance + amount, bob.getBalance(t5), 0);
+ ledger.commitUT(ut);
+
}
***************
*** 201,204 ****
--- 218,222 ----
cal.add(Calendar.DAY_OF_YEAR, 1);
final Date t5 = cal.getTime();
+ UserTransaction ut = ledger.beginUT();
final Book alice = getNewAliceBook();
***************
*** 243,250 ****
--- 261,270 ----
assertEquals(bob.getBalance(t5), bob.getAvailableBalance(t5), 0);
}
+ ledger.commitUT(ut);
}
public final void testReversal() throws LedgerException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
final Book alice = getNewAliceBook();
***************
*** 259,262 ****
--- 279,283 ----
assertNotNull(reverse);
assertEquals(bob.getBalance(), balance, 0);
+ ledger.commitUT(ut);
}
***************
*** 274,277 ****
--- 295,299 ----
final Date t5 = cal.getTime();
+ UserTransaction ut = ledger.beginUT();
final Book ignacio = createNewBook("neu://verax/testusers/Ignacio");
***************
*** 318,325 ****
--- 340,349 ----
assertTrue("Did throw exception here", true);
}
+ ledger.commitUT(ut);
}
public final void testFindTransaction() throws LowlevelLedgerException, BookExistsException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException, UnknownBookException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
final Book alice = getNewAliceBook();
***************
*** 331,337 ****
--- 355,363 ----
assertNotNull(found);
assertEquals(found.getXid(), tran.getXid());
+ ledger.commitUT(ut);
}
public final void testFindHeldTransaction() throws LowlevelLedgerException, BookExistsException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException, UnknownBookException {
+ UserTransaction ut = ledger.beginUT();
final Book bob = getNewBobBook();
final Book alice = getNewAliceBook();
***************
*** 343,349 ****
--- 369,377 ----
assertNotNull(found);
assertEquals(found.getXid(), tran.getXid());
+ ledger.commitUT(ut);
}
public final void testCancelHeld() throws LedgerException {
+ UserTransaction ut = ledger.beginUT();
final Calendar cal = Calendar.getInstance();
final Date t1 = cal.getTime();
***************
*** 376,379 ****
--- 404,408 ----
}
+ ledger.commitUT(ut);
}
Index: SQLLedgerTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger/SQLLedgerTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SQLLedgerTest.java 21 Nov 2003 04:43:21 -0000 1.2
--- SQLLedgerTest.java 3 Dec 2003 23:21:43 -0000 1.3
***************
*** 1,11 ****
package org.neuclear.ledger;
! import org.neuclear.ledger.implementations.SQLLedger;
! import org.neuclear.commons.sql.SQLTools;
! import java.sql.Connection;
! import java.sql.DriverManager;
! import java.sql.SQLException;
import java.io.IOException;
/**
--- 1,9 ----
package org.neuclear.ledger;
! import org.neuclear.commons.NeuClearException;
! import javax.naming.NamingException;
import java.io.IOException;
+ import java.sql.SQLException;
/**
***************
*** 16,22 ****
* To change this template use Options | File Templates.
*/
! public final class SQLLedgerTest extends LedgerTest{
! public SQLLedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException {
super(s);
}
--- 14,21 ----
* To change this template use Options | File Templates.
*/
! public final class SQLLedgerTest extends LedgerTest {
! public SQLLedgerTest(final String s) throws LowlevelLedgerException, UnknownLedgerException, SQLException, NamingException, IOException, NeuClearException {
super(s);
+
}
|