|
From: <pe...@us...> - 2003-11-21 04:43:09
|
Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/receiver
In directory sc8-pr-cvs1:/tmp/cvs-serv10286/src/test/org/neuclear/asset/receiver
Modified Files:
CreateTestPayments.java PaymentReceiverTest.java
Log Message:
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).
Index: CreateTestPayments.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/receiver/CreateTestPayments.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CreateTestPayments.java 12 Nov 2003 23:47:05 -0000 1.3
--- CreateTestPayments.java 21 Nov 2003 04:43:04 -0000 1.4
***************
*** 36,39 ****
--- 36,45 ----
$Id$
$Log$
+ Revision 1.4 2003/11/21 04:43:04 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.3 2003/11/12 23:47:05 pelle
Much work done in creating good test environment.
***************
*** 78,90 ****
* Time: 11:50:47 AM
*/
! public class CreateTestPayments extends CommandLineSigner {
! public CreateTestPayments(String[] args) throws ParseException, NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, ConfigurationException {
super(args);
}
! public NamedObjectBuilder build() throws Exception {
! String to = cmd.getOptionValue("r");
! String asset = cmd.getOptionValue("c");
! double amount = Double.parseDouble(cmd.getOptionValue("x"));
return new TransferRequestBuilder(
--- 84,96 ----
* Time: 11:50:47 AM
*/
! public final class CreateTestPayments extends CommandLineSigner {
! public CreateTestPayments(final String[] args) throws ParseException, NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, ConfigurationException {
super(args);
}
! public final NamedObjectBuilder build() throws Exception {
! final String to = cmd.getOptionValue("r");
! final String asset = cmd.getOptionValue("c");
! final double amount = Double.parseDouble(cmd.getOptionValue("x"));
return new TransferRequestBuilder(
***************
*** 98,104 ****
}
! public static void main(String args[]) {
try {
! CreateTestPayments signer = new CreateTestPayments(args);
signer.execute();
} catch (Exception e) {
--- 104,110 ----
}
! public static void main(final String[] args) {
try {
! final CreateTestPayments signer = new CreateTestPayments(args);
signer.execute();
} catch (Exception e) {
***************
*** 107,119 ****
}
! protected String getExtraHelp() {
return "[--assetName neu://verax/pay --payee neu://bob@verax --amount 20.00]";
}
! protected boolean hasArguments() {
return (cmd.hasOption("a") && cmd.hasOption("c") && cmd.hasOption("r") && cmd.hasOption("x"));
}
! protected void getLocalOptions(Options options) {
options.addOption("c", "assetName", true, "specify id of assetName");
options.addOption("r", "payee", true, "specify id of payee");
--- 113,125 ----
}
! protected final String getExtraHelp() {
return "[--assetName neu://verax/pay --payee neu://bob@verax --amount 20.00]";
}
! protected final boolean hasArguments() {
return (cmd.hasOption("a") && cmd.hasOption("c") && cmd.hasOption("r") && cmd.hasOption("x"));
}
! protected final void getLocalOptions(final Options options) {
options.addOption("c", "assetName", true, "specify id of assetName");
options.addOption("r", "payee", true, "specify id of payee");
Index: PaymentReceiverTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/receiver/PaymentReceiverTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PaymentReceiverTest.java 19 Nov 2003 23:32:20 -0000 1.5
--- PaymentReceiverTest.java 21 Nov 2003 04:43:04 -0000 1.6
***************
*** 44,47 ****
--- 44,53 ----
$Id$
$Log$
+ Revision 1.6 2003/11/21 04:43:04 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.5 2003/11/19 23:32:20 pelle
Signers now can generatekeys via the generateKey() method.
***************
*** 112,117 ****
* Time: 11:20:31 AM
*/
! public class PaymentReceiverTest extends AbstractReceiverTest {
! public PaymentReceiverTest(String string) throws NeuClearException, GeneralSecurityException, UnknownLedgerException, LowlevelLedgerException, BookExistsException, IOException, InvalidTransferException, XMLException {
super(string);
asset = (Asset) NSResolver.resolveIdentity(assetName);
--- 118,123 ----
* Time: 11:20:31 AM
*/
! public final class PaymentReceiverTest extends AbstractReceiverTest {
! public PaymentReceiverTest(final String string) throws NeuClearException, GeneralSecurityException, UnknownLedgerException, LowlevelLedgerException, BookExistsException, IOException, InvalidTransferException, XMLException {
super(string);
asset = (Asset) NSResolver.resolveIdentity(assetName);
***************
*** 131,143 ****
}
! public void testSimple() throws Exception, DocumentException, NeuClearException, XMLException {
runDirectoryTest(directory.getAbsolutePath());
}
! public Receiver getReceiver() {
return receiver;
}
! public String getExtension() {
return ".xml";
}
--- 137,149 ----
}
! public final void testSimple() throws Exception, DocumentException, NeuClearException, XMLException {
runDirectoryTest(directory.getAbsolutePath());
}
! public final Receiver getReceiver() {
return receiver;
}
! public final String getExtension() {
return ".xml";
}
***************
*** 147,156 ****
}
! public Object getPreTransactionState(SignedNamedObject obj) throws Exception {
if (obj instanceof TransferRequest) {
! TransferRequest transfer = (TransferRequest) obj;
! double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! double toBalance = proc.getBalance(transfer.getTo(), transfer.getTimeStamp());
return new double[]{fromBalance, toBalance};
--- 153,162 ----
}
! public final Object getPreTransactionState(final SignedNamedObject obj) throws Exception {
if (obj instanceof TransferRequest) {
! final TransferRequest transfer = (TransferRequest) obj;
! final double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! final double toBalance = proc.getBalance(transfer.getTo(), transfer.getTimeStamp());
return new double[]{fromBalance, toBalance};
***************
*** 160,168 ****
}
! public boolean verifyTransaction(final SignedNamedObject obj, final Object state) throws Exception {
if (obj instanceof TransferRequest) {
! TransferRequest transfer = (TransferRequest) obj;
! double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! double toBalance = proc.getBalance(transfer.getTo(), transfer.getTimeStamp());
final double prebalances[] = (double[]) state;
--- 166,174 ----
}
! public final boolean verifyTransaction(final SignedNamedObject obj, final Object state) throws Exception {
if (obj instanceof TransferRequest) {
! final TransferRequest transfer = (TransferRequest) obj;
! final double fromBalance = proc.getBalance(transfer.getFrom(), transfer.getTimeStamp());
! final double toBalance = proc.getBalance(transfer.getTo(), transfer.getTimeStamp());
final double prebalances[] = (double[]) state;
***************
*** 173,180 ****
}
! public void createPayments(Identity from, Identity to, double amount) throws InvalidTransferException, XMLException, NeuClearException, IOException, UnsupportedEncodingException {
! TransferRequestBuilder transfer = new TransferRequestBuilder(asset, from, to, 100, TimeTools.now(), "Test One");
! SignedNamedObject signed = transfer.sign(getSigner());
! OutputStream out = new BufferedOutputStream(new FileOutputStream(directory.getAbsolutePath() + "/" + transfer.getLocalName() + ".xml"));
out.write(signed.getEncoded().getBytes("UTF-8"));
--- 179,186 ----
}
! public final void createPayments(final Identity from, final Identity to, final double amount) throws InvalidTransferException, XMLException, NeuClearException, IOException, UnsupportedEncodingException {
! final TransferRequestBuilder transfer = new TransferRequestBuilder(asset, from, to, 100, TimeTools.now(), "Test One");
! final SignedNamedObject signed = transfer.sign(getSigner());
! final OutputStream out = new BufferedOutputStream(new FileOutputStream(directory.getAbsolutePath() + "/" + transfer.getLocalName() + ".xml"));
out.write(signed.getEncoded().getBytes("UTF-8"));
***************
*** 187,190 ****
private final Receiver receiver;
private final CurrencyController proc;
! private double balance = 0.0;
}
--- 193,196 ----
private final Receiver receiver;
private final CurrencyController proc;
! private final double balance = 0.0;
}
|