mnemonic-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [1/2] incubator-mnemonic git commit: MNEMONIC-92: Rename DurableNodeValue<E> to DurableSinglyLinkedList<E>
Date Wed, 24 Aug 2016 05:22:43 GMT
Repository: incubator-mnemonic
Updated Branches:
  refs/heads/master 6fd4b9c01 -> 29e36cd7c


MNEMONIC-92: Rename DurableNodeValue<E> to DurableSinglyLinkedList<E>


Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/d2920331
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/d2920331
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/d2920331

Branch: refs/heads/master
Commit: d292033138d1dd8e506adea0c2e3637fe70b12ce
Parents: 6fd4b9c
Author: Yanhui Zhao <yanhui.zhao@outlook.com>
Authored: Tue Aug 23 22:53:12 2016 +0000
Committer: Yanhui Zhao <yanhui.zhao@outlook.com>
Committed: Wed Aug 24 04:52:08 2016 +0000

----------------------------------------------------------------------
 README.md                                       |   4 +-
 .../mnemonic/collections/DurableNodeValue.java  | 180 ------------
 .../collections/DurableSinglyLinkedList.java    | 180 ++++++++++++
 .../collections/DurableNodeValueNGTest.java     | 274 ------------------
 .../DurableSinglyLinkedListNGTest.java          | 276 +++++++++++++++++++
 .../src/test/resources/testng.xml               |   4 +-
 .../DurableNodeValueNGPrintTest.java            | 240 ----------------
 .../DurableSinglyLinkedListNGPrintTest.java     | 240 ++++++++++++++++
 .../src/test/resources/testng.xml               |   4 +-
 9 files changed, 702 insertions(+), 700 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 8d8fc7a..a36f4d9 100644
--- a/README.md
+++ b/README.md
@@ -256,13 +256,13 @@ To run several test cases:
   $ mvn -Dtest=MemClusteringNGTest test -pl mnemonic-core -DskipTests=false
   
   $ # a testcase for module "mnemonic-collection" that requires 'pmalloc' memory service to pass
-  $ mvn -Dtest=DurableNodeValueNGTest  test -pl mnemonic-collections -DskipTests=false
+  $ mvn -Dtest=DurableSinglyLinkedListNGTest  test -pl mnemonic-collections -DskipTests=false
   
   $ # a testcase for module "mnemonic-collection" that requires 'pmalloc' memory service to pass
   $ mvn -Dtest=DurablePersonNGTest  test -pl mnemonic-collections -DskipTests=false
   
   $ # a testcase for module "mnemonic-computing-services/mnemonic-utilities-service" that requires 'pmalloc' memory service to pass
