[Lada-commits] [PATCH 5 of 6] Build war file in validator test to turn off the shibboleth filter

Wald Commits scm-commit at wald.intevation.org
Tue Nov 3 09:24:41 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1446538958 -3600
# Node ID 57d9b125a7c54553acf0a1d7b8776a70d1f74d93
# Parent  bc789d180439a848f2cf9bd19fb798f840e701c0
Build war file in validator test to turn off the shibboleth filter.

diff -r bc789d180439 -r 57d9b125a7c5 src/test/java/de/intevation/lada/BaseTest.java
--- a/src/test/java/de/intevation/lada/BaseTest.java	Tue Nov 03 09:21:34 2015 +0100
+++ b/src/test/java/de/intevation/lada/BaseTest.java	Tue Nov 03 09:22:38 2015 +0100
@@ -24,7 +24,7 @@
  */
 public class BaseTest {
 
-    private static String ARCHIVE_NAME = "lada-basis-test.war";
+    protected static String ARCHIVE_NAME = "lada-basis-test.war";
 
     public static String TEST_USER = "testeins";
 
diff -r bc789d180439 -r 57d9b125a7c5 src/test/java/de/intevation/lada/LadaValidatorTest.java
--- a/src/test/java/de/intevation/lada/LadaValidatorTest.java	Tue Nov 03 09:21:34 2015 +0100
+++ b/src/test/java/de/intevation/lada/LadaValidatorTest.java	Tue Nov 03 09:22:38 2015 +0100
@@ -1,11 +1,20 @@
 package de.intevation.lada;
 
+import static de.intevation.lada.BaseTest.ARCHIVE_NAME;
+
 import java.util.ArrayList;
+import java.util.List;
 
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
+import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -16,10 +25,14 @@
 import de.intevation.lada.validation.annotation.ValidationConfig;
 
 @RunWith(Arquillian.class)
-public class LadaValidatorTest extends BaseTest {
+public class LadaValidatorTest {
 
     private static Logger logger = Logger.getLogger(LadaStammTest.class);
 
+    protected static List<Protocol> testProtocol;
+
+    protected static boolean verboseLogging = false;
+
     @Inject
     @ValidationConfig(type="Probe")
     private Validator probeValidator;
@@ -36,11 +49,42 @@
         testProtocol = new ArrayList<Protocol>();
     }
 
+    /**
+     * Create a deployable WAR archive.
+     */
+    @Deployment(testable=true)
+    public static WebArchive createDeployment() throws Exception {
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, ARCHIVE_NAME)
+            .addPackages(true, Package.getPackage("de.intevation.lada"))
+            .deleteClass("de.intevation.lada.util.auth.ShibbolethFilter")
+            .addAsResource("log4j.properties", "log4j.properties")
+            .addAsResource("shibboleth.properties", "shibboleth.properties")
+            .addAsResource("probequery.json", "probequery.json")
+            .addAsResource("messprogrammquery.json", "messprogrammquery.json")
+            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
+            .addAsResource("META-INF/test-persistence.xml",
+                "META-INF/persistence.xml");
+        return archive;
+    }
+
+
     @BeforeClass
     public static void beforeTests() {
         logger.info("---------- Testing Lada Validator ----------");
     }
 
+    @After
+    public final void printLogs() {
+        for (Protocol p : testProtocol) {
+            logger.info(p.toString(verboseLogging));
+        }
+    }
+
+    @AfterClass
+    public static final void afterTests() {
+        System.out.println("");
+    }
+
     @Test
     public final void probeHasHauptprobenNr() {
         probeTest.setValidator(probeValidator);


More information about the Lada-commits mailing list