comparison test/org/dancres/blitz/UndefinedSchemaTake.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.lease.Lease;
4 import net.jini.core.entry.Entry;
5
6 import org.dancres.blitz.mangler.EntryMangler;
7 import org.dancres.blitz.mangler.MangledEntry;
8 import org.dancres.blitz.disk.Disk;
9
10 /**
11 */
12 public class UndefinedSchemaTake {
13 public static void main(String args[]) {
14
15 try {
16 System.out.println("Start space");
17
18 SpaceImpl mySpace = new SpaceImpl(null);
19
20 System.out.println("Prepare entry");
21
22 EntryMangler myMangler = new EntryMangler();
23
24 System.out.println("init'd entry");
25 MangledEntry myPackedEntry = myMangler.mangle(new TestEntry().init3());
26 System.out.println("Do non-match take: ");
27 System.out.println(mySpace.takeIfExists(myPackedEntry, null,
28 5000));
29
30 System.out.println("Do stop");
31
32 mySpace.stop();
33
34 } catch (Exception anE) {
35 System.err.println("Got exception :(");
36 anE.printStackTrace(System.err);
37 }
38
39 }
40
41 public static class TestEntry implements Entry {
42 public String rhubarb;
43 public Integer count;
44
45 public TestEntry() {
46 }
47
48 public TestEntry init() {
49 rhubarb = "blah";
50 count = new Integer(5);
51
52 return this;
53 }
54
55 public TestEntry init2() {
56 rhubarb = "blahblah";
57 count = new Integer(5);
58
59 return this;
60 }
61
62 public TestEntry init3() {
63 rhubarb = "blahh";
64 count = new Integer(5);
65
66 return this;
67 }
68
69 public String toString() {
70 return super.toString() + ", " + rhubarb + ", " + count;
71 }
72 }
73 }