Repository: incubator-systemml Updated Branches: refs/heads/master 95be80c5b -> 97da0004f
[HOTFIX] Changed unit test LRUCacheMapTest to run only with mvn verify Closes #436 Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/97da0004 Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/97da0004 Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/97da0004 Branch: refs/heads/master Commit: 97da0004f1423d40d63372e59c0424d28793ef92 Parents: 95be80c Author: Nakul Jindal <naku...@gmail.com> Authored: Wed Mar 22 12:08:21 2017 -0700 Committer: Nakul Jindal <naku...@gmail.com> Committed: Wed Mar 22 12:08:21 2017 -0700 ---------------------------------------------------------------------- pom.xml | 1 + .../apache/sysml/test/unit/LRUCacheMapTest.java | 120 +++++++++++++++++++ .../sysml/test/utils/LRUCacheMapTest.java | 120 ------------------- 3 files changed, 121 insertions(+), 120 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/97da0004/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 86efe21..656d0a1 100644 --- a/pom.xml +++ b/pom.xml @@ -351,6 +351,7 @@ <excludes> <exclude>**/slowtest/**</exclude> <exclude>**/integration/**</exclude> + <exclude>**/test/unit/**</exclude> </excludes> </configuration> http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/97da0004/src/test/java/org/apache/sysml/test/unit/LRUCacheMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/sysml/test/unit/LRUCacheMapTest.java b/src/test/java/org/apache/sysml/test/unit/LRUCacheMapTest.java new file mode 100644 index 0000000..09df5a0 --- /dev/null +++ b/src/test/java/org/apache/sysml/test/unit/LRUCacheMapTest.java @@ -0,0 +1,120 @@ +/* + * 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.sysml.test.unit; + +import org.apache.sysml.utils.LRUCacheMap; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Map; + +public class LRUCacheMapTest { + + @Test + public void test1() throws Exception { + LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); + m.put("k1", 10l); + m.put("k2", 20l); + m.put("k3", 30l); + m.put("k4", 40l); + + Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k1", e.getKey()); + } + + @Test + public void test2() throws Exception { + LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); + m.put("k1", 10l); + m.put("k2", 20l); + m.put("k3", 30l); + m.put("k4", 40l); + m.get("k1"); + + Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k2", e.getKey()); + } + + @Test(expected = IllegalArgumentException.class) + public void test3() { + LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); + m.put(null, 10l); + } + + @Test + public void test4() throws Exception { + LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); + m.put("k1", 10l); + m.put("k2", 20l); + m.put("k3", 30l); + m.put("k4", 40l); + m.remove("k1"); + m.remove("k2"); + + Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k3", e.getKey()); + } + + @Test + public void test5() throws Exception { + LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); + m.put("k1", 10l); + m.put("k2", 20l); + m.put("k1", 30l); + + Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k2", e.getKey()); + } + + @Test + public void test6() throws Exception { + LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); + m.put("k1", 10l); + m.put("k2", 20l); + m.put("k3", 30l); + m.put("k4", 40l); + m.put("k5", 50l); + m.put("k6", 60l); + m.put("k7", 70l); + m.put("k8", 80l); + m.get("k4"); + + + Map.Entry<String, Long> e; + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k1", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k2", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k3", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k5", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k6", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k7", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k8", e.getKey()); + e = m.removeAndGetLRUEntry(); + Assert.assertEquals("k4", e.getKey()); + + } + + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/97da0004/src/test/java/org/apache/sysml/test/utils/LRUCacheMapTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/sysml/test/utils/LRUCacheMapTest.java b/src/test/java/org/apache/sysml/test/utils/LRUCacheMapTest.java deleted file mode 100644 index 3cf7e76..0000000 --- a/src/test/java/org/apache/sysml/test/utils/LRUCacheMapTest.java +++ /dev/null @@ -1,120 +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.sysml.test.utils; - -import org.apache.sysml.utils.LRUCacheMap; -import org.junit.Assert; -import org.junit.Test; - -import java.util.Map; - -public class LRUCacheMapTest { - - @Test - public void test1() throws Exception { - LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); - m.put("k1", 10l); - m.put("k2", 20l); - m.put("k3", 30l); - m.put("k4", 40l); - - Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k1", e.getKey()); - } - - @Test - public void test2() throws Exception { - LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); - m.put("k1", 10l); - m.put("k2", 20l); - m.put("k3", 30l); - m.put("k4", 40l); - m.get("k1"); - - Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k2", e.getKey()); - } - - @Test(expected = IllegalArgumentException.class) - public void test3() { - LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); - m.put(null, 10l); - } - - @Test - public void test4() throws Exception { - LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); - m.put("k1", 10l); - m.put("k2", 20l); - m.put("k3", 30l); - m.put("k4", 40l); - m.remove("k1"); - m.remove("k2"); - - Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k3", e.getKey()); - } - - @Test - public void test5() throws Exception { - LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); - m.put("k1", 10l); - m.put("k2", 20l); - m.put("k1", 30l); - - Map.Entry<String, Long> e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k2", e.getKey()); - } - - @Test - public void test6() throws Exception { - LRUCacheMap<String, Long> m = new LRUCacheMap<String, Long>(); - m.put("k1", 10l); - m.put("k2", 20l); - m.put("k3", 30l); - m.put("k4", 40l); - m.put("k5", 50l); - m.put("k6", 60l); - m.put("k7", 70l); - m.put("k8", 80l); - m.get("k4"); - - - Map.Entry<String, Long> e; - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k1", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k2", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k3", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k5", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k6", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k7", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k8", e.getKey()); - e = m.removeAndGetLRUEntry(); - Assert.assertEquals("k4", e.getKey()); - - } - - -} \ No newline at end of file