|
From: <pe...@us...> - 2004-01-13 23:38:30
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id
In directory sc8-pr-cvs1:/tmp/cvs-serv25435/src/test/org/neuclear/id
Modified Files:
NeuClearBenchmark.java SignedNamedCoreTest.java
Log Message:
Refactoring parts of the core of XMLSignature. There shouldnt be any real API changes.
Index: NeuClearBenchmark.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/NeuClearBenchmark.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NeuClearBenchmark.java 22 Dec 2003 13:45:31 -0000 1.1
--- NeuClearBenchmark.java 13 Jan 2004 23:38:26 -0000 1.2
***************
*** 1,13 ****
package org.neuclear.id;
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.crypto.signers.TestCaseSigner;
- import org.neuclear.commons.crypto.signers.InvalidPassphraseException;
- import org.neuclear.commons.crypto.signers.NonExistingSignerException;
- import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
- import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent;
- import org.neuclear.commons.NeuClearException;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
- import org.neuclear.auth.AuthenticationTicket;
/**
--- 1,9 ----
package org.neuclear.id;
+ import org.neuclear.auth.AuthenticationTicket;
+ import org.neuclear.commons.crypto.signers.InvalidPassphraseException;
import org.neuclear.commons.crypto.signers.Signer;
import org.neuclear.commons.crypto.signers.TestCaseSigner;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
/**
***************
*** 68,80 ****
AuthenticationTicketBuilder builder=new AuthenticationTicketBuilder("neu://alice@test","neu://test","http://test.com");
! AuthenticationTicket ticket=(AuthenticationTicket) builder.sign(signer);
}
finished();
} catch (InvalidNamedObjectException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
- } catch (NonExistingSignerException e) {
- e.printStackTrace(); //To change body of catch statement use Options | File Templates.
- } catch (UserCancellationException e) {
- e.printStackTrace(); //To change body of catch statement use Options | File Templates.
} catch (NameResolutionException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
--- 64,72 ----
AuthenticationTicketBuilder builder=new AuthenticationTicketBuilder("neu://alice@test","neu://test","http://test.com");
! AuthenticationTicket ticket=(AuthenticationTicket) builder.convert("neu://bob@test",signer);
}
finished();
} catch (InvalidNamedObjectException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
} catch (NameResolutionException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
Index: SignedNamedCoreTest.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/SignedNamedCoreTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SignedNamedCoreTest.java 12 Jan 2004 22:39:26 -0000 1.5
--- SignedNamedCoreTest.java 13 Jan 2004 23:38:26 -0000 1.6
***************
*** 3,7 ****
import junit.framework.TestCase;
import org.neuclear.commons.NeuClearException;
! import org.neuclear.commons.crypto.signers.JCESigner;
import org.neuclear.commons.crypto.signers.TestCaseSigner;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
--- 3,8 ----
import junit.framework.TestCase;
import org.neuclear.commons.NeuClearException;
! import org.neuclear.commons.crypto.passphraseagents.UserCancellationException;
! import org.neuclear.commons.crypto.signers.NonExistingSignerException;
import org.neuclear.commons.crypto.signers.TestCaseSigner;
import org.neuclear.id.builders.AuthenticationTicketBuilder;
***************
*** 32,35 ****
--- 33,39 ----
$Id$
$Log$
+ Revision 1.6 2004/01/13 23:38:26 pelle
+ Refactoring parts of the core of XMLSignature. There shouldnt be any real API changes.
+
Revision 1.5 2004/01/12 22:39:26 pelle
Completed all the builders and contracts.
***************
*** 68,71 ****
--- 72,80 ----
public final class SignedNamedCoreTest extends TestCase {
+ public SignedNamedCoreTest(String string) throws NeuClearException {
+ super(string);
+ signer = new TestCaseSigner();
+ }
+
public final void testCreateRoot() {
final SignedNamedCore core = SignedNamedCore.createRootCore();
***************
*** 75,83 ****
}
public final void testRead() throws NeuClearException, GeneralSecurityException, XMLException, FileNotFoundException {
final String name = "neu://bob@test";
final Builder builder = new AuthenticationTicketBuilder(name, "neu://test", "http://slashdot.org");
! final JCESigner signer = new TestCaseSigner();
builder.sign(name, signer);
assertTrue(builder.verifySignature(signer.getPublicKey(name)));
try {
--- 84,107 ----
}
+ public final void testCreateNymous() throws InvalidNamedObjectException, XMLException, NonExistingSignerException, UserCancellationException {
+ final String name = "neu://bob@test";
+ Identity bobx=SignedNamedCore.createSimpleIdentity(signer.getPublicKey(name));
+ assertNotNull(bobx);
+ assertNotNull(bobx.getName());
+ System.out.println(bobx.getName());
+ assertNotNull(bobx.getEncoded());
+ assertNull(bobx.getSigner());
+ assertNotNull(bobx.getPublicKey());
+ }
+
public final void testRead() throws NeuClearException, GeneralSecurityException, XMLException, FileNotFoundException {
final String name = "neu://bob@test";
final Builder builder = new AuthenticationTicketBuilder(name, "neu://test", "http://slashdot.org");
! System.out.println("=====");
! System.out.println(builder.asXML());
!
builder.sign(name, signer);
+ System.out.println(builder.asXML());
+
assertTrue(builder.verifySignature(signer.getPublicKey(name)));
try {
***************
*** 87,92 ****
assertTrue(e.getLocalizedMessage(), false);
}
-
-
}
}
--- 111,116 ----
assertTrue(e.getLocalizedMessage(), false);
}
}
+
+ private TestCaseSigner signer;
}
|