Mercurial > hg > blitz_stable
comparison test/org/dancres/blitz/SpaceLeaseExpireTest.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz; | |
2 | |
3 import net.jini.core.entry.Entry; | |
4 import net.jini.core.lease.Lease; | |
5 | |
6 import org.dancres.blitz.mangler.*; | |
7 | |
8 import org.dancres.blitz.disk.Disk; | |
9 import org.dancres.blitz.disk.DiskTxn; | |
10 | |
11 public class SpaceLeaseExpireTest { | |
12 public static void main(String args[]) { | |
13 | |
14 try { | |
15 System.out.println("Start space"); | |
16 | |
17 SpaceImpl mySpace = new SpaceImpl(null); | |
18 | |
19 System.out.println("Prepare entry"); | |
20 | |
21 EntryMangler myMangler = new EntryMangler(); | |
22 | |
23 System.out.println("init'd entry"); | |
24 MangledEntry myPackedEntry = | |
25 myMangler.mangle(new TestEntry().init()); | |
26 | |
27 System.out.println("Do write: " + | |
28 mySpace.write(myPackedEntry, null, | |
29 60 * 1000)); | |
30 | |
31 Thread.sleep(65 * 1000); | |
32 | |
33 System.out.println("Do specific take:"); | |
34 System.out.println(mySpace.take(myPackedEntry, null, | |
35 1000)); | |
36 | |
37 System.out.println("Do stop"); | |
38 | |
39 mySpace.stop(); | |
40 | |
41 } catch (Exception anE) { | |
42 System.err.println("Got exception :("); | |
43 anE.printStackTrace(System.err); | |
44 } | |
45 | |
46 } | |
47 | |
48 public static class TestEntry implements Entry { | |
49 public String rhubarb; | |
50 public Integer count; | |
51 | |
52 public TestEntry() { | |
53 } | |
54 | |
55 public TestEntry init() { | |
56 rhubarb = "blah"; | |
57 count = new Integer(5); | |
58 | |
59 return this; | |
60 } | |
61 | |
62 public TestEntry init2() { | |
63 rhubarb = "blahblah"; | |
64 count = new Integer(5); | |
65 | |
66 return this; | |
67 } | |
68 | |
69 public TestEntry init3() { | |
70 rhubarb = "blahh"; | |
71 count = new Integer(5); | |
72 | |
73 return this; | |
74 } | |
75 | |
76 public String toString() { | |
77 return super.toString() + ", " + rhubarb + ", " + count; | |
78 } | |
79 } | |
80 } |