|
From: <pe...@us...> - 2003-10-02 23:29:13
|
Update of /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/verifier In directory sc8-pr-cvs1:/tmp/cvs-serv24957/src/test/org/neuclear/id/verifier Modified Files: VerificationTest.java Log Message: Updated Root Key. This will be the root key for the remainder of the beta period. With version 1.0 I will update it with a new key. VerifyingTest works now and also does a pass for fake ones. Will have to think of better ways of making fake Identities to break it. Cleaned up much of the tests and they all pass now. The FileStoreTests need to be rethought out, by adding a test key. Index: VerificationTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/test/org/neuclear/id/verifier/VerificationTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VerificationTest.java 30 Sep 2003 23:25:15 -0000 1.2 --- VerificationTest.java 2 Oct 2003 23:29:03 -0000 1.3 *************** *** 3,13 **** import junit.framework.TestCase; import org.dom4j.DocumentException; ! import org.dom4j.Document; ! import org.dom4j.io.SAXReader; ! import org.neudist.utils.NeudistException; ! import org.neudist.utils.RegexFileNameFilter; ! import org.neudist.xml.xmlsec.XMLSecTools; ! import org.neudist.crypto.CryptoTools; import org.neuclear.id.SignedNamedObject; import java.io.*; --- 3,10 ---- import junit.framework.TestCase; import org.dom4j.DocumentException; ! import org.neuclear.id.InvalidIdentityException; import org.neuclear.id.SignedNamedObject; + import org.neudist.crypto.CryptoTools; + import org.neudist.utils.NeudistException; import java.io.*; *************** *** 33,36 **** --- 30,39 ---- $Id$ $Log$ + Revision 1.3 2003/10/02 23:29:03 pelle + Updated Root Key. This will be the root key for the remainder of the beta period. With version 1.0 I will update it with a new key. + VerifyingTest works now and also does a pass for fake ones. Will have to think of better ways of making fake Identities to break it. + Cleaned up much of the tests and they all pass now. + The FileStoreTests need to be rethought out, by adding a test key. + Revision 1.2 2003/09/30 23:25:15 pelle Added new JCE Provider and java Certificate implementation for NeuClear Identity. *************** *** 52,63 **** super(string); CryptoTools.ensureProvider(); ! reader=VerifyingReader.getInstance(); } public void testSimple() throws IOException, DocumentException, NeudistException { ! runDirectoryTest("src/testdata/simple"); } ! public void runDirectoryTest(String path) throws DocumentException, IOException, FileNotFoundException, NeudistException { ! File dir=new File(path); if (!dir.exists()) { System.out.println("Doesnt exist"); --- 55,71 ---- super(string); CryptoTools.ensureProvider(); ! reader = VerifyingReader.getInstance(); } + public void testSimple() throws IOException, DocumentException, NeudistException { ! runDirectoryTest("src/testdata/simple", true); } ! public void testFakes() throws IOException, DocumentException, NeudistException { ! runDirectoryTest("src/testdata/fakes", false); ! } ! ! public void runDirectoryTest(String path, boolean wantValid) throws DocumentException, IOException, FileNotFoundException, NeudistException { ! File dir = new File(path); if (!dir.exists()) { System.out.println("Doesnt exist"); *************** *** 65,86 **** } FilenameFilter filter; ! filter=new FilenameFilter(){ public boolean accept(File dirf, String name) { ! return name.endsWith(".neu"); } }; ! File xmlfiles[]=dir.listFiles(filter); ! System.out.println("There are "+xmlfiles.length+" files in the directory"); for (int i = 0; i < xmlfiles.length; i++) { File xmlfile = xmlfiles[i]; ! System.out.print("Testing file: "+xmlfile.getName()+"... "); try { ! SignedNamedObject obj=reader.read(new FileInputStream(xmlfile)); ! System.out.println("Name : "+obj.getName()+" VERIFIED"); ! } catch (Exception e) { ! System.out.println("ERROR "+e.getMessage()); ! assertTrue(false); } } --- 73,96 ---- } FilenameFilter filter; ! filter = new FilenameFilter() { public boolean accept(File dirf, String name) { ! return name.endsWith(".id"); } }; ! File xmlfiles[] = dir.listFiles(filter); ! System.out.println("There are " + xmlfiles.length + " files in the directory"); for (int i = 0; i < xmlfiles.length; i++) { File xmlfile = xmlfiles[i]; ! System.out.print("Testing file: " + xmlfile.getName() + "... "); try { ! SignedNamedObject obj = reader.read(new FileInputStream(xmlfile)); ! System.out.println("Name : " + obj.getName() + " VERIFIED"); ! assertTrue(wantValid); ! ! } catch (InvalidIdentityException e) { ! System.out.println("INVALID " + e.getMessage()); ! assertTrue(!wantValid); } } |