changeset 758:57d9b125a7c5

Build war file in validator test to turn off the shibboleth filter.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 03 Nov 2015 09:22:38 +0100
parents bc789d180439
children 5986e9ffa03f
files src/test/java/de/intevation/lada/BaseTest.java src/test/java/de/intevation/lada/LadaValidatorTest.java
diffstat 2 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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";
 
--- 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);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)