Mercurial > dive4elements > gnv-client
comparison gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java @ 36:ad381cc47217
Format Code to max 80 Chars per Row
gnv/trunk@172 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 02 Oct 2009 08:54:13 +0000 |
parents | 4405f31bbc30 |
children | 23a4f196d7d6 |
comparison
equal
deleted
inserted
replaced
35:4405f31bbc30 | 36:ad381cc47217 |
---|---|
19 import de.intevation.gnv.artifactdatabase.objects.InputParameter; | 19 import de.intevation.gnv.artifactdatabase.objects.InputParameter; |
20 import de.intevation.gnv.util.XSLTransformer; | 20 import de.intevation.gnv.util.XSLTransformer; |
21 | 21 |
22 /** | 22 /** |
23 * @author Tim Englich <tim.englich@intevation.de> | 23 * @author Tim Englich <tim.englich@intevation.de> |
24 * | 24 * |
25 */ | 25 */ |
26 public class ArtifactDatabaseClientTestCase extends TestCase { | 26 public class ArtifactDatabaseClientTestCase extends TestCase { |
27 | 27 |
28 /** | 28 /** |
29 * the logger, used to log exceptions and additonaly information | 29 * the logger, used to log exceptions and additonaly information |
30 */ | 30 */ |
31 private static Logger log = null; | 31 private static Logger log = null; |
32 | 32 |
33 static{ | 33 static { |
34 BasicConfigurator.configure(); | 34 BasicConfigurator.configure(); |
35 log = Logger.getLogger(DefaultArtifactDatabaseClient.class); | 35 log = Logger.getLogger(DefaultArtifactDatabaseClient.class); |
36 } | 36 } |
37 | |
37 /** | 38 /** |
38 * Constructor | 39 * Constructor |
40 * | |
39 * @param namemessage | 41 * @param namemessage |
40 */ | 42 */ |
41 public ArtifactDatabaseClientTestCase(String name) { | 43 public ArtifactDatabaseClientTestCase(String name) { |
42 super(name); | 44 super(name); |
43 } | 45 } |
47 */ | 49 */ |
48 @Override | 50 @Override |
49 protected void setUp() throws Exception { | 51 protected void setUp() throws Exception { |
50 super.setUp(); | 52 super.setUp(); |
51 } | 53 } |
52 | 54 |
53 public void testArtifactDatabaseClient(){ | 55 public void testArtifactDatabaseClient() { |
54 | 56 |
55 try { | 57 try { |
56 ArtifactDatabaseClient artifactDatabaseClient = ArtifactDatabaseClientFactory.getInstance().getArtifactDatabaseClient(); | 58 ArtifactDatabaseClient artifactDatabaseClient = ArtifactDatabaseClientFactory |
57 Collection<ArtifactObject> factories = artifactDatabaseClient.getArtifactFactories(); | 59 .getInstance().getArtifactDatabaseClient(); |
58 if (factories != null && !factories.isEmpty()){ | 60 Collection<ArtifactObject> factories = artifactDatabaseClient |
61 .getArtifactFactories(); | |
62 if (factories != null && !factories.isEmpty()) { | |
59 Iterator<ArtifactObject> it = factories.iterator(); | 63 Iterator<ArtifactObject> it = factories.iterator(); |
60 while(it.hasNext()){ | 64 while (it.hasNext()) { |
61 ArtifactObject aof = it.next(); | 65 ArtifactObject aof = it.next(); |
62 ArtifactObject artifact = artifactDatabaseClient.createNewArtifact(aof); | 66 ArtifactObject artifact = artifactDatabaseClient |
63 ArtifactDescription ad = artifactDatabaseClient.getCurrentStepDescription(aof, artifact); | 67 .createNewArtifact(aof); |
68 ArtifactDescription ad = artifactDatabaseClient | |
69 .getCurrentStepDescription(aof, artifact); | |
64 log.debug("Artifact aktualisert."); | 70 log.debug("Artifact aktualisert."); |
65 XSLTransformer transformer = new XSLTransformer(); | 71 XSLTransformer transformer = new XSLTransformer(); |
66 String transformedUI = transformer.transform(ad.getCurrentUI(), "UTF-8",("src/main/webapp/WEB-INF/config/templates/describe-ui.xsl")); | 72 String transformedUI = transformer |
73 .transform( | |
74 ad.getCurrentUI(), | |
75 "UTF-8", | |
76 ("src/main/webapp/WEB-INF/config/templates/describe-ui.xsl")); | |
67 log.debug(transformedUI); | 77 log.debug(transformedUI); |
68 | 78 |
69 Collection<InputParameter> inputParameter = new ArrayList<InputParameter>(1); | 79 Collection<InputParameter> inputParameter = new ArrayList<InputParameter>( |
70 inputParameter.add(new DefaultInputParameter("product", new String[]{"timeSeries"})); | 80 1); |
71 ad = artifactDatabaseClient.doNextStep(aof, artifact, "timeSeries",inputParameter); | 81 inputParameter.add(new DefaultInputParameter("product", |
72 | 82 new String[] { "timeSeries" })); |
73 transformedUI = transformer.transform(ad.getCurrentUI(), "UTF-8",("src/main/webapp/WEB-INF/config/templates/describe-ui.xsl")); | 83 ad = artifactDatabaseClient.doNextStep(aof, artifact, |
84 "timeSeries", inputParameter); | |
85 | |
86 transformedUI = transformer | |
87 .transform( | |
88 ad.getCurrentUI(), | |
89 "UTF-8", | |
90 ("src/main/webapp/WEB-INF/config/templates/describe-ui.xsl")); | |
74 log.debug(transformedUI); | 91 log.debug(transformedUI); |
75 } | 92 } |
76 } | 93 } |
77 | 94 |
78 | |
79 } catch (ArtifactDatabaseClientException e) { | 95 } catch (ArtifactDatabaseClientException e) { |
80 log.error(e,e); | 96 log.error(e, e); |
81 fail(); | 97 fail(); |
82 } | 98 } |
83 } | 99 } |
84 | 100 |
85 } | 101 } |