--- experimental/server/ACL/ACLTest.java 2001/12/20 00:59:54 1.2 +++ experimental/server/ACL/ACLTest.java 2001/12/23 00:29:33 1.3 @@ -15,8 +15,39 @@ class ACLTest { // not really needed if we default to deny :) //acl.add(ACL.DENY, "*"); - // dump our ACL to the console - System.out.println(acl.getStringACL()); + // dump our ACL to the console before serialization + System.out.println("BEFORE: "+acl.getStringACL()); + + // name for our serialized ACL + String aclFilename = "aclfile"; + + // write out our ACL to a file + try { + ObjectOutputStream ostream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(aclFilename))); + ostream.writeObject(acl); + ostream.flush(); + ostream.close(); + } + catch (Exception e) { + System.out.println("exception: " + e); + e.printStackTrace(); + System.exit(1); + } + + // and read it back in :) + try { + ObjectInputStream istream = new ObjectInputStream(new BufferedInputStream(new FileInputStream(aclFilename))); + acl = (ACL) istream.readObject(); + istream.close(); + } + catch (Exception e) { + System.out.println("exception: " + e); + e.printStackTrace(); + System.exit(1); + } + + // dump our ACL to the console after serialization + System.out.println("AFTER: "+acl.getStringACL()); // run a few tests System.out.println("killigrew.ukc.ac.uk: " + acl.check("killigrew.ukc.ac.uk"));