You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mnemonic.apache.org by ga...@apache.org on 2016/04/14 03:51:01 UTC
[5/5] incubator-mnemonic git commit: fix the name of
VolatileAllocatorNGTest, changed to VolatileMemAllocatorNGTest
fix the name of VolatileAllocatorNGTest, changed to VolatileMemAllocatorNGTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/commit/1e75e2a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/tree/1e75e2a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/diff/1e75e2a5
Branch: refs/heads/master
Commit: 1e75e2a52cfde1ccfa6e0b062da20373be204ad2
Parents: 679bcdc
Author: Wang, Gang(Gary) <ga...@intel.com>
Authored: Wed Apr 13 18:36:34 2016 -0700
Committer: Wang, Gang(Gary) <ga...@intel.com>
Committed: Wed Apr 13 18:43:32 2016 -0700
----------------------------------------------------------------------
README.md | 4 +-
.../mnemonic/VolatileAllocatorNGTest.java | 68 --------------------
.../mnemonic/VolatileMemAllocatorNGTest.java | 68 ++++++++++++++++++++
core/src/test/resources/testng.xml | 2 +-
4 files changed, 72 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/1e75e2a5/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 3feacf0..578b5f5 100644
--- a/README.md
+++ b/README.md
@@ -222,7 +222,9 @@ To run several test cases:
$ mvn -Dtest=DurablePersonNGTest test -pl core -DskipTests=false # a testcase for module "core" that requires 'pmalloc' allocator service to pass
- $ mvn -Dtest=NonVolatileMemAllocatorNGTest test -pl core -DskipTests=false # the second testcase for module "core" that requires 'vmem' allocator service to pass
+ $ mvn -Dtest=NonVolatileMemAllocatorNGTest test -pl core -DskipTests=false # the second testcase for module "core" that requires 'pmalloc' allocator service to pass
+
+ $ mvn -Dtest=VolatileMemAllocatorNGTest test -pl core -DskipTests=false # the second testcase for module "core" that requires 'vmem' allocator service to pass
$ mvn -Dtest=MemClusteringNGTest test -pl core -DskipTests=false # the third testcase for module "core" that requires 'vmem allocator service to pass
http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/1e75e2a5/core/src/test/java/org/apache/mnemonic/VolatileAllocatorNGTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/mnemonic/VolatileAllocatorNGTest.java b/core/src/test/java/org/apache/mnemonic/VolatileAllocatorNGTest.java
deleted file mode 100644
index a0d7a5b..0000000
--- a/core/src/test/java/org/apache/mnemonic/VolatileAllocatorNGTest.java
+++ /dev/null
@@ -1,68 +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;
-
-import org.testng.annotations.Test;
-
-import java.util.Random;
-
-/**
- * test the functionality of VolatileMemAllocator class.
- *
- */
-public class VolatileAllocatorNGTest {
- /**
- * test to allocate MemBufferHolder objects and then verify them.
- */
- @Test
- public void testMemByteBuffer() {
- Random randomGenerator = new Random();
- Allocator<VolatileMemAllocator> act = new VolatileMemAllocator(Utils.getVolatileMemoryAllocatorService("vmem"),
- 1024 * 1024 * 1024, ".", true);
- MemBufferHolder<?> mbh;
- for (int idx = 1; idx <= 5; ++idx) {
- int size = randomGenerator.nextInt(1024 * 1024) + 1024 * 1024;
- mbh = act.createBuffer(size);
- for (int i = 0; i < size; i++) {
- mbh.get().put((byte) randomGenerator.nextInt(255));
- }
- // if (bb.hasArray()) randomGenerator.nextBytes(bb.array());
- System.out.println(String.format("[Seq.%d] size %d - %d, (%s)", idx, size, mbh.get().capacity(),
- size == mbh.get().capacity() ? "Correct" : "Failed!!!"));
- // mbh.destroy();
- }
- }
-
- /**
- * test to allocate MemChunkHolder objects and then verify them.
- */
- @Test
- public void testMemChunk() {
- Random randomGenerator = new Random();
- Allocator<VolatileMemAllocator> act = new VolatileMemAllocator(Utils.getVolatileMemoryAllocatorService("vmem"),
- 1024 * 1024 * 1024, ".", true);
- MemChunkHolder<?> mch;
- for (int idx = 1; idx <= 5; ++idx) {
- int size = randomGenerator.nextInt(1024 * 1024) + 1024 * 1024;
- mch = act.createChunk(size);
- System.out.println(String.format("[Seq.%d] addr : %X", idx, size, mch.get()));
- mch.destroy();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/1e75e2a5/core/src/test/java/org/apache/mnemonic/VolatileMemAllocatorNGTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/mnemonic/VolatileMemAllocatorNGTest.java b/core/src/test/java/org/apache/mnemonic/VolatileMemAllocatorNGTest.java
new file mode 100644
index 0000000..6c96be7
--- /dev/null
+++ b/core/src/test/java/org/apache/mnemonic/VolatileMemAllocatorNGTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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;
+
+import org.testng.annotations.Test;
+
+import java.util.Random;
+
+/**
+ * test the functionality of VolatileMemAllocator class.
+ *
+ */
+public class VolatileMemAllocatorNGTest {
+ /**
+ * test to allocate MemBufferHolder objects and then verify them.
+ */
+ @Test
+ public void testMemByteBuffer() {
+ Random randomGenerator = new Random();
+ Allocator<VolatileMemAllocator> act = new VolatileMemAllocator(Utils.getVolatileMemoryAllocatorService("vmem"),
+ 1024 * 1024 * 1024, ".", true);
+ MemBufferHolder<?> mbh;
+ for (int idx = 1; idx <= 5; ++idx) {
+ int size = randomGenerator.nextInt(1024 * 1024) + 1024 * 1024;
+ mbh = act.createBuffer(size);
+ for (int i = 0; i < size; i++) {
+ mbh.get().put((byte) randomGenerator.nextInt(255));
+ }
+ // if (bb.hasArray()) randomGenerator.nextBytes(bb.array());
+ System.out.println(String.format("[Seq.%d] size %d - %d, (%s)", idx, size, mbh.get().capacity(),
+ size == mbh.get().capacity() ? "Correct" : "Failed!!!"));
+ // mbh.destroy();
+ }
+ }
+
+ /**
+ * test to allocate MemChunkHolder objects and then verify them.
+ */
+ @Test
+ public void testMemChunk() {
+ Random randomGenerator = new Random();
+ Allocator<VolatileMemAllocator> act = new VolatileMemAllocator(Utils.getVolatileMemoryAllocatorService("vmem"),
+ 1024 * 1024 * 1024, ".", true);
+ MemChunkHolder<?> mch;
+ for (int idx = 1; idx <= 5; ++idx) {
+ int size = randomGenerator.nextInt(1024 * 1024) + 1024 * 1024;
+ mch = act.createChunk(size);
+ System.out.println(String.format("[Seq.%d] addr : %X", idx, size, mch.get()));
+ mch.destroy();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mnemonic/blob/1e75e2a5/core/src/test/resources/testng.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/testng.xml b/core/src/test/resources/testng.xml
index 495811b..595f68d 100644
--- a/core/src/test/resources/testng.xml
+++ b/core/src/test/resources/testng.xml
@@ -13,7 +13,7 @@
<class name="org.apache.mnemonic.NonVolatileMemAllocatorNGTest" />
<class name="org.apache.mnemonic.ByteBufferSerializerNGTest" />
<class name="org.apache.mnemonic.MemClusteringNGTest" />
- <class name="org.apache.mnemonic.NonVolatileMemAllocatorNGTest" />
+ <class name="org.apache.mnemonic.VolatileMemAllocatorNGTest" />
<class name="org.apache.mnemonic.DurablePersonNGTest" />
<class name="org.apache.mnemonic.DurableListNGTest" />