-  $ mvn -Dtest=DurableNodeValueNGPrintTest test -pl mnemonic-computing-services/mnemonic-utilities-service -DskipTests=false
+  $ mvn -Dtest=DurableSinglyLinkedListNGPrintTest test -pl mnemonic-computing-services/mnemonic-utilities-service -DskipTests=false
 ```
 
 ### Where is the document ?

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableNodeValue.java
----------------------------------------------------------------------
diff --git a/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableNodeValue.java b/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableNodeValue.java
deleted file mode 100644
index ed5b83b..0000000
--- a/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableNodeValue.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.mnemonic.collections;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import org.apache.mnemonic.Durable;
-import org.apache.mnemonic.EntityFactoryProxy;
-import org.apache.mnemonic.DurableType;
-import org.apache.mnemonic.DurableEntity;
-import org.apache.mnemonic.DurableGetter;
-import org.apache.mnemonic.DurableSetter;
-
-/**
- * this class defines a non-volatile node for a generic value to form a
- * unidirectional link
- *
- */
-@DurableEntity
-public abstract class DurableNodeValue<E> implements Durable, Iterable<E> {
-  protected transient EntityFactoryProxy[] m_node_efproxies;
-  protected transient DurableType[] m_node_gftypes;
-
-  /**
-   * creation callback for initialization
-   *
-   */
-  @Override
-  public void initializeAfterCreate() {
-    // System.out.println("Initializing After Created");
-  }
-
-  /**
-   * restore callback for initialization
-   *
-   */
-  @Override
-  public void initializeAfterRestore() {
-    // System.out.println("Initializing After Restored");
-  }
-
-  /**
-   * this function will be invoked by its factory to setup generic related info
-   * to avoid expensive operations from reflection
-   *
-   * @param efproxies
-   *          specify a array of factory to proxy the restoring of its generic
-   *          field objects
-   *
-   * @param gftypes
-   *          specify a array of types corresponding to efproxies
-   */
-  @Override
-  public void setupGenericInfo(EntityFactoryProxy[] efproxies, DurableType[] gftypes) {
-    m_node_efproxies = efproxies;
-    m_node_gftypes = gftypes;
-  }
-
-  /**
-   * get the item value of this node
-   *
-   * @return the item value of this node
-   */
-  @DurableGetter(Id = 1L, EntityFactoryProxies = "m_node_efproxies", GenericFieldTypes = "m_node_gftypes")
-  public abstract E getItem();
-
-  /**
-   * set a value to this node item
-   * 
-   * @param value
-   *          the value to be set
-   *
-   * @param destroy
-   *          true if want to destroy exist one
-   *
-   */
-  @DurableSetter
-  public abstract void setItem(E value, boolean destroy);
-
-  /**
-   * get next node
-   *
-   * @return the next node
-   *
-   */
-  @DurableGetter(Id = 2L, EntityFactoryProxies = "m_node_efproxies", GenericFieldTypes = "m_node_gftypes")
-  public abstract DurableNodeValue<E> getNext();
-
-  /**
-   * set next node
-   *
-   * @param next
-   *          specify the next node
-   *
-   * @param destroy
-   *          true if want to destroy the exist node
-   */
-  @DurableSetter
-  public abstract void setNext(DurableNodeValue<E> next, boolean destroy);
-
-  /**
-   * get an iterator instance of this list
-   *
-   * @return an iterator of this list
-   */
-  @Override
-  public Iterator<E> iterator() {
-    return new Intr(this);
-  }
-
-  /**
-   * this class defines a iterator for this non-volatile list
-   *
-   */
-  private class Intr implements Iterator<E> {
-
-    protected DurableNodeValue<E> next = null;
-
-    /**
-     * Constructor
-     *
-     * @param head
-     *          the start point for this iterator
-     *
-     */
-    Intr(DurableNodeValue<E> head) {
-      next = head;
-    }
-
-    /**
-     * determine the existing of next
-     *
-     * @return true if there is a next node
-     *
-     */
-    @Override
-    public boolean hasNext() {
-      return null != next;
-    }
-
-    /**
-     * get next node
-     *
-     * @return the next node
-     */
-    @Override
-    public E next() {
-      if (null == next) {
-        new NoSuchElementException();
-      }
-      E ret = next.getItem();
-      next = next.getNext();
-      return ret;
-    }
-
-    /**
-     * override remove()
-     */
-    @Override
-    public void remove() {
-      throw new UnsupportedOperationException();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableSinglyLinkedList.java
----------------------------------------------------------------------
diff --git a/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableSinglyLinkedList.java b/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableSinglyLinkedList.java
new file mode 100644
index 0000000..545ecdd
--- /dev/null
+++ b/mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableSinglyLinkedList.java
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.collections;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.mnemonic.Durable;
+import org.apache.mnemonic.EntityFactoryProxy;
+import org.apache.mnemonic.DurableType;
+import org.apache.mnemonic.DurableEntity;
+import org.apache.mnemonic.DurableGetter;
+import org.apache.mnemonic.DurableSetter;
+
+/**
+ * this class defines a non-volatile node for a generic value to form a
+ * unidirectional link
+ *
+ */
+@DurableEntity
+public abstract class DurableSinglyLinkedList<E> implements Durable, Iterable<E> {
+  protected transient EntityFactoryProxy[] m_node_efproxies;
+  protected transient DurableType[] m_node_gftypes;
+
+  /**
+   * creation callback for initialization
+   *
+   */
+  @Override
+  public void initializeAfterCreate() {
+    // System.out.println("Initializing After Created");
+  }
+
+  /**
+   * restore callback for initialization
+   *
+   */
+  @Override
+  public void initializeAfterRestore() {
+    // System.out.println("Initializing After Restored");
+  }
+
+  /**
+   * this function will be invoked by its factory to setup generic related info
+   * to avoid expensive operations from reflection
+   *
+   * @param efproxies
+   *          specify a array of factory to proxy the restoring of its generic
+   *          field objects
+   *
+   * @param gftypes
+   *          specify a array of types corresponding to efproxies
+   */
+  @Override
+  public void setupGenericInfo(EntityFactoryProxy[] efproxies, DurableType[] gftypes) {
+    m_node_efproxies = efproxies;
+    m_node_gftypes = gftypes;
+  }
+
+  /**
+   * get the item value of this node
+   *
+   * @return the item value of this node
+   */
+  @DurableGetter(Id = 1L, EntityFactoryProxies = "m_node_efproxies", GenericFieldTypes = "m_node_gftypes")
+  public abstract E getItem();
+
+  /**
+   * set a value to this node item
+   * 
+   * @param value
+   *          the value to be set
+   *
+   * @param destroy
+   *          true if want to destroy exist one
+   *
+   */
+  @DurableSetter
+  public abstract void setItem(E value, boolean destroy);
+
+  /**
+   * get next node
+   *
+   * @return the next node
+   *
+   */
+  @DurableGetter(Id = 2L, EntityFactoryProxies = "m_node_efproxies", GenericFieldTypes = "m_node_gftypes")
+  public abstract DurableSinglyLinkedList<E> getNext();
+
+  /**
+   * set next node
+   *
+   * @param next
+   *          specify the next node
+   *
+   * @param destroy
+   *          true if want to destroy the exist node
+   */
+  @DurableSetter
+  public abstract void setNext(DurableSinglyLinkedList<E> next, boolean destroy);
+
+  /**
+   * get an iterator instance of this list
+   *
+   * @return an iterator of this list
+   */
+  @Override
+  public Iterator<E> iterator() {
+    return new Intr(this);
+  }
+
+  /**
+   * this class defines a iterator for this non-volatile list
+   *
+   */
+  private class Intr implements Iterator<E> {
+
+    protected DurableSinglyLinkedList<E> next = null;
+
+    /**
+     * Constructor
+     *
+     * @param head
+     *          the start point for this iterator
+     *
+     */
+    Intr(DurableSinglyLinkedList<E> head) {
+      next = head;
+    }
+
+    /**
+     * determine the existing of next
+     *
+     * @return true if there is a next node
+     *
+     */
+    @Override
+    public boolean hasNext() {
+      return null != next;
+    }
+
+    /**
+     * get next node
+     *
+     * @return the next node
+     */
+    @Override
+    public E next() {
+      if (null == next) {
+        new NoSuchElementException();
+      }
+      E ret = next.getItem();
+      next = next.getNext();
+      return ret;
+    }
+
+    /**
+     * override remove()
+     */
+    @Override
+    public void remove() {
+      throw new UnsupportedOperationException();
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableNodeValueNGTest.java
----------------------------------------------------------------------
diff --git a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableNodeValueNGTest.java b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableNodeValueNGTest.java
deleted file mode 100644
index 35ec692..0000000
--- a/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableNodeValueNGTest.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.mnemonic.collections;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-
-import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.RestorableAllocator;
-import org.apache.mnemonic.Durable;
-import org.apache.mnemonic.EntityFactoryProxy;
-import org.apache.mnemonic.Reclaim;
-import org.apache.mnemonic.Utils;
-import org.apache.mnemonic.DurableType;
-import org.testng.AssertJUnit;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- *
- *
- */
-
-public class DurableNodeValueNGTest {
-  private long cKEYCAPACITY;
-  private Random m_rand;
-  private NonVolatileMemAllocator m_act;
-
-  @BeforeClass
-  public void setUp() {
-    m_rand = Utils.createRandom();
-    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
-        "./pobj_NodeValue.dat", true);
-    cKEYCAPACITY = m_act.handlerCapacity();
-    m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
-      @Override
-      public boolean reclaim(ByteBuffer mres, Long sz) {
-        System.out.println(String.format("Reclaim Memory Buffer: %X  Size: %s", System.identityHashCode(mres),
-            null == sz ? "NULL" : sz.toString()));
-        return false;
-      }
-    });
-    m_act.setChunkReclaimer(new Reclaim<Long>() {
-      @Override
-      public boolean reclaim(Long mres, Long sz) {
-        System.out.println(String.format("Reclaim Memory Chunk: %X  Size: %s", System.identityHashCode(mres),
-            null == sz ? "NULL" : sz.toString()));
-        return false;
-      }
-    });
-
-    for (long i = 0; i < cKEYCAPACITY; ++i) {
-      m_act.setHandler(i, 0L);
-    }
-  }
-
-  @AfterClass
-  public void tearDown() {
-    m_act.close();
-  }
-
-  @Test(enabled = false)
-  public void testSingleNodeValueWithInteger() {
-    int val = m_rand.nextInt();
-    DurableType gtypes[] = {DurableType.INTEGER};
-    DurableNodeValue<Integer> plln = DurableNodeValueFactory.create(m_act, null, gtypes, false);
-    plln.setItem(val, false);
-    Long handler = plln.getHandler();
-    System.err.println("-------------Start to Restore Integer -----------");
-    DurableNodeValue<Integer> plln2 = DurableNodeValueFactory.restore(m_act, null, gtypes, handler, false);
-    AssertJUnit.assertEquals(val, (int) plln2.getItem());
-  }
-
-  @Test(enabled = false)
-  public void testNodeValueWithString() {
-    String val = Utils.genRandomString();
-    DurableType gtypes[] = {DurableType.STRING};
-    DurableNodeValue<String> plln = DurableNodeValueFactory.create(m_act, null, gtypes, false);
-    plln.setItem(val, false);
-    Long handler = plln.getHandler();
-    System.err.println("-------------Start to Restore String-----------");
-    DurableNodeValue<String> plln2 = DurableNodeValueFactory.restore(m_act, null, gtypes, handler, false);
-    AssertJUnit.assertEquals(val, plln2.getItem());
-  }
-
-  @Test(enabled = false)
-  public void testNodeValueWithPerson() {
-
-    Person<Long> person = PersonFactory.create(m_act);
-    person.setAge((short) 31);
-
-    DurableType gtypes[] = {DurableType.DURABLE};
-    EntityFactoryProxy efproxies[] = {new EntityFactoryProxy() {
-      @Override
-      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
-          DurableType[] gfields, long phandler, boolean autoreclaim) {
-        return PersonFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
-      }
-    } };
-
-    DurableNodeValue<Person<Long>> plln = DurableNodeValueFactory.create(m_act, efproxies, gtypes, false);
-    plln.setItem(person, false);
-    Long handler = plln.getHandler();
-
-    DurableNodeValue<Person<Long>> plln2 = DurableNodeValueFactory.restore(m_act, efproxies, gtypes, handler,
-        false);
-    AssertJUnit.assertEquals(31, (int) plln2.getItem().getAge());
-
-  }
-
-  @Test(enabled = false)
-  public void testLinkedNodeValueWithPerson() {
-
-    int elem_count = 10;
-    List<Long> referlist = new ArrayList();
-
-    DurableType listgftypes[] = {DurableType.DURABLE};
-    EntityFactoryProxy listefproxies[] = {new EntityFactoryProxy() {
-      @Override
-      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
-          DurableType[] gfields, long phandler, boolean autoreclaim) {
-        return PersonFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
-      }
-    } };
-
-    DurableNodeValue<Person<Long>> firstnv = DurableNodeValueFactory.create(m_act, listefproxies, listgftypes,
-        false);
-
-    DurableNodeValue<Person<Long>> nextnv = firstnv;
-
-    Person<Long> person;
-    long val;
-    DurableNodeValue<Person<Long>> newnv;
-    for (int i = 0; i < elem_count; ++i) {
-      person = PersonFactory.create(m_act);
-      person.setAge((short) m_rand.nextInt(50));
-      person.setName(String.format("Name: [%s]", Utils.genRandomString()), true);
-      nextnv.setItem(person, false);
-      newnv = DurableNodeValueFactory.create(m_act, listefproxies, listgftypes, false);
-      nextnv.setNext(newnv, false);
-      nextnv = newnv;
-    }
-
-    Person<Long> eval;
-    DurableNodeValue<Person<Long>> iternv = firstnv;
-    while (null != iternv) {
-      System.out.printf(" Stage 1 --->\n");
-      eval = iternv.getItem();
-      if (null != eval) {
-        eval.testOutput();
-      }
-      iternv = iternv.getNext();
-    }
-
-    long handler = firstnv.getHandler();
-
-    DurableNodeValue<Person<Long>> firstnv2 = DurableNodeValueFactory.restore(m_act, listefproxies, listgftypes,
-        handler, false);
-
-    for (Person<Long> eval2 : firstnv2) {
-      System.out.printf(" Stage 2 ---> \n");
-      if (null != eval2) {
-        eval2.testOutput();
-      }
-    }
-
-    // Assert.assert, expected);(plist, plist2);
-
-  }
-
-  @Test(enabled = true)
-  public void testLinkedNodeValueWithLinkedNodeValue() {
-
-    int elem_count = 10;
-    long slotKeyId = 10;
-
-    DurableType[] elem_gftypes = {DurableType.DOUBLE};
-    EntityFactoryProxy[] elem_efproxies = null;
-
-    DurableType linkedgftypes[] = {DurableType.DURABLE, DurableType.DOUBLE};
-    EntityFactoryProxy linkedefproxies[] = {new EntityFactoryProxy() {
-      @Override
-      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
-          DurableType[] gfields, long phandler, boolean autoreclaim) {
-        EntityFactoryProxy[] val_efproxies = null;
-        DurableType[] val_gftypes = null;
-        if (null != factoryproxys && factoryproxys.length >= 2) {
-          val_efproxies = Arrays.copyOfRange(factoryproxys, 1, factoryproxys.length);
-        }
-        if (null != gfields && gfields.length >= 2) {
-          val_gftypes = Arrays.copyOfRange(gfields, 1, gfields.length);
-        }
-        return DurableNodeValueFactory.restore(allocator, val_efproxies, val_gftypes, phandler, autoreclaim);
-      }
-    } };
-
-    DurableNodeValue<DurableNodeValue<Double>> nextnv = null, pre_nextnv = null;
-    DurableNodeValue<Double> elem = null, pre_elem = null, first_elem = null;
-
-    Long linkhandler = 0L;
-
-    System.out.printf(" Stage 1 -testLinkedNodeValueWithLinkedNodeValue--> \n");
-
-    pre_nextnv = null;
-    Double val;
-    for (int i = 0; i < elem_count; ++i) {
-      first_elem = null;
-      pre_elem = null;
-      for (int v = 0; v < 3; ++v) {
-        elem = DurableNodeValueFactory.create(m_act, elem_efproxies, elem_gftypes, false);
-        val = m_rand.nextDouble();
-        elem.setItem(val, false);
-        if (null == pre_elem) {
-          first_elem = elem;
-        } else {
-          pre_elem.setNext(elem, false);
-        }
-        pre_elem = elem;
-        System.out.printf("%f ", val);
-      }
-
-      nextnv = DurableNodeValueFactory.create(m_act, linkedefproxies, linkedgftypes, false);
-      nextnv.setItem(first_elem, false);
-      if (null == pre_nextnv) {
-        linkhandler = nextnv.getHandler();
-      } else {
-        pre_nextnv.setNext(nextnv, false);
-      }
-      pre_nextnv = nextnv;
-      System.out.printf(" generated an item... \n");
-    }
-    m_act.setHandler(slotKeyId, linkhandler);
-
-    long handler = m_act.getHandler(slotKeyId);
-
-    DurableNodeValue<DurableNodeValue<Double>> linkedvals = DurableNodeValueFactory.restore(m_act,
-        linkedefproxies, linkedgftypes, handler, false);
-    Iterator<DurableNodeValue<Double>> iter = linkedvals.iterator();
-    Iterator<Double> elemiter = null;
-
-    System.out.printf(" Stage 2 -testLinkedNodeValueWithLinkedNodeValue--> \n");
-    while (iter.hasNext()) {
-      elemiter = iter.next().iterator();
-      while (elemiter.hasNext()) {
-        System.out.printf("%f ", elemiter.next());
-      }
-      System.out.printf(" Fetched an item... \n");
-    }
-
-    // Assert.assert, expected);(plist, plist2);
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListNGTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..b90dc81
--- /dev/null
+++ b/mnemonic-collections/src/test/java/org/apache/mnemonic/collections/DurableSinglyLinkedListNGTest.java
@@ -0,0 +1,276 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.collections;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.mnemonic.NonVolatileMemAllocator;
+import org.apache.mnemonic.RestorableAllocator;
+import org.apache.mnemonic.Durable;
+import org.apache.mnemonic.EntityFactoryProxy;
+import org.apache.mnemonic.Reclaim;
+import org.apache.mnemonic.Utils;
+import org.apache.mnemonic.DurableType;
+import org.testng.AssertJUnit;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ *
+ *
+ */
+
+public class DurableSinglyLinkedListNGTest {
+  private long cKEYCAPACITY;
+  private Random m_rand;
+  private NonVolatileMemAllocator m_act;
+
+  @BeforeClass
+  public void setUp() {
+    m_rand = Utils.createRandom();
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
+        "./pobj_NodeValue.dat", true);
+    cKEYCAPACITY = m_act.handlerCapacity();
+    m_act.setBufferReclaimer(new Reclaim<ByteBuffer>() {
+      @Override
+      public boolean reclaim(ByteBuffer mres, Long sz) {
+        System.out.println(String.format("Reclaim Memory Buffer: %X  Size: %s", System.identityHashCode(mres),
+            null == sz ? "NULL" : sz.toString()));
+        return false;
+      }
+    });
+    m_act.setChunkReclaimer(new Reclaim<Long>() {
+      @Override
+      public boolean reclaim(Long mres, Long sz) {
+        System.out.println(String.format("Reclaim Memory Chunk: %X  Size: %s", System.identityHashCode(mres),
+            null == sz ? "NULL" : sz.toString()));
+        return false;
+      }
+    });
+
+    for (long i = 0; i < cKEYCAPACITY; ++i) {
+      m_act.setHandler(i, 0L);
+    }
+  }
+
+  @AfterClass
+  public void tearDown() {
+    m_act.close();
+  }
+
+  @Test(enabled = false)
+  public void testSingleNodeValueWithInteger() {
+    int val = m_rand.nextInt();
+    DurableType gtypes[] = {DurableType.INTEGER};
+    DurableSinglyLinkedList<Integer> plln = DurableSinglyLinkedListFactory.create(m_act, null, gtypes, false);
+    plln.setItem(val, false);
+    Long handler = plln.getHandler();
+    System.err.println("-------------Start to Restore Integer -----------");
+    DurableSinglyLinkedList<Integer> plln2 = DurableSinglyLinkedListFactory.restore(m_act, null, gtypes, handler, 
+        false);
+    AssertJUnit.assertEquals(val, (int) plln2.getItem());
+  }
+
+  @Test(enabled = false)
+  public void testNodeValueWithString() {
+    String val = Utils.genRandomString();
+    DurableType gtypes[] = {DurableType.STRING};
+    DurableSinglyLinkedList<String> plln = DurableSinglyLinkedListFactory.create(m_act, null, gtypes, false);
+    plln.setItem(val, false);
+    Long handler = plln.getHandler();
+    System.err.println("-------------Start to Restore String-----------");
+    DurableSinglyLinkedList<String> plln2 = DurableSinglyLinkedListFactory.restore(m_act, null, gtypes, handler, 
+        false);
+    AssertJUnit.assertEquals(val, plln2.getItem());
+  }
+
+  @Test(enabled = false)
+  public void testNodeValueWithPerson() {
+
+    Person<Long> person = PersonFactory.create(m_act);
+    person.setAge((short) 31);
+
+    DurableType gtypes[] = {DurableType.DURABLE};
+    EntityFactoryProxy efproxies[] = {new EntityFactoryProxy() {
+      @Override
+      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
+          DurableType[] gfields, long phandler, boolean autoreclaim) {
+        return PersonFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
+      }
+    } };
+
+    DurableSinglyLinkedList<Person<Long>> plln = DurableSinglyLinkedListFactory.create(m_act, efproxies, gtypes, false);
+    plln.setItem(person, false);
+    Long handler = plln.getHandler();
+
+    DurableSinglyLinkedList<Person<Long>> plln2 = DurableSinglyLinkedListFactory.restore(m_act, efproxies, gtypes, 
+        handler, false);
+    AssertJUnit.assertEquals(31, (int) plln2.getItem().getAge());
+
+  }
+
+  @Test(enabled = false)
+  public void testLinkedNodeValueWithPerson() {
+
+    int elem_count = 10;
+    List<Long> referlist = new ArrayList();
+
+    DurableType listgftypes[] = {DurableType.DURABLE};
+    EntityFactoryProxy listefproxies[] = {new EntityFactoryProxy() {
+      @Override
+      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
+          DurableType[] gfields, long phandler, boolean autoreclaim) {
+        return PersonFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
+      }
+    } };
+
+    DurableSinglyLinkedList<Person<Long>> firstnv = DurableSinglyLinkedListFactory.create(m_act, listefproxies, 
+        listgftypes, false);
+
+    DurableSinglyLinkedList<Person<Long>> nextnv = firstnv;
+
+    Person<Long> person;
+    long val;
+    DurableSinglyLinkedList<Person<Long>> newnv;
+    for (int i = 0; i < elem_count; ++i) {
+      person = PersonFactory.create(m_act);
+      person.setAge((short) m_rand.nextInt(50));
+      person.setName(String.format("Name: [%s]", Utils.genRandomString()), true);
+      nextnv.setItem(person, false);
+      newnv = DurableSinglyLinkedListFactory.create(m_act, listefproxies, listgftypes, false);
+      nextnv.setNext(newnv, false);
+      nextnv = newnv;
+    }
+
+    Person<Long> eval;
+    DurableSinglyLinkedList<Person<Long>> iternv = firstnv;
+    while (null != iternv) {
+      System.out.printf(" Stage 1 --->\n");
+      eval = iternv.getItem();
+      if (null != eval) {
+        eval.testOutput();
+      }
+      iternv = iternv.getNext();
+    }
+
+    long handler = firstnv.getHandler();
+
+    DurableSinglyLinkedList<Person<Long>> firstnv2 = DurableSinglyLinkedListFactory.restore(m_act, listefproxies, 
+        listgftypes, handler, false);
+
+    for (Person<Long> eval2 : firstnv2) {
+      System.out.printf(" Stage 2 ---> \n");
+      if (null != eval2) {
+        eval2.testOutput();
+      }
+    }
+
+    // Assert.assert, expected);(plist, plist2);
+
+  }
+
+  @Test(enabled = true)
+  public void testLinkedNodeValueWithLinkedNodeValue() {
+
+    int elem_count = 10;
+    long slotKeyId = 10;
+
+    DurableType[] elem_gftypes = {DurableType.DOUBLE};
+    EntityFactoryProxy[] elem_efproxies = null;
+
+    DurableType linkedgftypes[] = {DurableType.DURABLE, DurableType.DOUBLE};
+    EntityFactoryProxy linkedefproxies[] = {new EntityFactoryProxy() {
+      @Override
+      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
+          DurableType[] gfields, long phandler, boolean autoreclaim) {
+        EntityFactoryProxy[] val_efproxies = null;
+        DurableType[] val_gftypes = null;
+        if (null != factoryproxys && factoryproxys.length >= 2) {
+          val_efproxies = Arrays.copyOfRange(factoryproxys, 1, factoryproxys.length);
+        }
+        if (null != gfields && gfields.length >= 2) {
+          val_gftypes = Arrays.copyOfRange(gfields, 1, gfields.length);
+        }
+        return DurableSinglyLinkedListFactory.restore(allocator, val_efproxies, val_gftypes, phandler, autoreclaim);
+      }
+    } };
+
+    DurableSinglyLinkedList<DurableSinglyLinkedList<Double>> nextnv = null, pre_nextnv = null;
+    DurableSinglyLinkedList<Double> elem = null, pre_elem = null, first_elem = null;
+
+    Long linkhandler = 0L;
+
+    System.out.printf(" Stage 1 -testLinkedNodeValueWithLinkedNodeValue--> \n");
+
+    pre_nextnv = null;
+    Double val;
+    for (int i = 0; i < elem_count; ++i) {
+      first_elem = null;
+      pre_elem = null;
+      for (int v = 0; v < 3; ++v) {
+        elem = DurableSinglyLinkedListFactory.create(m_act, elem_efproxies, elem_gftypes, false);
+        val = m_rand.nextDouble();
+        elem.setItem(val, false);
+        if (null == pre_elem) {
+          first_elem = elem;
+        } else {
+          pre_elem.setNext(elem, false);
+        }
+        pre_elem = elem;
+        System.out.printf("%f ", val);
+      }
+
+      nextnv = DurableSinglyLinkedListFactory.create(m_act, linkedefproxies, linkedgftypes, false);
+      nextnv.setItem(first_elem, false);
+      if (null == pre_nextnv) {
+        linkhandler = nextnv.getHandler();
+      } else {
+        pre_nextnv.setNext(nextnv, false);
+      }
+      pre_nextnv = nextnv;
+      System.out.printf(" generated an item... \n");
+    }
+    m_act.setHandler(slotKeyId, linkhandler);
+
+    long handler = m_act.getHandler(slotKeyId);
+
+    DurableSinglyLinkedList<DurableSinglyLinkedList<Double>> linkedvals = DurableSinglyLinkedListFactory.restore(m_act,
+        linkedefproxies, linkedgftypes, handler, false);
+    Iterator<DurableSinglyLinkedList<Double>> iter = linkedvals.iterator();
+    Iterator<Double> elemiter = null;
+
+    System.out.printf(" Stage 2 -testLinkedNodeValueWithLinkedNodeValue--> \n");
+    while (iter.hasNext()) {
+      elemiter = iter.next().iterator();
+      while (elemiter.hasNext()) {
+        System.out.printf("%f ", elemiter.next());
+      }
+      System.out.printf(" Fetched an item... \n");
+    }
+
+    // Assert.assert, expected);(plist, plist2);
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-collections/src/test/resources/testng.xml
----------------------------------------------------------------------
diff --git a/mnemonic-collections/src/test/resources/testng.xml b/mnemonic-collections/src/test/resources/testng.xml
index dc1bff0..7e00577 100644
--- a/mnemonic-collections/src/test/resources/testng.xml
+++ b/mnemonic-collections/src/test/resources/testng.xml
@@ -23,7 +23,7 @@
 <suite name="Suite" verbose="1" parallel="tests" thread-count="1">
   <test name="Test">
     <classes>
-      <class name="org.apache.mnemonic.collections.DurableNodeValueNGTest"/> 
+      <class name="org.apache.mnemonic.collections.DurableSinglyLinkedListNGTest"/> 
     </classes>
   </test> <!-- Test -->
 </suite> <!-- Suite -->
@@ -33,5 +33,5 @@
       <class name="org.apache.mnemonic.collections.Person"/>
       <class name="org.apache.mnemonic.collections.DurablePersonNGTest"/>
       <class name="org.apache.mnemonic.collections.DurableListNGTest"/>
-      <class name="org.apache.mnemonic.collections.DurableNodeValueNGTest"/> 
+      <class name="org.apache.mnemonic.collections.DurableSinglyLinkedListNGTest"/> 
  -->

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableNodeValueNGPrintTest.java
----------------------------------------------------------------------
diff --git a/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableNodeValueNGPrintTest.java b/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableNodeValueNGPrintTest.java
deleted file mode 100644
index 5a2ed70..0000000
--- a/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableNodeValueNGPrintTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.mnemonic.service.computingservice;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.apache.mnemonic.NonVolatileMemAllocator;
-import org.apache.mnemonic.RestorableAllocator;
-import org.apache.mnemonic.Durable;
-import org.apache.mnemonic.EntityFactoryProxy;
-import org.apache.mnemonic.Utils;
-import org.apache.mnemonic.DurableType;
-import org.apache.mnemonic.collections.DurableNodeValue;
-import org.apache.mnemonic.collections.DurableNodeValueFactory;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * A Test case suit, verify and demo the durable native computing services (DNCS) infra.
- *
- */
-
-public class DurableNodeValueNGPrintTest {
-  public static String uri = "./pobj_NodeValue_print.dat";
-  private long cKEYCAPACITY;
-  private Random m_rand;
-  private NonVolatileMemAllocator m_act;
-
-  @BeforeClass
-  public void setUp() throws IOException {
-    m_rand = Utils.createRandom();
-    Files.deleteIfExists(Paths.get(uri));
-    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
-        uri, true);
-    cKEYCAPACITY = m_act.handlerCapacity();
-    for (long i = 0; i < cKEYCAPACITY; ++i) {
-      m_act.setHandler(i, 0L);
-    }
-  }
-
-  @AfterClass
-  public void tearDown() {
-    m_act.close();
-  }
-
-  @Test(enabled = true)
-  public void testLinkedNodeValueWithPerson() {
-
-    int elem_count = 10;
-
-    DurableType listgftypes[] = {DurableType.DURABLE};
-    EntityFactoryProxy listefproxies[] = {new EntityFactoryProxy() {
-      @Override
-      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
-          DurableType[] gfields, long phandler, boolean autoreclaim) {
-        return PersonFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
-      }
-    } };
-
-    DurableNodeValue<Person<Long>> firstnv = DurableNodeValueFactory.create(m_act, listefproxies, listgftypes,
-        false);
-
-    DurableNodeValue<Person<Long>> nextnv = firstnv;
-
-    Person<Long> person = null;
-    long val;
-    DurableNodeValue<Person<Long>> newnv;
-    for (int i = 0; i < elem_count; ++i) {
-      person = PersonFactory.create(m_act);
-      person.setAge((short) m_rand.nextInt(50));
-      person.setName(String.format("Name: [%s]", Utils.genRandomString()), true);
-      nextnv.setItem(person, false);
-      if (i + 1 == elem_count) {
-        break;
-      }
-      newnv = DurableNodeValueFactory.create(m_act, listefproxies, listgftypes, false);
-      nextnv.setNext(newnv, false);
-      nextnv = newnv;
-    }
-
-    Person<Long> eval;
-    DurableNodeValue<Person<Long>> iternv = firstnv;
-    System.out.printf(" -- Stage 1 Generated---\n");
-    while (null != iternv) {
-      eval = iternv.getItem();
-      if (null != eval) {
-        eval.testOutputAge();
-      }
-      iternv = iternv.getNext();
-    }
-    System.out.printf("\n");
-
-    long handler = firstnv.getHandler();
-
-    DurableNodeValue<Person<Long>> firstnv2 = DurableNodeValueFactory.restore(m_act, listefproxies, listgftypes,
-        handler, false);
-
-    System.out.printf("--- Stage 2 Restored--- \n");
-    for (Person<Long> eval2 : firstnv2) {
-      if (null != eval2) {
-        eval2.testOutputAge();
-      }
-    }
-    System.out.printf("\n");
-
-    GeneralComputingService gcsvr = Utils.getGeneralComputingService("print");
-    ValueInfo vinfo = new ValueInfo();
-    List<long[][]> objstack = new ArrayList<long[][]>();
-    objstack.add(firstnv.getNativeFieldInfo());
-    objstack.add(person.getNativeFieldInfo());
-    long[][] fidinfostack = {{2L, 1L}, {0L, 1L}};
-    vinfo.handler = handler;
-    vinfo.transtable = m_act.getTranslateTable();
-    vinfo.dtype = DurableType.SHORT;
-    vinfo.frames = Utils.genNativeParamForm(objstack, fidinfostack);
-    ValueInfo[] vinfos = {vinfo};
-    gcsvr.perform(vinfos);
-
-  }
-
-  @Test(enabled = true)
-  public void testLinkedNodeValueWithLinkedNodeValue() {
-
-    int elem_count = 10;
-    long slotKeyId = 10;
-
-    DurableType[] elem_gftypes = {DurableType.DOUBLE};
-    EntityFactoryProxy[] elem_efproxies = null;
-
-    DurableType linkedgftypes[] = {DurableType.DURABLE, DurableType.DOUBLE};
-    EntityFactoryProxy linkedefproxies[] = {new EntityFactoryProxy() {
-      @Override
-      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
-          DurableType[] gfields, long phandler, boolean autoreclaim) {
-        EntityFactoryProxy[] val_efproxies = null;
-        DurableType[] val_gftypes = null;
-        if (null != factoryproxys && factoryproxys.length >= 2) {
-          val_efproxies = Arrays.copyOfRange(factoryproxys, 1, factoryproxys.length);
-        }
-        if (null != gfields && gfields.length >= 2) {
-          val_gftypes = Arrays.copyOfRange(gfields, 1, gfields.length);
-        }
-        return DurableNodeValueFactory.restore(allocator, val_efproxies, val_gftypes, phandler, autoreclaim);
-      }
-    } };
-
-    DurableNodeValue<DurableNodeValue<Double>> nextnv = null, pre_nextnv = null;
-    DurableNodeValue<Double> elem = null, pre_elem = null, first_elem = null;
-
-    Long linkhandler = 0L;
-
-    System.out.printf(" Stage 1 -testLinkedNodeValueWithLinkedNodeValue--> \n");
-
-    pre_nextnv = null;
-    Double val;
-    for (int i = 0; i < elem_count; ++i) {
-      first_elem = null;
-      pre_elem = null;
-      for (int v = 0; v < 3; ++v) {
-        elem = DurableNodeValueFactory.create(m_act, elem_efproxies, elem_gftypes, false);
-        val = m_rand.nextDouble();
-        elem.setItem(val, false);
-        if (null == pre_elem) {
-          first_elem = elem;
-        } else {
-          pre_elem.setNext(elem, false);
-        }
-        pre_elem = elem;
-        System.out.printf("%f ", val);
-      }
-
-      nextnv = DurableNodeValueFactory.create(m_act, linkedefproxies, linkedgftypes, false);
-      nextnv.setItem(first_elem, false);
-      if (null == pre_nextnv) {
-        linkhandler = nextnv.getHandler();
-      } else {
-        pre_nextnv.setNext(nextnv, false);
-      }
-      pre_nextnv = nextnv;
-      System.out.printf(" generated an item... \n");
-    }
-    m_act.setHandler(slotKeyId, linkhandler);
-
-    long handler = m_act.getHandler(slotKeyId);
-
-    DurableNodeValue<DurableNodeValue<Double>> linkedvals = DurableNodeValueFactory.restore(m_act,
-        linkedefproxies, linkedgftypes, handler, false);
-    Iterator<DurableNodeValue<Double>> iter = linkedvals.iterator();
-    Iterator<Double> elemiter = null;
-
-    System.out.printf(" Stage 2 -testLinkedNodeValueWithLinkedNodeValue--> \n");
-    while (iter.hasNext()) {
-      elemiter = iter.next().iterator();
-      while (elemiter.hasNext()) {
-        System.out.printf("%f ", elemiter.next());
-      }
-      System.out.printf(" Fetched an item... \n");
-    }
-
-    GeneralComputingService gcsvr = Utils.getGeneralComputingService("print");
-    ValueInfo vinfo = new ValueInfo();
-    List<long[][]> objstack = new ArrayList<long[][]>();
-    objstack.add(linkedvals.getNativeFieldInfo());
-    objstack.add(linkedvals.getNativeFieldInfo());
-    long[][] fidinfostack = {{2L, 1L}, {2L, 1L}};
-    vinfo.handler = handler;
-    vinfo.transtable = m_act.getTranslateTable();
-    vinfo.dtype = DurableType.DOUBLE;
-    vinfo.frames = Utils.genNativeParamForm(objstack, fidinfostack);
-    ValueInfo[] vinfos = {vinfo};
-    gcsvr.perform(vinfos);
-
-    // Assert.assert, expected);(plist, plist2);
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableSinglyLinkedListNGPrintTest.java
----------------------------------------------------------------------
diff --git a/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableSinglyLinkedListNGPrintTest.java b/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableSinglyLinkedListNGPrintTest.java
new file mode 100644
index 0000000..e2819cf
--- /dev/null
+++ b/mnemonic-computing-services/mnemonic-utilities-service/src/test/java/org/apache/mnemonic/service/computingservice/DurableSinglyLinkedListNGPrintTest.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mnemonic.service.computingservice;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import org.apache.mnemonic.NonVolatileMemAllocator;
+import org.apache.mnemonic.RestorableAllocator;
+import org.apache.mnemonic.Durable;
+import org.apache.mnemonic.EntityFactoryProxy;
+import org.apache.mnemonic.Utils;
+import org.apache.mnemonic.DurableType;
+import org.apache.mnemonic.collections.DurableSinglyLinkedList;
+import org.apache.mnemonic.collections.DurableSinglyLinkedListFactory;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * A Test case suit, verify and demo the durable native computing services (DNCS) infra.
+ *
+ */
+
+public class DurableSinglyLinkedListNGPrintTest {
+  public static String uri = "./pobj_NodeValue_print.dat";
+  private long cKEYCAPACITY;
+  private Random m_rand;
+  private NonVolatileMemAllocator m_act;
+
+  @BeforeClass
+  public void setUp() throws IOException {
+    m_rand = Utils.createRandom();
+    Files.deleteIfExists(Paths.get(uri));
+    m_act = new NonVolatileMemAllocator(Utils.getNonVolatileMemoryAllocatorService("pmalloc"), 1024 * 1024 * 1024,
+        uri, true);
+    cKEYCAPACITY = m_act.handlerCapacity();
+    for (long i = 0; i < cKEYCAPACITY; ++i) {
+      m_act.setHandler(i, 0L);
+    }
+  }
+
+  @AfterClass
+  public void tearDown() {
+    m_act.close();
+  }
+
+  @Test(enabled = true)
+  public void testLinkedNodeValueWithPerson() {
+
+    int elem_count = 10;
+
+    DurableType listgftypes[] = {DurableType.DURABLE};
+    EntityFactoryProxy listefproxies[] = {new EntityFactoryProxy() {
+      @Override
+      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
+          DurableType[] gfields, long phandler, boolean autoreclaim) {
+        return PersonFactory.restore(allocator, factoryproxys, gfields, phandler, autoreclaim);
+      }
+    } };
+
+    DurableSinglyLinkedList<Person<Long>> firstnv = DurableSinglyLinkedListFactory.create(m_act, listefproxies, 
+        listgftypes, false);
+
+    DurableSinglyLinkedList<Person<Long>> nextnv = firstnv;
+
+    Person<Long> person = null;
+    long val;
+    DurableSinglyLinkedList<Person<Long>> newnv;
+    for (int i = 0; i < elem_count; ++i) {
+      person = PersonFactory.create(m_act);
+      person.setAge((short) m_rand.nextInt(50));
+      person.setName(String.format("Name: [%s]", Utils.genRandomString()), true);
+      nextnv.setItem(person, false);
+      if (i + 1 == elem_count) {
+        break;
+      }
+      newnv = DurableSinglyLinkedListFactory.create(m_act, listefproxies, listgftypes, false);
+      nextnv.setNext(newnv, false);
+      nextnv = newnv;
+    }
+
+    Person<Long> eval;
+    DurableSinglyLinkedList<Person<Long>> iternv = firstnv;
+    System.out.printf(" -- Stage 1 Generated---\n");
+    while (null != iternv) {
+      eval = iternv.getItem();
+      if (null != eval) {
+        eval.testOutputAge();
+      }
+      iternv = iternv.getNext();
+    }
+    System.out.printf("\n");
+
+    long handler = firstnv.getHandler();
+
+    DurableSinglyLinkedList<Person<Long>> firstnv2 = DurableSinglyLinkedListFactory.restore(m_act, listefproxies, 
+        listgftypes, handler, false);
+
+    System.out.printf("--- Stage 2 Restored--- \n");
+    for (Person<Long> eval2 : firstnv2) {
+      if (null != eval2) {
+        eval2.testOutputAge();
+      }
+    }
+    System.out.printf("\n");
+
+    GeneralComputingService gcsvr = Utils.getGeneralComputingService("print");
+    ValueInfo vinfo = new ValueInfo();
+    List<long[][]> objstack = new ArrayList<long[][]>();
+    objstack.add(firstnv.getNativeFieldInfo());
+    objstack.add(person.getNativeFieldInfo());
+    long[][] fidinfostack = {{2L, 1L}, {0L, 1L}};
+    vinfo.handler = handler;
+    vinfo.transtable = m_act.getTranslateTable();
+    vinfo.dtype = DurableType.SHORT;
+    vinfo.frames = Utils.genNativeParamForm(objstack, fidinfostack);
+    ValueInfo[] vinfos = {vinfo};
+    gcsvr.perform(vinfos);
+
+  }
+
+  @Test(enabled = true)
+  public void testLinkedNodeValueWithLinkedNodeValue() {
+
+    int elem_count = 10;
+    long slotKeyId = 10;
+
+    DurableType[] elem_gftypes = {DurableType.DOUBLE};
+    EntityFactoryProxy[] elem_efproxies = null;
+
+    DurableType linkedgftypes[] = {DurableType.DURABLE, DurableType.DOUBLE};
+    EntityFactoryProxy linkedefproxies[] = {new EntityFactoryProxy() {
+      @Override
+      public <A extends RestorableAllocator<A>> Durable restore(A allocator, EntityFactoryProxy[] factoryproxys,
+          DurableType[] gfields, long phandler, boolean autoreclaim) {
+        EntityFactoryProxy[] val_efproxies = null;
+        DurableType[] val_gftypes = null;
+        if (null != factoryproxys && factoryproxys.length >= 2) {
+          val_efproxies = Arrays.copyOfRange(factoryproxys, 1, factoryproxys.length);
+        }
+        if (null != gfields && gfields.length >= 2) {
+          val_gftypes = Arrays.copyOfRange(gfields, 1, gfields.length);
+        }
+        return DurableSinglyLinkedListFactory.restore(allocator, val_efproxies, val_gftypes, phandler, autoreclaim);
+      }
+    } };
+
+    DurableSinglyLinkedList<DurableSinglyLinkedList<Double>> nextnv = null, pre_nextnv = null;
+    DurableSinglyLinkedList<Double> elem = null, pre_elem = null, first_elem = null;
+
+    Long linkhandler = 0L;
+
+    System.out.printf(" Stage 1 -testLinkedNodeValueWithLinkedNodeValue--> \n");
+
+    pre_nextnv = null;
+    Double val;
+    for (int i = 0; i < elem_count; ++i) {
+      first_elem = null;
+      pre_elem = null;
+      for (int v = 0; v < 3; ++v) {
+        elem = DurableSinglyLinkedListFactory.create(m_act, elem_efproxies, elem_gftypes, false);
+        val = m_rand.nextDouble();
+        elem.setItem(val, false);
+        if (null == pre_elem) {
+          first_elem = elem;
+        } else {
+          pre_elem.setNext(elem, false);
+        }
+        pre_elem = elem;
+        System.out.printf("%f ", val);
+      }
+
+      nextnv = DurableSinglyLinkedListFactory.create(m_act, linkedefproxies, linkedgftypes, false);
+      nextnv.setItem(first_elem, false);
+      if (null == pre_nextnv) {
+        linkhandler = nextnv.getHandler();
+      } else {
+        pre_nextnv.setNext(nextnv, false);
+      }
+      pre_nextnv = nextnv;
+      System.out.printf(" generated an item... \n");
+    }
+    m_act.setHandler(slotKeyId, linkhandler);
+
+    long handler = m_act.getHandler(slotKeyId);
+
+    DurableSinglyLinkedList<DurableSinglyLinkedList<Double>> linkedvals = DurableSinglyLinkedListFactory.restore(m_act,
+        linkedefproxies, linkedgftypes, handler, false);
+    Iterator<DurableSinglyLinkedList<Double>> iter = linkedvals.iterator();
+    Iterator<Double> elemiter = null;
+
+    System.out.printf(" Stage 2 -testLinkedNodeValueWithLinkedNodeValue--> \n");
+    while (iter.hasNext()) {
+      elemiter = iter.next().iterator();
+      while (elemiter.hasNext()) {
+        System.out.printf("%f ", elemiter.next());
+      }
+      System.out.printf(" Fetched an item... \n");
+    }
+
+    GeneralComputingService gcsvr = Utils.getGeneralComputingService("print");
+    ValueInfo vinfo = new ValueInfo();
+    List<long[][]> objstack = new ArrayList<long[][]>();
+    objstack.add(linkedvals.getNativeFieldInfo());
+    objstack.add(linkedvals.getNativeFieldInfo());
+    long[][] fidinfostack = {{2L, 1L}, {2L, 1L}};
+    vinfo.handler = handler;
+    vinfo.transtable = m_act.getTranslateTable();
+    vinfo.dtype = DurableType.DOUBLE;
+    vinfo.frames = Utils.genNativeParamForm(objstack, fidinfostack);
+    ValueInfo[] vinfos = {vinfo};
+    gcsvr.perform(vinfos);
+
+    // Assert.assert, expected);(plist, plist2);
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/d2920331/mnemonic-computing-services/mnemonic-utilities-service/src/test/resources/testng.xml
----------------------------------------------------------------------
diff --git a/mnemonic-computing-services/mnemonic-utilities-service/src/test/resources/testng.xml b/mnemonic-computing-services/mnemonic-utilities-service/src/test/resources/testng.xml
index e711968..9ce4a4b 100644
--- a/mnemonic-computing-services/mnemonic-utilities-service/src/test/resources/testng.xml
+++ b/mnemonic-computing-services/mnemonic-utilities-service/src/test/resources/testng.xml
@@ -23,12 +23,12 @@
 <suite name="Suite" verbose="1" parallel="tests" thread-count="1">
   <test name="Test">
     <classes>
-      <class name="org.apache.mnemonic.service.computingservice.DurableNodeValueNGPrintTest"/> 
+      <class name="org.apache.mnemonic.service.computingservice.DurableSinglyLinkedListNGPrintTest"/> 
     </classes>
   </test> <!-- Test -->
 </suite> <!-- Suite -->
 
 
 <!--
-      <class name="org.apache.mnemonic.service.computingservice.DurableNodeValueNGPrintTest"/> 
+      <class name="org.apache.mnemonic.service.computingservice.DurableSinglyLinkedListNGPrintTest"/> 
  -->


Mime
View raw message