From e0dbef187a29dc004a43cefd35a462e8a360c7c4 Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Tue, 11 Sep 2012 09:28:07 +0000 Subject: [PATCH] BIS-142 RegressionTestCase renamed to AnnotationAppliedTestCase and moved to server.util SVN: 26582 --- .../server/ServerInterfaceRegressionTest.java | 4 +-- .../util/AnnotationAppliedTestCase.java} | 31 ++++++++++++++++--- .../server/ServerInterfaceRegressionTest.java | 4 +-- .../server/ServerInterfaceRegressionTest.java | 4 +-- .../server/ServerInterfaceRegressionTest.java | 4 +-- .../server/ServerInterfaceRegressionTest.java | 4 +-- .../api/v1/ServerInterfaceRegressionTest.java | 4 +-- .../server/ServerInterfaceRegressionTest.java | 4 +-- 8 files changed, 41 insertions(+), 18 deletions(-) rename openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/{shared/RegressionTestCase.java => server/util/AnnotationAppliedTestCase.java} (73%) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java index d4ad2bfc6a4..11147bf4429 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java @@ -18,15 +18,15 @@ package ch.systemsx.cisd.openbis.generic.server; import org.testng.annotations.Test; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService; import ch.systemsx.cisd.openbis.generic.shared.ITrackingServer; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; /** * @author Franz-Josef Elmer */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java similarity index 73% rename from openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java rename to openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java index 51000f75616..8bcdc3488d3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/RegressionTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package ch.systemsx.cisd.openbis.generic.shared; +package ch.systemsx.cisd.openbis.generic.server.util; import java.lang.annotation.Annotation; import java.lang.reflect.Method; @@ -28,21 +28,39 @@ import org.testng.AssertJUnit; import ch.systemsx.cisd.openbis.generic.shared.authorization.annotation.RolesAllowed; /** + * Test case for test classes testing whether an interface and/or its implementation have all + * mandatory annotations. + * * @author Franz-Josef Elmer */ -public class RegressionTestCase extends AssertJUnit +public class AnnotationAppliedTestCase extends AssertJUnit { - protected void assertMandatoryMethodAnnotations(Class<?> clazz) + /** + * Asserts that the specified class is an interface and all its methods have the annotations + * {@link RolesAllowed} and {@link Transactional}. + */ + protected void assertMandatoryMethodAnnotations(Class<?> interfaceClass) { - assertMandatoryMethodAnnotations(clazz, clazz); + assertMandatoryMethodAnnotations(interfaceClass, interfaceClass); } + /** + * Asserts that the specified interface class is an interface, the implementing class really + * implements that interface, and all interface methods or their implementations have the + * annotations {@link RolesAllowed} and {@link Transactional}. + */ protected void assertMandatoryMethodAnnotations(Class<?> interfaceClass, Class<?> implementingClass) { assertMandatoryMethodAnnotations(interfaceClass, implementingClass, ""); } + /** + * Asserts that the specified interface class is an interface, the implementing class really + * implements that interface, and all interface methods or their implementations have the + * annotations {@link RolesAllowed} and {@link Transactional}. The specified exceptions are + * allowed. + */ protected void assertMandatoryMethodAnnotations(Class<?> interfaceClass, Class<?> implementingClass, String exceptions) { @@ -55,6 +73,11 @@ public class RegressionTestCase extends AssertJUnit exceptions); } + /** + * Asserts that the specified interface class is an interface, the implementing class really + * implements that interface, and all interface methods or their implementations have the + * specified annotations. The specified exceptions are allowed. + */ protected void assertMandatoryMethodAnnotations( List<Class<? extends Annotation>> mandatoryAnnotations, Class<?> interfaceClass, Class<?> implementingClass, String exceptions) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/ServerInterfaceRegressionTest.java index 0d63ba312c3..876c1b40381 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/ServerInterfaceRegressionTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/ServerInterfaceRegressionTest.java @@ -18,13 +18,13 @@ package ch.systemsx.cisd.openbis.plugin.demo.server; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.plugin.demo.shared.IDemoServer; /** * @author Franz-Josef Elmer */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test public void testIGenericServer() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/ServerInterfaceRegressionTest.java index 57bc3d06688..a6351b50ff3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/ServerInterfaceRegressionTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/server/ServerInterfaceRegressionTest.java @@ -18,13 +18,13 @@ package ch.systemsx.cisd.openbis.plugin.generic.server; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; /** * @author Franz-Josef Elmer */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test public void testIGenericServer() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/server/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/server/ServerInterfaceRegressionTest.java index e248cfd7e76..3f8d65007b9 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/server/ServerInterfaceRegressionTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/query/server/ServerInterfaceRegressionTest.java @@ -18,13 +18,13 @@ package ch.systemsx.cisd.openbis.plugin.query.server; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.plugin.query.shared.IQueryServer; /** * @author Piotr Buczek */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test public void testIQueryServer() diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ServerInterfaceRegressionTest.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ServerInterfaceRegressionTest.java index b644caadb0e..7b93e43edcf 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ServerInterfaceRegressionTest.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/ServerInterfaceRegressionTest.java @@ -18,7 +18,7 @@ package ch.systemsx.cisd.openbis.plugin.proteomics.server; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.IPhosphoNetXServer; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.IProteomicsDataServiceInternal; @@ -27,7 +27,7 @@ import ch.systemsx.cisd.openbis.plugin.proteomics.shared.IProteomicsDataServiceI * * @author Franz-Josef Elmer */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test public void testServerAnnotations() diff --git a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ServerInterfaceRegressionTest.java b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ServerInterfaceRegressionTest.java index 97ffb0dda1f..8e784d4babf 100644 --- a/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ServerInterfaceRegressionTest.java +++ b/rtd_phosphonetx/source/java/ch/systemsx/cisd/openbis/plugin/proteomics/server/api/v1/ServerInterfaceRegressionTest.java @@ -18,7 +18,7 @@ package ch.systemsx.cisd.openbis.plugin.proteomics.server.api.v1; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.plugin.proteomics.shared.api.v1.IProteomicsDataService; /** @@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.plugin.proteomics.shared.api.v1.IProteomicsDataS * * @author Franz-Josef Elmer */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test public void testServerAnnotations() diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/ServerInterfaceRegressionTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/ServerInterfaceRegressionTest.java index 3673400dba0..903aa233590 100644 --- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/ServerInterfaceRegressionTest.java +++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/server/ServerInterfaceRegressionTest.java @@ -18,14 +18,14 @@ package ch.systemsx.cisd.openbis.plugin.screening.server; import org.testng.annotations.Test; -import ch.systemsx.cisd.openbis.generic.shared.RegressionTestCase; +import ch.systemsx.cisd.openbis.generic.server.util.AnnotationAppliedTestCase; import ch.systemsx.cisd.openbis.plugin.screening.shared.IScreeningServer; import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.IScreeningApiServer; /** * @author Tomasz Pylak */ -public class ServerInterfaceRegressionTest extends RegressionTestCase +public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { @Test public void testServerAnnotations() -- GitLab