annotate gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java @ 345:c16c622ba2f3

Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven. gnv-artifacts/trunk@412 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 11 Dec 2009 10:02:10 +0000
parents
children 147d1e46b239
rev   line source
345
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.artifacts;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
6 import java.io.ByteArrayInputStream;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
7 import java.io.File;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
8 import java.io.FileNotFoundException;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 import java.io.FileOutputStream;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10 import java.io.IOException;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import javax.xml.parsers.DocumentBuilder;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import javax.xml.parsers.DocumentBuilderFactory;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import javax.xml.parsers.ParserConfigurationException;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import junit.framework.TestCase;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
18 import org.apache.log4j.BasicConfigurator;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.Logger;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Document;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 import org.xml.sax.SAXException;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import de.intevation.artifactdatabase.Config;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 import de.intevation.artifactdatabase.DefaultCallMeta;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import de.intevation.artifactdatabase.DefaultPreferredLocale;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import de.intevation.artifactdatabase.FactoryBootstrap;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 import de.intevation.artifacts.Artifact;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 import de.intevation.artifacts.ArtifactFactory;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29 import de.intevation.artifacts.CallContext;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 import de.intevation.artifacts.CallMeta;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 import de.intevation.artifacts.PreferredLocale;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 import de.intevation.gnv.utils.ArtifactXMLUtilities;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
34 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
35 * @author Tim Englich <tim.englich@intevation.de>
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 *
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 public abstract class GNVArtifactsTestCaseBase extends TestCase {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
39
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 * the logger, used to log exceptions and additonaly information
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43 private static Logger log = null;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 static {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 BasicConfigurator.configure();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47 log = Logger.getLogger(GNVArtifactsTestCaseBase.class);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
48 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
49
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 private String configurationDir = "doc/conf";
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
51
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
52 protected FactoryBootstrap bootstrap = null;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
53
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
54 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 * Constructor
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
56 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
57 public GNVArtifactsTestCaseBase() {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
60 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 * Constructor
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 * @param name
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
64 public GNVArtifactsTestCaseBase(String name) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 super(name);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
67
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 public abstract void testArtifact();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 * @see junit.framework.TestCase#setUp()
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 protected void setUp() throws Exception {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 log.debug("GNVArtifactsTestCase.setUp");
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 super.setUp();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 log.info(Config.CONFIG_DIR + " ==> " + configurationDir);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
76 System.setProperty(Config.CONFIG_DIR, configurationDir);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
77 log.info("Bootstrap wird initialisiert.");
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
78 bootstrap = new FactoryBootstrap();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 bootstrap.boot();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 protected void writeDocument2Log(Document document) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83 log.debug(new ArtifactXMLUtilities().writeDocument2String(document));
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86 protected Document readDocument(String fileName) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
87 Document returnValue = null;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 try {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90 .newInstance();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 returnValue = docBuilder.parse(new File(fileName));
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 } catch (ParserConfigurationException e) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 log.error(e, e);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 } catch (SAXException e) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96 log.error(e, e);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 } catch (IOException e) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 log.error(e, e);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 return returnValue;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 protected void check4ExceptionReport(Document document) throws Exception {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 document = new ArtifactXMLUtilities().reInitDocument(document);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 String message = Config.getStringXPath(document,
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 "/exceptionreport/exception");
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 if (message != null) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 throw new Exception(message);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113 * @return
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
114 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115 protected CallContext createCallContext() {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 CallMeta callMeta = new DefaultCallMeta(
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 new PreferredLocale[] { new DefaultPreferredLocale("de_DE",
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 1.0f) });
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120 return cc;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 * @param artifact
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 * @param cc
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 * @param describeDocument TODO
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 * @throws Exception
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
128 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
129 protected void doNextStep(Artifact artifact, CallContext cc,
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
130 String feedDocument, String advanceDocument, Document describeDocument)
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
131 throws Exception {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 Document outputData = artifact.describe(describeDocument,cc);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 // this.writeDocument2Log(outputData);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 outputData = artifact.feed(this.readDocument(feedDocument), cc);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135 this.check4ExceptionReport(outputData);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 outputData = artifact.advance(this.readDocument(advanceDocument), cc);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 // this.writeDocument2Log(outputData);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
138 this.check4ExceptionReport(outputData);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
139
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
140 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
141
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
142 protected void createFile(byte[] content, String fileName) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
143 try {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
144 FileOutputStream fos = new FileOutputStream(new File(fileName));
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
145 ByteArrayInputStream bis = new ByteArrayInputStream(content);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 byte[] buf = new byte[4096];
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 while (bis.read(buf) > 0) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 fos.write(buf);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 fos.flush();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 fos.close();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 } catch (FileNotFoundException e) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 log.error(e, e);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 } catch (IOException e) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 log.error(e, e);
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 /**
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 * @param artefactName
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 */
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 protected ArtifactFactory getArtifactFactory(String artefactName) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 log.debug("GNVArtifactsTestCase.getArtifactFactory");
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 ArtifactFactory[] artifactFactories = bootstrap.getArtifactFactories();
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 for (int i = 0; i < artifactFactories.length; i++) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 if (artifactFactories[i].getName().equals(artefactName)) {
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 log.debug("ArtifactFactory wurde gefunden.");
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 return artifactFactories[i];
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171 return null;
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 }
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175
c16c622ba2f3 Split all Unittestcases in separat Classes. Now it is easier to uses the UnitTests with Maven.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 }

http://dive4elements.wald.intevation.org