Blame view

src/test/java/eu/omp/irap/vespa/epntapclient/EpnTapConnectionTest.java 13.8 KB
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * 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;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
35daa117   Nathanael Jourdane   Improve JUnits te...
21
import static org.junit.Assert.assertTrue;
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
22
23

import java.util.ArrayList;
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
24
25
26
27
28
29
30
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.junit.Test;

import eu.omp.irap.vespa.epntapclient.granule.Granule;
35daa117   Nathanael Jourdane   Improve JUnits te...
31
import eu.omp.irap.vespa.epntapclient.service.ServiceCtrl;
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
32
33
import eu.omp.irap.vespa.epntapclient.voresource.VOResourceException;
import eu.omp.irap.vespa.epntapclient.voresource.model.Resource;
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
34
35
import eu.omp.irap.vespa.epntapclient.votable.model.VOTABLE;
import eu.omp.irap.vespa.votable.controller.CantGetVOTableException;
35daa117   Nathanael Jourdane   Improve JUnits te...
36
import eu.omp.irap.vespa.votable.votabledata.VOTableData;
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
37
38
39
40

/**
 * @author N. Jourdane
 */
330431b5   Nathanael Jourdane   Fix a Junit test ...
41
@SuppressWarnings("static-method")
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
42
43
44
45
46
public class EpnTapConnectionTest {

	/** The logger for the class Main. */
	private static final Logger logger = Logger.getLogger(EpnTapConnectionTest.class.getName());

330431b5   Nathanael Jourdane   Fix a Junit test ...
47
	/** The AMDA ivoid, for testing purposes. */
35daa117   Nathanael Jourdane   Improve JUnits te...
48
49
	private static final String AMDA_IVOID = "ivo://cdpp/amda";

330431b5   Nathanael Jourdane   Fix a Junit test ...
50
	/** The AMDA short name (to compare with the returned value), for testing purposes. */
35daa117   Nathanael Jourdane   Improve JUnits te...
51
52
	private static final String AMDA_SHORT_NAME = "AMDA";

330431b5   Nathanael Jourdane   Fix a Junit test ...
53
	/** The AMDA access URL, for testing purposes. */
35daa117   Nathanael Jourdane   Improve JUnits te...
54
55
	private static final String AMDA_ACCESS_URL = "http://cdpp-epntap.cesr.fr/__system__/tap/run/tap";

330431b5   Nathanael Jourdane   Fix a Junit test ...
56
	/** A subject associated with the AMDA service, for testing purposes. */
35daa117   Nathanael Jourdane   Improve JUnits te...
57
58
	private static final String AMDA_SUBJECT = "Space plasmas";

330431b5   Nathanael Jourdane   Fix a Junit test ...
59
	/** The API ivoid, for testing purposes. */
35daa117   Nathanael Jourdane   Improve JUnits te...
60
61
	private static final String APIS_IVOID = "ivo://vopdc.obspm/lesia/apis/epn";

330431b5   Nathanael Jourdane   Fix a Junit test ...
62
	/** The APIS short name (to compare with the returned value), for testing purposes. */
35daa117   Nathanael Jourdane   Improve JUnits te...
63
64
	private static final String APIS_SHORT_NAME = "APIS";

330431b5   Nathanael Jourdane   Fix a Junit test ...
65
	/** The URL access of a service implementing the EpnCorev2, for testing purposes. */
99642cfe   Nathanael Jourdane   Improve unit test...
66
67
	private static final String SERVICE_EPNCOREV2_ACCESS_URL = "http://voparis-tap-planeto.obspm.fr/__system__/tap/run/tap";

330431b5   Nathanael Jourdane   Fix a Junit test ...
68
	/** A query to send to a service implementing the EpnCorev2, for testing purposes */
99642cfe   Nathanael Jourdane   Improve unit test...
69
70
	private static final String SERVICE_EPNCOREV2_QUERY = "SELECT * FROM planets.epn_core";

330431b5   Nathanael Jourdane   Fix a Junit test ...
71
	/** The table name of a service implementing the EpnCorev2, for testing purposes. */
99642cfe   Nathanael Jourdane   Improve unit test...
72
	private static final String SERVICE_EPNCOREV2_TABLE_NAME = "planets.epn_core";
35daa117   Nathanael Jourdane   Improve JUnits te...
73
74
	// *** VOResources ***

5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
75

330431b5   Nathanael Jourdane   Fix a Junit test ...
76
77
78
79
80
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNVOresource(String)}.
	 *
	 * @throws VOResourceException Can not get the VOresource.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
81
82
	@Test
	public void getVOResourceTest() throws VOResourceException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
