Commit 7573c47d0d848161506434e1f5e18092264f0470
1 parent
84b3dbfc
Exists in
master
Copy VOTableDataTest to EpnTapClient test package.
Showing
3 changed files
with
103 additions
and
6 deletions
Show diff stats
src/test/java/eu/omp/irap/vespa/epntapclient/granule/GranuleCtrlTest.java
@@ -25,14 +25,14 @@ import java.util.List; | @@ -25,14 +25,14 @@ import java.util.List; | ||
25 | import org.junit.Test; | 25 | import org.junit.Test; |
26 | 26 | ||
27 | import eu.omp.irap.vespa.votable.votable.VOTableException.CanNotParseDataException; | 27 | import eu.omp.irap.vespa.votable.votable.VOTableException.CanNotParseDataException; |
28 | -import eu.omp.irap.vespa.votable.votabledata.VoTableDataTest; | 28 | +import eu.omp.irap.vespa.votable.votabledata.VOTableDataTest; |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * @author N. Jourdane | 31 | * @author N. Jourdane |
32 | */ | 32 | */ |
33 | public class GranuleCtrlTest { | 33 | public class GranuleCtrlTest { |
34 | 34 | ||
35 | - /** The granule controller, initialized with {@link VoTableDataTest#createVoTableData()}. */ | 35 | + /** The granule controller, initialized with {@link VOTableDataTest#createVoTableData()}. */ |
36 | GranuleCtrl granuleCtrl; | 36 | GranuleCtrl granuleCtrl; |
37 | 37 | ||
38 | 38 | ||
@@ -40,7 +40,7 @@ public class GranuleCtrlTest { | @@ -40,7 +40,7 @@ public class GranuleCtrlTest { | ||
40 | * Constructor of GranuleCtrlTest. | 40 | * Constructor of GranuleCtrlTest. |
41 | */ | 41 | */ |
42 | public GranuleCtrlTest() { | 42 | public GranuleCtrlTest() { |
43 | - granuleCtrl = new GranuleCtrl(VoTableDataTest.createVoTableData()); | 43 | + granuleCtrl = new GranuleCtrl(VOTableDataTest.createVoTableData()); |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
src/test/java/eu/omp/irap/vespa/epntapclient/granule/GranuleTest.java
@@ -27,7 +27,7 @@ import java.util.logging.Logger; | @@ -27,7 +27,7 @@ import java.util.logging.Logger; | ||
27 | 27 | ||
28 | import org.junit.Test; | 28 | import org.junit.Test; |
29 | 29 | ||
30 | -import eu.omp.irap.vespa.votable.votabledata.VoTableDataTest; | 30 | +import eu.omp.irap.vespa.votable.votabledata.VOTableDataTest; |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * @author N. Jourdane | 33 | * @author N. Jourdane |
@@ -40,7 +40,7 @@ public class GranuleTest { | @@ -40,7 +40,7 @@ public class GranuleTest { | ||
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Create a granule for tests purposes. It is planetary data for Uranus, got from an actual ADQL | 42 | * Create a granule for tests purposes. It is planetary data for Uranus, got from an actual ADQL |
43 | - * query, exactly the same content that {@link VoTableDataTest#createDataArray1()} | 43 | + * query, exactly the same content that {@link VOTableDataTest#createDataArray1()} |
44 | * | 44 | * |
45 | * @return The granule. | 45 | * @return The granule. |
46 | */ | 46 | */ |
@@ -101,7 +101,7 @@ public class GranuleTest { | @@ -101,7 +101,7 @@ public class GranuleTest { | ||
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Create a granule for tests purposes. It is planetary data for Neptune, got from an actual | 103 | * Create a granule for tests purposes. It is planetary data for Neptune, got from an actual |
104 | - * query, exactly the same content that {@link VoTableDataTest#createDataArray2()} | 104 | + * query, exactly the same content that {@link VOTableDataTest#createDataArray2()} |
105 | * | 105 | * |
106 | * @return The granule. | 106 | * @return The granule. |
107 | */ | 107 | */ |
src/test/java/eu/omp/irap/vespa/epntapclient/granule/VOTableDataTest.java
0 → 100644
@@ -0,0 +1,97 @@ | @@ -0,0 +1,97 @@ | ||
1 | +/* | ||
2 | + * This file is a part of EpnTAPClient. | ||
3 | + * This program aims to provide EPN-TAP support for software clients, like CASSIS spectrum analyzer. | ||
4 | + * See draft specifications: https://voparis-confluence.obspm.fr/pages/viewpage.action?pageId=559861 | ||
5 | + * Copyright (C) 2016 Institut de Recherche en Astrophysique et Planétologie. | ||
6 | + * | ||
7 | + * This program is free software: you can | ||
8 | + * redistribute it and/or modify it under the terms of the GNU General Public License as published | ||
9 | + * by the Free Software Foundation, either version 3 of the License, or (at your option) any later | ||
10 | + * version. This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
11 | + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
12 | + * PURPOSE. See the GNU General Public License for more details. You should have received a copy of | ||
13 | + * the GNU General Public License along with this program. If not, see | ||
14 | + * <http://www.gnu.org/licenses/>. | ||
15 | + */ | ||
16 | + | ||
17 | +package eu.omp.irap.vespa.epntapclient.granule; | ||
18 | + | ||
19 | +import java.util.ArrayList; | ||
20 | +import java.util.List; | ||
21 | + | ||
22 | +import eu.omp.irap.vespa.votable.votabledata.VOTableData; | ||
23 | + | ||
24 | +/** | ||
25 | + * @author N. Jourdane | ||
26 | + */ | ||
27 | +public class VOTableDataTest { | ||
28 | + | ||
29 | + /** | ||
30 | + * Creates the column names corresponding to the data arrays returned by | ||
31 | + * {@link #createDataArray1()} and {@link #createDataArray2()} . | ||
32 | + * | ||
33 | + * @return An array of string containing the column names. | ||
34 | + */ | ||
35 | + public static String[] createColumnNames() { | ||
36 | + String[] columnNames = { "granule_uid", "granule_gid", "obs_id", "dataproduct_type", | ||
37 | + "target_name", "target_class", "time_min", "time_max", "time_sampling_step_min", | ||
38 | + "time_sampling_step_max", "time_exp_min", "time_exp_max", "spectral_range_min", | ||
39 | + "spectral_range_max", "spectral_resolution_min", "spectral_resolution_max", "c1min", | ||
40 | + "c1max", "c2min", "c2max", "c3min", "c3max", "s_region", "c1_resol_min", | ||
41 | + "c1_resol_max", "c2_resol_min", "c2_resol_max", "c3_resol_min", "c3_resol_max", | ||
42 | + "spatial_frame_type", "incidence_min", "incidence_max", "emergence_min", | ||
43 | + "emergence_max", "phase_min", "phase_max", "instrument_host_name", | ||
44 | + "instrument_name", "measurement_type", "processing_level", "creation_date", | ||
45 | + "modification_date", "release_date", "service_title" }; | ||
46 | + return columnNames; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Create a data set for tests purposes. It is planetary data for Uranus, got from an actual | ||
51 | + * ADQL query. | ||
52 | + * | ||
53 | + * @return An arrays of object containing the data values, with the same order as the columns | ||
54 | + * returned by {@link #createColumnNames()}. | ||
55 | + */ | ||
56 | + public static Object[] createDataArray1() { | ||
57 | + Object[] data1 = { "Uranus", "Planet", "7", "ca", "Uranus", "planet", Double.NaN, | ||
58 | + Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
59 | + Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
60 | + Double.NaN, "", Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
61 | + Double.NaN, "celestial", Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
62 | + Double.NaN, "", "", "\"phys.mass\" \"phys.size.radius\"", 5, "2015-08-20", | ||
63 | + "2015-08-20", "2015-08-20", "Planets" }; | ||
64 | + return data1; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Create a data set for tests purposes. It is planetary data for Neptune, got from an actual | ||
69 | + * ADQL query. | ||
70 | + * | ||
71 | + * @return An arrays of object containing the data values, with the same order as the columns | ||
72 | + * returned by {@link #createColumnNames()}. | ||
73 | + */ | ||
74 | + public static Object[] createDataArray2() { | ||
75 | + Object[] data2 = { "Neptune", "Planet", "8", "ca", "Neptune", "planet", Double.NaN, | ||
76 | + Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
77 | + Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
78 | + Double.NaN, "", Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
79 | + Double.NaN, "celestial", Double.NaN, Double.NaN, Double.NaN, Double.NaN, Double.NaN, | ||
80 | + Double.NaN, "", "", "\"phys.mass\" \"phys.size.radius\"", 5, "2015-08-20", | ||
81 | + "2015-08-20", "2015-08-20", "Planets" }; | ||
82 | + return data2; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * Create a VOTable data containing 2 datasets returned by {@link #createDataArray1()} and | ||
87 | + * {@link #createDataArray2()}. | ||
88 | + * | ||
89 | + * @return the VOTable data. | ||
90 | + */ | ||
91 | + public static VOTableData createVoTableData() { | ||
92 | + List<Object[]> data = new ArrayList<>(); | ||
93 | + data.add(createDataArray1()); | ||
94 | + data.add(createDataArray2()); | ||
95 | + return new VOTableData("Data set test", createColumnNames(), data); | ||
96 | + } | ||
97 | +} |