ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/ACL/ACLTest.java
(Generate patch)

Comparing experimental/server/ACL/ACLTest.java (file contents):
Revision 1.2 by tdb, Thu Dec 20 00:59:54 2001 UTC vs.
Revision 1.3 by tdb, Sun Dec 23 00:29:33 2001 UTC

# Line 15 | Line 15 | class ACLTest {
15          // not really needed if we default to deny :)
16          //acl.add(ACL.DENY, "*");
17          
18 <        // dump our ACL to the console
19 <        System.out.println(acl.getStringACL());
18 >        // dump our ACL to the console before serialization
19 >        System.out.println("BEFORE: "+acl.getStringACL());
20 >        
21 >        // name for our serialized ACL
22 >        String aclFilename = "aclfile";
23 >        
24 >        // write out our ACL to a file
25 >        try {
26 >            ObjectOutputStream ostream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(aclFilename)));
27 >            ostream.writeObject(acl);
28 >            ostream.flush();
29 >            ostream.close();
30 >        }
31 >        catch (Exception e) {
32 >            System.out.println("exception: " + e);
33 >            e.printStackTrace();
34 >            System.exit(1);
35 >        }
36 >        
37 >        // and read it back in :)
38 >        try {
39 >            ObjectInputStream istream = new ObjectInputStream(new BufferedInputStream(new FileInputStream(aclFilename)));
40 >            acl = (ACL) istream.readObject();
41 >            istream.close();
42 >        }
43 >        catch (Exception e) {
44 >            System.out.println("exception: " + e);
45 >            e.printStackTrace();
46 >            System.exit(1);
47 >        }
48 >        
49 >        // dump our ACL to the console after serialization
50 >        System.out.println("AFTER: "+acl.getStringACL());
51          
52          // run a few tests
53          System.out.println("killigrew.ukc.ac.uk: " + acl.check("killigrew.ukc.ac.uk"));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines