Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java @ 778:9a828e5a2390
Removed trailing whitespace
gnv-artifacts/trunk@851 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 29 Mar 2010 07:58:51 +0000 |
parents | e0d7b8a0bc42 |
children | b1f5f2a8840f |
comparison
equal
deleted
inserted
replaced
777:8009961db1cb | 778:9a828e5a2390 |
---|---|
44 | 44 |
45 static { | 45 static { |
46 BasicConfigurator.configure(); | 46 BasicConfigurator.configure(); |
47 log = Logger.getLogger(GNVArtifactsTestCaseBase.class); | 47 log = Logger.getLogger(GNVArtifactsTestCaseBase.class); |
48 } | 48 } |
49 | 49 |
50 private String configurationDir = "doc/conf"; | 50 private String configurationDir = "doc/conf"; |
51 | 51 |
52 protected FactoryBootstrap bootstrap = null; | 52 protected FactoryBootstrap bootstrap = null; |
53 | 53 |
54 /** | 54 /** |
55 * Constructor | 55 * Constructor |
56 */ | 56 */ |
57 public GNVArtifactsTestCaseBase() { | 57 public GNVArtifactsTestCaseBase() { |
58 } | 58 } |
62 * @param name | 62 * @param name |
63 */ | 63 */ |
64 public GNVArtifactsTestCaseBase(String name) { | 64 public GNVArtifactsTestCaseBase(String name) { |
65 super(name); | 65 super(name); |
66 } | 66 } |
67 | 67 |
68 public abstract void testArtifact(); | 68 public abstract void testArtifact(); |
69 /** | 69 /** |
70 * @see junit.framework.TestCase#setUp() | 70 * @see junit.framework.TestCase#setUp() |
71 */ | 71 */ |
72 protected void setUp() throws Exception { | 72 protected void setUp() throws Exception { |
76 System.setProperty(Config.CONFIG_DIR, configurationDir); | 76 System.setProperty(Config.CONFIG_DIR, configurationDir); |
77 log.info("Bootstrap wird initialisiert."); | 77 log.info("Bootstrap wird initialisiert."); |
78 bootstrap = new FactoryBootstrap(); | 78 bootstrap = new FactoryBootstrap(); |
79 bootstrap.boot(); | 79 bootstrap.boot(); |
80 } | 80 } |
81 | 81 |
82 protected void writeDocument2Log(Document document) { | 82 protected void writeDocument2Log(Document document) { |
83 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); | 83 log.debug(new ArtifactXMLUtilities().writeDocument2String(document)); |
84 } | 84 } |
85 | 85 |
86 protected Document readDocument(String fileName) { | 86 protected Document readDocument(String fileName) { |
107 "/exceptionreport/exception"); | 107 "/exceptionreport/exception"); |
108 if (message != null) { | 108 if (message != null) { |
109 throw new Exception(message); | 109 throw new Exception(message); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 /** | 113 /** |
114 * @return | 114 * @return |
115 */ | 115 */ |
116 protected CallContext createCallContext(ArtifactFactory artifactFactory) { | 116 protected CallContext createCallContext(ArtifactFactory artifactFactory) { |
117 CallMeta callMeta = new DefaultCallMeta( | 117 CallMeta callMeta = new DefaultCallMeta( |
137 outputData = artifact.advance(this.readDocument(advanceDocument), cc); | 137 outputData = artifact.advance(this.readDocument(advanceDocument), cc); |
138 // this.writeDocument2Log(outputData); | 138 // this.writeDocument2Log(outputData); |
139 this.check4ExceptionReport(outputData); | 139 this.check4ExceptionReport(outputData); |
140 | 140 |
141 } | 141 } |
142 | 142 |
143 protected void createFile(byte[] content, String fileName) { | 143 protected void createFile(byte[] content, String fileName) { |
144 try { | 144 try { |
145 FileOutputStream fos = new FileOutputStream(new File(fileName)); | 145 FileOutputStream fos = new FileOutputStream(new File(fileName)); |
146 ByteArrayInputStream bis = new ByteArrayInputStream(content); | 146 ByteArrayInputStream bis = new ByteArrayInputStream(content); |
147 byte[] buf = new byte[4096]; | 147 byte[] buf = new byte[4096]; |
177 * @return | 177 * @return |
178 */ | 178 */ |
179 protected Artifact createArtifact(ArtifactFactory artifactFactory) { | 179 protected Artifact createArtifact(ArtifactFactory artifactFactory) { |
180 Document setupData = null; | 180 Document setupData = null; |
181 Artifact artifact = artifactFactory.createArtifact( | 181 Artifact artifact = artifactFactory.createArtifact( |
182 "" + System.currentTimeMillis(), | 182 "" + System.currentTimeMillis(), |
183 bootstrap.getContext(), | 183 bootstrap.getContext(), |
184 setupData); | 184 setupData); |
185 assertNotNull(artifact); | 185 assertNotNull(artifact); |
186 log.debug("Artifact is available"); | 186 log.debug("Artifact is available"); |
187 return artifact; | 187 return artifact; |