comparison gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCase.java @ 197:bab92ad1165d

Added the required Classes an Configuration for providing VerticalCrossSections gnv-artifacts/trunk@250 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 20 Oct 2009 13:32:05 +0000
parents 08b8b79b30ff
children 2f6a96610cb9
comparison
equal deleted inserted replaced
196:60c61f323f16 197:bab92ad1165d
835 } catch (Exception e) { 835 } catch (Exception e) {
836 log.error(e, e); 836 log.error(e, e);
837 fail(); 837 fail();
838 } 838 }
839 } 839 }
840
841 public void testVerticalCrossSectionMeshArtifact() {
842 try {
843 log.debug("GNVArtifactsTestCase.testHVerticalCrossSectionMeshArtifact");
844 String artefactName = "fis_modeldata";
845 ArtifactFactory artifactFactory = this
846 .getArtifactFactory(artefactName);
847 assertNotNull(artifactFactory);
848 log.debug("VerticalProfile-ArtifactFactory is available");
849 Artifact artifact = artifactFactory.createArtifact(
850 "" + System.currentTimeMillis(), bootstrap.getContext());
851 assertNotNull(artifact);
852 log.debug("VerticalProfile-Artifact is available");
853
854 CallContext cc = createCallContext();
855
856 // Erster Schritt
857 this
858 .doNextStep(
859 artifact,
860 cc,
861 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_01_feed.xml",
862 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_01_advance.xml");
863
864 // Zweiter Schritt
865 this
866 .doNextStep(
867 artifact,
868 cc,
869 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_02_feed.xml",
870 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_02_advance.xml");
871 // Dritter Schritt
872 this
873 .doNextStep(
874 artifact,
875 cc,
876 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_03_feed.xml",
877 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_03_advance.xml");
878 // Vierter Schritt
879 this
880 .doNextStep(
881 artifact,
882 cc,
883 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_04_feed.xml",
884 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_04_advance.xml");
885 // Fünfter Schritt
886 this
887 .doNextStep(
888 artifact,
889 cc,
890 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_feed.xml",
891 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_advance.xml");
892
893 // Sechster Schritt
894 this
895 .doNextStep(
896 artifact,
897 cc,
898 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_feed.xml",
899 "src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_advance.xml");
900
901
902 Document outputData = artifact.describe(cc);
903 FileOutputStream fos = null;
904 FileOutputStream fos2 = null;
905 FileOutputStream fos3 = null;
906 try {
907 fos = new FileOutputStream(
908 "src/test/results/verticalcrosssection_mesh"
909 + System.currentTimeMillis() + ".png");
910 fos2 = new FileOutputStream(
911 "src/test/results/verticalcrosssection_mesh"
912 + System.currentTimeMillis() + ".xml");
913 fos3 = new FileOutputStream(
914 "src/test/results/verticalcrosssection_mesh"
915 + System.currentTimeMillis() + ".csv");
916 artifact
917 .feed(
918 this
919 .readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml"),
920 cc);
921 artifact
922 .out(
923 this
924 .readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_statistics.xml"),
925 fos2, cc);
926 artifact
927 .out(
928 this
929 .readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_chart.xml"),
930 fos, cc);
931 artifact.out(this.readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_csv.xml"),
932 fos3,
933 cc);
934 } catch (Exception e) {
935 log.error(e, e);
936 fail();
937 } finally {
938 try {
939 fos.flush();
940 fos.close();
941 fos2.flush();
942 fos2.close();
943 fos3.flush();
944 fos3.close();
945 } catch (Exception e) {
946 log.error(e, e);
947 }
948 }
949 } catch (Exception e) {
950 log.error(e, e);
951 fail();
952 }
953 }
840 954
841 protected void createFile(byte[] content, String fileName) { 955 protected void createFile(byte[] content, String fileName) {
842 try { 956 try {
843 FileOutputStream fos = new FileOutputStream(new File(fileName)); 957 FileOutputStream fos = new FileOutputStream(new File(fileName));
844 ByteArrayInputStream bis = new ByteArrayInputStream(content); 958 ByteArrayInputStream bis = new ByteArrayInputStream(content);

http://dive4elements.wald.intevation.org