Mercurial > hg > blitz_stable
comparison test/org/dancres/blitz/SpaceStartTest.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 public class SpaceStartTest { | |
9 public static void main(String args[]) { | |
10 | |
11 try { | |
12 System.out.println("Start space"); | |
13 | |
14 SpaceImpl mySpace = new SpaceImpl(null); | |
15 | |
16 System.out.println("Prepare entry"); | |
17 | |
18 EntryMangler myMangler = new EntryMangler(); | |
19 TestEntry myEntry = new TestEntry(); | |
20 myEntry.init(); | |
21 | |
22 System.out.println("init'd entry"); | |
23 MangledEntry myPackedEntry = myMangler.mangle(new TestEntry()); | |
24 | |
25 System.out.println("Do write"); | |
26 | |
27 mySpace.write(myPackedEntry, null, Lease.FOREVER); | |
28 | |
29 long myPause = 20000; | |
30 | |
31 if (args.length == 1) { | |
32 myPause = Long.parseLong(args[0]); | |
33 } | |
34 | |
35 System.out.println("Pausing for: " + myPause + " ms"); | |
36 | |
37 Thread.sleep(myPause); | |
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 void init() { | |
56 rhubarb = "blah"; | |
57 count = new Integer(5); | |
58 } | |
59 | |
60 public String toString() { | |
61 return super.toString() + ", " + rhubarb + ", " + count; | |
62 } | |
63 } | |
64 } |