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