MNEMONIC-621: Add Utils.getNonVolatileMemoryAllocatorService call back to Collections

Signed-off-by: Xiaojin Jiao <xj.jiao@gmail.com>
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableArrayNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableArrayNGTest.java
index 267ebef..5bd39a5 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableArrayNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableArrayNGTest.java
@@ -27,7 +27,6 @@
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.Utils;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 import org.apache.mnemonic.OutOfHybridMemory;
 import org.apache.mnemonic.DurableBuffer;
 import org.apache.mnemonic.DurableChunk;
@@ -93,7 +92,7 @@
   public void setUp() throws Exception {
     rand = Utils.createRandom();
     unsafe = Utils.getUnsafe();
-    m_act = new NonVolatileMemAllocator(new PMallocServiceImpl(), 1024 * 1024 * 1024,
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
         "./pobj_array.dat", true);
     cKEYCAPACITY = m_act.handlerCapacity();
     m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashMapNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashMapNGTest.java
index 4dd978e..376d739 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashMapNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashMapNGTest.java
@@ -26,7 +26,6 @@
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.Utils;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 import org.apache.mnemonic.OutOfHybridMemory;
 import org.apache.mnemonic.EntityFactoryProxy;
 import org.apache.mnemonic.DurableType;
@@ -93,7 +92,7 @@
   public void setUp() throws Exception {
     rand = Utils.createRandom();
     unsafe = Utils.getUnsafe();
-    m_act = new NonVolatileMemAllocator(new PMallocServiceImpl(), 1024 * 1024 * 1024,
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
         "./pobj_hashmaps.dat", true);
     cKEYCAPACITY = m_act.handlerCapacity();
     m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashSetNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashSetNGTest.java
index 70a3a6e..d37c7b2 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashSetNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableHashSetNGTest.java
@@ -25,7 +25,6 @@
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.Utils;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 import org.apache.mnemonic.OutOfHybridMemory;
 import org.apache.mnemonic.DurableBuffer;
 import org.apache.mnemonic.DurableChunk;
@@ -93,7 +92,7 @@
   public void setUp() throws Exception {
     rand = Utils.createRandom();
     unsafe = Utils.getUnsafe();
-    m_act = new NonVolatileMemAllocator(new PMallocServiceImpl(), 1024 * 1024 * 1024,
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
         "./pobj_hashset.dat", true);
     cKEYCAPACITY = m_act.handlerCapacity();
     m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurablePersonNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurablePersonNGTest.java
index f9e92c6..7694b6d 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurablePersonNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurablePersonNGTest.java
@@ -22,7 +22,6 @@
 import org.apache.mnemonic.Reclaim;
 import org.apache.mnemonic.RetrieveDurableEntityError;
 import org.apache.mnemonic.Utils;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 import org.testng.annotations.Test;
 import java.nio.ByteBuffer;
 import java.util.Random;
@@ -39,7 +38,7 @@
   @Test(expectedExceptions = { OutOfHybridMemory.class })
   public void testGenPeople() throws OutOfHybridMemory, RetrieveDurableEntityError {
     Random rand = Utils.createRandom();
-    NonVolatileMemAllocator act = new NonVolatileMemAllocator(new PMallocServiceImpl(),
+    NonVolatileMemAllocator act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
         1024 * 1024 * 8, "./pobj_person.dat", true);
     cKEYCAPACITY = act.handlerCapacity();
     act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
@@ -111,7 +110,7 @@
 
   @Test(dependsOnMethods = { "testGenPeople" })
   public void testCheckPeople() throws RetrieveDurableEntityError {
-    NonVolatileMemAllocator act = new NonVolatileMemAllocator(new PMallocServiceImpl(),
+    NonVolatileMemAllocator act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"),
         1024 * 1024 * 8, "./pobj_person.dat", true);
     act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
       @Override
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListNGTest.java
index f35a67c..923af07 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListNGTest.java
@@ -25,7 +25,6 @@
 
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 import org.apache.mnemonic.EntityFactoryProxy;
 import org.apache.mnemonic.Reclaim;
 import org.apache.mnemonic.Utils;
@@ -48,7 +47,7 @@
   @BeforeClass
   public void setUp() {
     m_rand = Utils.createRandom();
-    m_act = new NonVolatileMemAllocator(new PMallocServiceImpl(), 1024 * 1024 * 1024,
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
         "./pobj_NodeValue.dat", true);
     cKEYCAPACITY = m_act.handlerCapacity();
     m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListWithParamHolderNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListWithParamHolderNGTest.java
index 6736acb..f0716e3 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListWithParamHolderNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListWithParamHolderNGTest.java
@@ -25,7 +25,6 @@
 
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 import org.apache.mnemonic.EntityFactoryProxy;
 import org.apache.mnemonic.Reclaim;
 import org.apache.mnemonic.Utils;
@@ -50,7 +49,7 @@
   @BeforeClass
   public void setUp() {
     m_rand = Utils.createRandom();
-    m_act = new NonVolatileMemAllocator(new PMallocServiceImpl(), 1024 * 1024 * 1024,
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
         "./pobj_NodeValue_WithParamHolder.dat", true);
     ph = new ParameterHolder();
 
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableTreeNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableTreeNGTest.java
index 5f0a91a..7047bbb 100644
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableTreeNGTest.java
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableTreeNGTest.java
@@ -24,7 +24,6 @@
 import org.apache.mnemonic.EntityFactoryProxyHelper;
 import org.apache.mnemonic.Utils;
 import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.service.memory.internal.PMallocServiceImpl;
 //import org.apache.mnemonic.OutOfHybridMemory;
 import org.apache.mnemonic.EntityFactoryProxy;
 import org.apache.mnemonic.DurableType;
@@ -53,7 +52,7 @@
   public void setUp() throws Exception {
     rand = Utils.createRandom();
     unsafe = Utils.getUnsafe();
-    m_act = new NonVolatileMemAllocator(new PMallocServiceImpl(), 1024 * 1024 * 1024,
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
         "./pobj_tree.dat", true);
     cKEYCAPACITY = m_act.handlerCapacity();
     m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {