Squashed commit of the following:
commit 7452e6d2acdbf0290c41b50ac4b7064411782a0e
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Tue Jun 25 14:36:29 2013 -0700
Complete implementation of unit test for ZookeeperRegistry.
commit 9d35d5f09570872acf16977614f18b0be087580f
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Mon Jun 24 17:45:11 2013 -0700
Debug
commit 07d43392e4324af93986e6095536727f3497e327
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Fri Jun 21 16:32:35 2013 -0700
Implementation of mock CuratorFramework is done.
commit 9230449c4ed4326721e29abe8dc01b3115a74041
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Fri Jun 21 13:52:25 2013 -0700
Add some mock object to ZookeeperRegistry
commit 912a03932e8b1c60f19a9daadf08fb719e5ccf92
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Thu Jun 20 11:43:47 2013 -0700
Create test class for ZookeeperRegistry
commit 68e4ae5e9b0f265c3f21ce757b36381a9368826a
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Wed Jun 19 17:46:03 2013 -0700
Implement StandaloneRegistryTest
commit d81bf9f11159df9abf545bc471970a78ccdf1193
Author: Naoki Shiota <n-shiota@onlab.us>
Date: Tue Jun 18 15:47:37 2013 -0700
Create test class for StandAloneRegistry
diff --git a/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java b/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
index e48c519..7e82bf0 100644
--- a/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
+++ b/src/main/java/net/onrc/onos/registry/controller/StandaloneRegistry.java
@@ -116,10 +116,17 @@
throw new RuntimeException("Not yet implemented");
}
+ private long blockTop = 0L;
+ private static final long BLOCK_SIZE = 0x1000000L;
@Override
public IdBlock allocateUniqueIdBlock(){
- //XXX Not exactly unique...
- return new IdBlock(0L, 0x10000000L, 0x10000000L);
+ long blockHead = blockTop;
+ long blockTail = blockTop + BLOCK_SIZE;
+
+ IdBlock block = new IdBlock(blockHead, blockTail, BLOCK_SIZE);
+ blockTop = blockTail;
+
+ return block;
}
@Override