annotate gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java @ 1022:28a0628b11b0

Added license file and license header. gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:15:08 +0000
parents 57fa8019fbdc
children
rev   line source
1022
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
1 /*
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
3 *
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
5 * Read the file LGPL.txt coming with the software for details
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
7 */
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
8
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
9 package de.intevation.gnv.util;
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
10
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
11 import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient;
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
12
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
13 import java.io.File;
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
14 import java.io.FileInputStream;
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import java.io.FileNotFoundException;
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16
35
4405f31bbc30 CodeCleanUP
Tim Englich <tim.englich@intevation.de>
parents: 11
diff changeset
17 import junit.framework.TestCase;
4405f31bbc30 CodeCleanUP
Tim Englich <tim.englich@intevation.de>
parents: 11
diff changeset
18
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import org.apache.log4j.BasicConfigurator;
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
683
d49e8695786c Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 681
diff changeset
21
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Document;
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 /**
684
57fa8019fbdc Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 683
diff changeset
25 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 36
diff changeset
26 *
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27 */
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
28 public class XSLTransformerTestCase extends TestCase {
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
29
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
30 /**
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
31 * the logger, used to log exceptions and additonaly information
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
32 */
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
33 private static Logger log = null;
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
34
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
35 static {
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
36 BasicConfigurator.configure();
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
37 log = Logger.getLogger(DefaultArtifactDatabaseClient.class);
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
38 }
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
39
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
40 public XSLTransformerTestCase() {
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
41 super();
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
42 }
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
43
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
44 public XSLTransformerTestCase(String name) {
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
45 super(name);
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
46 }
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
47
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
48 public void testDescribeUI() {
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
49
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
50 try {
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
51 // System.setProperty("javax.xml.transform.TransformerFactory","com.icl.saxon.TransformerFactoryImpl");
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
52 Document document = new XMLUtils()
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
53 .readDocument(new FileInputStream(new File(
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
54 "src/test/ressources/describe-ui-test.xml")));
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
55 XSLTransformer transformer = new XSLTransformer();
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
56 String value = transformer.transform(document, "UTF-8",
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
57 "src/main/webapp/WEB-INF/config/templates/describe-ui.xsl");
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
58 log.debug(value);
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
59 } catch (FileNotFoundException e) {
36
ad381cc47217 Format Code to max 80 Chars per Row
Tim Englich <tim.englich@intevation.de>
parents: 35
diff changeset
60 log.error(e, e);
11
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
61 }
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
62 }
3cb753564552 Integration of the required XSL-Transformation of the Describe-Response of the Artifactdatabase
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 }

http://dive4elements.wald.intevation.org