diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/org/dancres/blitz/UndefinedSchemaTake.java	Sat Mar 21 11:00:06 2009 +0000
@@ -0,0 +1,73 @@
+package org.dancres.blitz;
+
+import net.jini.core.lease.Lease;
+import net.jini.core.entry.Entry;
+
+import org.dancres.blitz.mangler.EntryMangler;
+import org.dancres.blitz.mangler.MangledEntry;
+import org.dancres.blitz.disk.Disk;
+
+/**
+ */
+public class UndefinedSchemaTake {
+    public static void main(String args[]) {
+
+        try {
+            System.out.println("Start space");
+
+            SpaceImpl mySpace = new SpaceImpl(null);
+
+            System.out.println("Prepare entry");
+
+            EntryMangler myMangler = new EntryMangler();
+
+            System.out.println("init'd entry");
+            MangledEntry myPackedEntry = myMangler.mangle(new TestEntry().init3());
+            System.out.println("Do non-match take: ");
+            System.out.println(mySpace.takeIfExists(myPackedEntry, null,
+                5000));
+
+            System.out.println("Do stop");
+
+            mySpace.stop();
+
+        } catch (Exception anE) {
+            System.err.println("Got exception :(");
+            anE.printStackTrace(System.err);
+        }
+
+    }
+
+    public static class TestEntry implements Entry {
+        public String rhubarb;
+        public Integer count;
+
+        public TestEntry() {
+        }
+
+        public TestEntry init() {
+            rhubarb = "blah";
+            count = new Integer(5);
+
+            return this;
+        }
+
+        public TestEntry init2() {
+            rhubarb = "blahblah";
+            count = new Integer(5);
+
+            return this;
+        }
+
+        public TestEntry init3() {
+            rhubarb = "blahh";
+            count = new Integer(5);
+
+            return this;
+        }
+
+        public String toString() {
+            return super.toString() + ", " + rhubarb + ", " + count;
+        }
+    }
+}