83
		logger.info("getVOResourceTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
84
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
85

330431b5   Nathanael Jourdane   Fix a Junit test ...
86
		Resource resource = facade.getEPNVOresource(AMDA_IVOID);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
87
88
89
90
91
92
93

		assertEquals("AMDA", resource.getShortName());
		assertEquals("CDPP AMDA DataBase", resource.getTitle());
		assertEquals("Centre de Données de la Physique des Plasmas",
				resource.getCuration().getCreator().get(0).getName().getValue());
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
94
95
96
97
98
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNVOResources()}.
	 *
	 * @throws VOResourceException Can not get the VOresource.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
99
100
	@Test
	public void getEPNVOResourcesTest() throws VOResourceException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
101
		logger.info("getEPNVOResourcesTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
102
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
103

5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
104
105
		List<Resource> resources = facade.getEPNVOResources();

35daa117   Nathanael Jourdane   Improve JUnits te...
106
107
108
109
110
111
112
113
114
115
116
117
		int nbResources = resources.size();
		assertTrue(nbResources + " ∉ [13;20]", nbResources >= 13 && nbResources <= 20);

		Resource amda = null;
		Resource apis = null;
		for (Resource resource : resources) {
			if (AMDA_IVOID.equals(resource.getIdentifier())) {
				amda = resource;
			}
			if (APIS_IVOID.equals(resource.getIdentifier())) {
				apis = resource;
			}
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
118
		}
35daa117   Nathanael Jourdane   Improve JUnits te...
119
120
121
122
		assertNotNull("AMDA resource should be present.", amda);
		assertNotNull("APIS resource should be present.", apis);
		assertEquals(AMDA_SHORT_NAME, amda.getShortName());
		assertEquals(APIS_SHORT_NAME, apis.getShortName());
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
123
124
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
125
126
127
128
129
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNVOResources(List)}.
	 *
	 * @throws VOResourceException Can not get the VOresource.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
130
131
	@Test
	public void getEPNVOResourcesWithKeywordsTest() throws VOResourceException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
132
		logger.info("getEPNVOResourcesWithKeywordsTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
133
		EpnTapConnection facade = new EpnTapConnection();
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
134

35daa117   Nathanael Jourdane   Improve JUnits te...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
		final List<String> keywords = new ArrayList<>();
		keywords.add(AMDA_SUBJECT);
		List<Resource> resources = facade.getEPNVOResources(keywords);

		assertEquals(resources.size(), 1);

		Resource amda = null;
		for (Resource resource : resources) {
			System.out.println(resource.getIdentifier());
			if (AMDA_IVOID.equals(resource.getIdentifier())) {
				amda = resource;
			}
		}
		assertNotNull("AMDA resource should be present.", amda);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
149
150
	}

35daa117   Nathanael Jourdane   Improve JUnits te...
151
152
	// *** Services ***

330431b5   Nathanael Jourdane   Fix a Junit test ...
153
154
155
156
157
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNService(String)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
158
159
	@Test
	public void getEPNServiceTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
