Mercurial > lada > lada-server
annotate src/test/java/de/intevation/lada/ImporterTest.java @ 314:9b4d417f1064
Updated system property keys.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 21 Aug 2013 08:57:57 +0200 |
parents | eeb5d3a5e194 |
children | fab1e6c74044 |
rev | line source |
---|---|
311
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.lada; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
2 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.ArrayList; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
4 import java.util.List; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
5 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
6 import org.junit.Ignore; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
7 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.lada.auth.AuthenticationResponse; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.lada.importer.TestLAFImporter; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 @Ignore |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 public class ImporterTest |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 { |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 @Ignore |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 public static void main(String[] args) { |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 System.setProperty( |
314
9b4d417f1064
Updated system property keys.
Raimund Renkert <rrenkert@intevation.de>
parents:
311
diff
changeset
|
18 "de.intevation.lada.test.singleprobe", |
311
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 "/home/rrenkert/single.laf"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 System.setProperty( |
314
9b4d417f1064
Updated system property keys.
Raimund Renkert <rrenkert@intevation.de>
parents:
311
diff
changeset
|
21 "de.intevation.lada.test.incompleteprobe", |
311
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 "/home/rrenkert/incomplete.laf"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 System.setProperty( |
314
9b4d417f1064
Updated system property keys.
Raimund Renkert <rrenkert@intevation.de>
parents:
311
diff
changeset
|
24 "de.intevation.lada.import", |
311
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 "/opt/lada/config/import.json"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 System.out.println("ImporterTest started."); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 TestLAFImporter test = new TestLAFImporter(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 test.loadLafFiles(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 System.out.print("Testing config file not found: "); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 test.testConfigFileNotFound(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
32 System.out.print("success.\n"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 System.out.print("Testing config file: "); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 test.testConfigFileLoading(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 System.out.print("success.\n"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 System.out.print("Testing Parser:\n 1. Wrong header: "); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 test.testProbeHeaderFail(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
40 System.out.print("success.\n 2. Complete probe: "); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
41 test.testCompleteParser(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 System.out.print("success.\n"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
44 //Prepare simulated authorization. |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
45 List<String> netzbetreiber = new ArrayList<String>(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
46 netzbetreiber.add("0611"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 List<String> mst = new ArrayList<String>(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
48 mst.add("06110"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
49 mst.add("06112"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
50 AuthenticationResponse auth = new AuthenticationResponse(); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
51 auth.setUser("testeins"); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
52 auth.setNetzbetreiber(netzbetreiber); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
53 auth.setMst(mst); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
54 auth.setNetzbetreiber(netzbetreiber); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
55 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
56 |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
57 System.out.println("end."); |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 return; |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
59 } |
eeb5d3a5e194
JUnit test cases and small test application for LAF importer.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 } |