[nobug] Move AdvancedProcessorTestCase to pure JUnit tests Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/SRGTestModel.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/SRGTestModel.java index ef63429..78a622b 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/SRGTestModel.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/SRGTestModel.java
@@ -27,7 +27,6 @@ public SRGTestModel() { addTest(new org.eclipse.persistence.testing.tests.aggregate.AggregateTestModel(isSRG)); addTest(new InheritanceTestModel(isSRG)); addTest(new org.eclipse.persistence.testing.tests.sessionsxml.SessionsXMLTestModel(isSRG)); - addTest(new org.eclipse.persistence.testing.tests.cache.AdvancedProcessingTestModel(isSRG)); } /**
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessingTestModel.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessingTestModel.java deleted file mode 100644 index c695046..0000000 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessingTestModel.java +++ /dev/null
@@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 - * which accompanies this distribution. - * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - * and the Eclipse Distribution License is available at - * http://www.eclipse.org/org/documents/edl-v10.php. - * - * Contributors: - * Marcel Valovy - ******************************************************************************/ -package org.eclipse.persistence.testing.tests.cache; - -import org.eclipse.persistence.testing.framework.TestModel; - -/** - * This model tests advanced processing related classes. - */ -public class AdvancedProcessingTestModel extends TestModel { - - public AdvancedProcessingTestModel() { - setDescription("This model tests advanced processing related classes."); - } - - public AdvancedProcessingTestModel(boolean isSRG) { - this(); - this.isSRG = isSRG; - } - - public void addTests() { - addTest(new AdvancedProcessingTestSuite(isSRG)); - } - -}
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessingTestSuite.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessingTestSuite.java deleted file mode 100644 index f03a91b..0000000 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessingTestSuite.java +++ /dev/null
@@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 - * which accompanies this distribution. - * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html - * and the Eclipse Distribution License is available at - * http://www.eclipse.org/org/documents/edl-v10.php. - * - * Contributors: - * Marcel Valovy - ******************************************************************************/ -package org.eclipse.persistence.testing.tests.cache; - -import org.eclipse.persistence.testing.framework.TestSuite; - -/** - * Test suite for advanced processing related classes. - */ -public class AdvancedProcessingTestSuite extends TestSuite { - - public AdvancedProcessingTestSuite() { - setDescription("This suite tests advanced processing"); - } - - public AdvancedProcessingTestSuite(boolean isSRG) { - super(isSRG); - setDescription("This suite tests advanced processing."); - } - - public void addTests() { - addTest(new AdvancedProcessorTestCase()); - } -} \ No newline at end of file
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessorTestCase.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/cache/AdvancedProcessorTest.java similarity index 81% rename from foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessorTestCase.java rename to foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/cache/AdvancedProcessorTest.java index 3484811..2a7d295 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/cache/AdvancedProcessorTestCase.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/cache/AdvancedProcessorTest.java
@@ -1,6 +1,5 @@ -/** - * **************************************************************************** - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. +/****************************************************************************** + * Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. @@ -12,32 +11,36 @@ * Marcel Valovy - initial API and implementation * **************************************************************************** */ -package org.eclipse.persistence.testing.tests.cache; - -import org.eclipse.persistence.internal.cache.AdvancedProcessor; -import org.eclipse.persistence.internal.cache.ComputableTask; -import org.eclipse.persistence.internal.cache.Memoizer; -import org.eclipse.persistence.testing.framework.TestCase; +package org.eclipse.persistence.testing.tests.junit.cache; import java.lang.reflect.Field; import java.util.Iterator; import java.util.Map; +import org.eclipse.persistence.internal.cache.AdvancedProcessor; +import org.eclipse.persistence.internal.cache.ComputableTask; +import org.eclipse.persistence.internal.cache.Memoizer; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + /** * @author Marcel Valovy - marcelv3612@gmail.com */ -public class AdvancedProcessorTestCase extends TestCase { - - public void test() throws Exception { - testCompute(); - testExpire(); - } +public class AdvancedProcessorTest { private AdvancedProcessor processor; private MutableComputableTask<Integer, Integer> computableTask; + @Before + public void setUp() { + processor = new AdvancedProcessor(); + computableTask = new Task<>(); + } + + @Test public void testCompute() throws Exception { - assertEquals(processor.compute(computableTask.setArg(5), 5), (Integer) 10); + Assert.assertEquals(processor.compute(computableTask.setArg(5), 5), (Integer) 10); Field fieldOnProcessor = AdvancedProcessor.class.getDeclaredField("memoizer"); fieldOnProcessor.setAccessible(true); @@ -52,15 +55,15 @@ public void testCompute() throws Exception { Object futureAfterSecondComputation = memoizerCache.values().iterator().next(); - assertTrue(memoizerCache.values().size() == 1); - assertTrue(futureAfterFirstComputation == futureAfterSecondComputation); + Assert.assertTrue(memoizerCache.values().size() == 1); + Assert.assertTrue(futureAfterFirstComputation == futureAfterSecondComputation); fieldOnProcessor.setAccessible(false); fieldOnMemoizer.setAccessible(false); } public void testExpire() throws Exception { - assertEquals(processor.compute(computableTask.setArg(5), 5), (Integer) 10); + Assert.assertEquals(processor.compute(computableTask.setArg(5), 5), (Integer) 10); Field fieldOnProcessor = AdvancedProcessor.class.getDeclaredField("memoizer"); fieldOnProcessor.setAccessible(true); @@ -79,16 +82,11 @@ public void testExpire() throws Exception { // we still have just one element in cache, because we called processor.clear() Object futureAfterSecondComputation = iteratorAfterSecondComputation.next(); - assertFalse(futureAfterFirstComputation == futureAfterSecondComputation); + Assert.assertFalse(futureAfterFirstComputation == futureAfterSecondComputation); fieldOnProcessor.setAccessible(false); fieldOnMemoizer.setAccessible(false); - assertEquals(processor.compute(computableTask.setArg(7), 5), (Integer) 12); - } - - public void setUp() { - processor = new AdvancedProcessor(); - computableTask = new Task<>(); + Assert.assertEquals(processor.compute(computableTask.setArg(7), 5), (Integer) 12); } static class Task<A, V> implements MutableComputableTask<A, V> {
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectListTest.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectListTest.java index 1a10b60..f50690c 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectListTest.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectListTest.java
@@ -37,7 +37,6 @@ import org.eclipse.persistence.internal.indirection.QueryBasedValueHolder; import org.eclipse.persistence.queries.ReadAllQuery; import org.eclipse.persistence.sessions.DatabaseRecord; -import org.eclipse.persistence.testing.tests.transparentindirection.TestSession; import org.junit.After; import org.junit.Before; import org.junit.Test;
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectMapTest.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectMapTest.java index b7e0e39..8d75acc 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectMapTest.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectMapTest.java
@@ -42,7 +42,6 @@ import org.eclipse.persistence.internal.indirection.QueryBasedValueHolder; import org.eclipse.persistence.queries.ReadAllQuery; import org.eclipse.persistence.sessions.DatabaseRecord; -import org.eclipse.persistence.testing.tests.transparentindirection.TestSession; import org.eclipse.persistence.testing.tests.transparentindirection.ZTestCase; import org.junit.After; import org.junit.Before;
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectSetTest.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectSetTest.java index f442d79..a30585e 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectSetTest.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/IndirectSetTest.java
@@ -33,7 +33,6 @@ import org.eclipse.persistence.internal.indirection.QueryBasedValueHolder; import org.eclipse.persistence.queries.ReadAllQuery; import org.eclipse.persistence.sessions.DatabaseRecord; -import org.eclipse.persistence.testing.tests.transparentindirection.TestSession; import org.eclipse.persistence.testing.tests.transparentindirection.ZTestCase; import org.junit.After; import org.junit.Before;
diff --git a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/transparentindirection/TestSession.java b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/TestSession.java similarity index 89% rename from foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/transparentindirection/TestSession.java rename to foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/TestSession.java index 58c0b85..b10da7c 100644 --- a/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/transparentindirection/TestSession.java +++ b/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/junit/transparentindirection/TestSession.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. @@ -10,7 +10,7 @@ * Contributors: * Oracle - initial API and implementation from Oracle TopLink ******************************************************************************/ -package org.eclipse.persistence.testing.tests.transparentindirection; +package org.eclipse.persistence.testing.tests.junit.transparentindirection; import org.eclipse.persistence.internal.sessions.AbstractRecord;