160
		logger.info("getEPNServiceTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
161
162
		EpnTapConnection facade = new EpnTapConnection();

330431b5   Nathanael Jourdane   Fix a Junit test ...
163
		VOTABLE voTable = facade.getEPNService(AMDA_IVOID);
35daa117   Nathanael Jourdane   Improve JUnits te...
164
		VOTableData data = ServiceCtrl.getVoTableData(voTable);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
165

35daa117   Nathanael Jourdane   Improve JUnits te...
166
167
168
169
170
171
172
		assertEquals(1, data.getNbRows());
		assertTrue("Column name ivoid not found.", data.isContainingColumnName("ivoid"));
		assertTrue("Column name short_name not found.", data.isContainingColumnName("access_url"));
		assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
		assertEquals(AMDA_IVOID, data.getCell(0, "ivoid"));
		assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
		assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
173
174
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
175
176
177
178
179
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNService(String, List)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
180
181
	@Test
	public void getEPNServiceWithAttributesTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
182
		logger.info("getEPNServiceWithAttributesTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
183
184
		EpnTapConnection facade = new EpnTapConnection();

35daa117   Nathanael Jourdane   Improve JUnits te...
185
186
187
		final List<String> attributes = new ArrayList<>();
		attributes.add("access_url");
		attributes.add("short_name");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
188

330431b5   Nathanael Jourdane   Fix a Junit test ...
189
		VOTABLE voTable = facade.getEPNService(AMDA_IVOID, attributes);
35daa117   Nathanael Jourdane   Improve JUnits te...
190
		VOTableData data = ServiceCtrl.getVoTableData(voTable);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
191

35daa117   Nathanael Jourdane   Improve JUnits te...
192
193
194
195
196
197
		assertEquals(1, data.getNbRows());
		assertEquals(2, data.getNbColumns());
		assertTrue("Column name short_name not found.", data.isContainingColumnName("access_url"));
		assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
		assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
		assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
198
199
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
200
201
202
203
204
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNServices()}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
205
	@Test
35daa117   Nathanael Jourdane   Improve JUnits te...
206
	public void getEPNServicesTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
207
		logger.info("getEPNServicesTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
208
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
209
210
211
212
213

		VOTABLE voTable = facade.getEPNServices();
		VOTableData data = ServiceCtrl.getVoTableData(voTable);
		int nbServices = data.getNbRows();
		assertTrue(nbServices + " ∉ [13;20].", nbServices >= 13 && nbServices <= 20);
330431b5   Nathanael Jourdane   Fix a Junit test ...
214
		assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
35daa117   Nathanael Jourdane   Improve JUnits te...
215
216
		assertTrue("AMDA ivoid not found.", data.isColumnContainingValue("ivoid", AMDA_IVOID));
		Map<String, Object> amda = data.getRowMapByValue("ivoid", AMDA_IVOID);
330431b5   Nathanael Jourdane   Fix a Junit test ...
217
218
219

		assertEquals(AMDA_ACCESS_URL, amda.get("access_url"));
		assertEquals(AMDA_SHORT_NAME, amda.get("short_name"));
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
220
221
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
222
223
224
225
226
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNServices(List)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
227
228
	@Test
	public void getEPNServicesWithAttributesTest()
35daa117   Nathanael Jourdane   Improve JUnits te...
229
			throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
230
		logger.info("getEPNServicesWithAttributesTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
231
		EpnTapConnection facade = new EpnTapConnection();
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
232

35daa117   Nathanael Jourdane   Improve JUnits te...
233
234
235
236
		final List<String> attributes = new ArrayList<>();
		attributes.add("access_url");
		attributes.add("short_name");

330431b5   Nathanael Jourdane   Fix a Junit test ...
237
		VOTABLE voTable = facade.getEPNServices(attributes);
35daa117   Nathanael Jourdane   Improve JUnits te...
238
239
240
		VOTableData data = ServiceCtrl.getVoTableData(voTable);

		assertEquals(2, data.getNbColumns());
330431b5   Nathanael Jourdane   Fix a Junit test ...
241
242
243
244
245
246
247
248
249
250
		assertTrue("Column name access_url not found.", data.isContainingColumnName("access_url"));
		assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
		assertTrue("AMDA short_name not found.",
				data.isColumnContainingValue("short_name", AMDA_SHORT_NAME));
		assertTrue("AMDA access_url not found.",
				data.isColumnContainingValue("access_url", AMDA_ACCESS_URL));

		Map<String, Object> amda = data.getRowMapByValue("short_name", AMDA_SHORT_NAME);
		assertEquals(AMDA_ACCESS_URL, amda.get("access_url"));
		assertEquals(AMDA_SHORT_NAME, amda.get("short_name"));
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
251
252
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
253
254
255
256
257
258
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNServices(List, List)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 * @throws VOResourceException Can not get the VOresource.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
259
	@Test
330431b5   Nathanael Jourdane   Fix a Junit test ...
260
	public void getEPNServicesWithKeywordsAndAttributesTest()
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
261
			throws CantGetVOTableException, VOResourceException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
262
		logger.info("getEPNServicesWithKeywordsAndAttributesTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
263
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
264

330431b5   Nathanael Jourdane   Fix a Junit test ...
265
266
267
		final List<String> keywords = new ArrayList<>();
		keywords.add(AMDA_SUBJECT);

35daa117   Nathanael Jourdane   Improve JUnits te...
268
269
270
271
		final List<String> attributes = new ArrayList<>();
		attributes.add("access_url");
		attributes.add("short_name");

35daa117   Nathanael Jourdane   Improve JUnits te...
272
273
274
275
		VOTABLE voTable = facade.getEPNServices(keywords, attributes);
		VOTableData data = ServiceCtrl.getVoTableData(voTable);

		assertEquals(3, data.getNbColumns());
330431b5   Nathanael Jourdane   Fix a Junit test ...
276
		assertEquals(1, data.getNbRows());
35daa117   Nathanael Jourdane   Improve JUnits te...
277
278
279
280
281
282
283
284
285
		// TODO: Should be return only 2 columns, because keywords do not contains res_subject.
		assertTrue("Column name access_url not found.", data.isContainingColumnName("access_url"));
		assertTrue("Column name short_name not found.", data.isContainingColumnName("short_name"));
		assertTrue("AMDA short_name not found.",
				data.isColumnContainingValue("short_name", AMDA_SHORT_NAME));
		assertTrue("AMDA access_url not found.",
				data.isColumnContainingValue("access_url", AMDA_ACCESS_URL));
		assertEquals(AMDA_SHORT_NAME, data.getCell(0, "short_name"));
		assertEquals(AMDA_ACCESS_URL, data.getCell(0, "access_url"));
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
286
287
	}

35daa117   Nathanael Jourdane   Improve JUnits te...
288
289
	// *** Getters ***

330431b5   Nathanael Jourdane   Fix a Junit test ...
290
291
292
293
294
	/**
	 * Unit test for the class {@link EpnTapConnection#getEPNCoreTableName(String)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
295
296
	@Test
	public void getEPNCoreTableNameTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
297
		logger.info("getEPNCoreTableNameTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
298
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
299

330431b5   Nathanael Jourdane   Fix a Junit test ...
300
		String epnCoreTableName = facade.getEPNCoreTableName(AMDA_IVOID);
35daa117   Nathanael Jourdane   Improve JUnits te...
301
302

		assertEquals("amdadb.epn_core", epnCoreTableName);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
303
304
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
305
306
307
308
309
	/**
	 * Unit test for the class {@link EpnTapConnection#getTAPURL(String)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable corresponding to the service.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
310
311
	@Test
	public void getTAPURLTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
312
		logger.info("getTAPURLTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
313
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
314

5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
315
		String tapURL = facade.getTAPURL("ivo://cdpp/amda");
35daa117   Nathanael Jourdane   Improve JUnits te...
316

5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
317
318
319
		assertEquals("http://cdpp-epntap.cesr.fr/__system__/tap/run/tap", tapURL);
	}

35daa117   Nathanael Jourdane   Improve JUnits te...
320
321
	// *** Queries ***

330431b5   Nathanael Jourdane   Fix a Junit test ...
322
323
324
325
326
	/**
	 * Unit test for the class {@link EpnTapConnection#sendADQLQuery(String, String)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable resulting the query.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
327
328
	@Test
	public void sendADQLQueryTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
329
		logger.info("sendADQLQueryTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
330
		EpnTapConnection facade = new EpnTapConnection();
35daa117   Nathanael Jourdane   Improve JUnits te...
331

99642cfe   Nathanael Jourdane   Improve unit test...
332
333
		List<Granule> granules = facade.sendADQLQuery(SERVICE_EPNCOREV2_ACCESS_URL,
				SERVICE_EPNCOREV2_QUERY);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
334

35daa117   Nathanael Jourdane   Improve JUnits te...
335
		assertNotNull("Granules list not returned.", granules);
99642cfe   Nathanael Jourdane   Improve unit test...
336
337
338
339
340
341
342
343
344
345
		assertEquals(8, granules.size());
		Granule mars = null;
		for (Granule granule : granules) {
			if ("Mars".equals(granule.granuleUid)) {
				mars = granule;
			}
		}
		assertNotNull("granule 'Mars' is not found.", mars);
		assertEquals("4", mars.obsId);
		assertEquals(new Integer(5), mars.processingLevel);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
346
347
	}

330431b5   Nathanael Jourdane   Fix a Junit test ...
348
349
350
351
352
	/**
	 * Unit test for the class {@link EpnTapConnection#sendQuery(String, String, Query)}.
	 *
	 * @throws CantGetVOTableException Can not get the VOTable resulting the query.
	 */
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
353
354
	@Test
	public void sendADQLQueryWithSchemaNameTest() throws CantGetVOTableException {
330431b5   Nathanael Jourdane   Fix a Junit test ...
355
		logger.info("sendADQLQueryWithSchemaNameTest");
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
356
		EpnTapConnection facade = new EpnTapConnection();
99642cfe   Nathanael Jourdane   Improve unit test...
357
		List<Granule> granules = facade.sendQuery(SERVICE_EPNCOREV2_ACCESS_URL,
125adfc1   Nathanael Jourdane   Use enumerated qu...
358
				SERVICE_EPNCOREV2_TABLE_NAME, Query.GET_SCENE_FROM_TARGET_AND_TIME_INTERVAL);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
359

35daa117   Nathanael Jourdane   Improve JUnits te...
360
		assertNotNull("Granules list not returned.", granules);
99642cfe   Nathanael Jourdane   Improve unit test...
361
362
363
364
365
366
367
368
		assertEquals(8, granules.size());
		Granule mars = null;
		for (Granule granule : granules) {
			if ("Mars".equals(granule.granuleUid)) {
				mars = granule;
			}
		}
		assertNotNull("granule 'Mars' is not found.", mars);
125adfc1   Nathanael Jourdane   Use enumerated qu...
369
370
		assertEquals("4", mars.obsId);
		assertEquals(new Integer(5), mars.processingLevel);
5d00d3ff   Nathanael Jourdane   #5 Add JUnit test...
371
372
	}
}