Blame view

src/test/java/eu/omp/irap/vespa/epntapclient/service/ServiceTest.java 3.57 KB
708ed8e6   Nathanael Jourdane   Add test files fo...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * 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.service;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

1375d734   Nathanael Jourdane   Create package ep...
24
25
import eu.omp.irap.vespa.epntapclient.epntap.service.Service;

708ed8e6   Nathanael Jourdane   Add test files fo...
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
/**
 * @author N. Jourdane
 */
public class ServiceTest {

	/**
	 * Create an incomplete service, without many parameters, which is forbidden.
	 *
	 * @return The created service.
	 */
	public static Service createIncompleteService() {
		Service incompleteService = new Service("ivo://cdpp/amda");
		incompleteService.setContentLevel("4");
		return incompleteService;
	}

	/**
	 * Create a service from an actual ADQL query. It is the AMDA service.
	 *
	 * @return The created service
	 */
	public static Service createService() {
		Service service = new Service("ivo://cdpp/amda");
		service.setContentLevel("4");
		service.setCreated("2014-11-06T17:00:00");
		service.setCreator("Centre de Données de la Physique des Plasmas");
		service.setDescription(
				"The CDPP (Centre de Données de la Physique des Plasmas) was created in 1998 jointly by CNES and INSU. The CDPP is the French national data centre \n"
						+ "                        for natural plasmas of the solar system. The CDPP assures the long term preservation of data obtained primarily from instruments built using French \n"
						+ "                        resources, and renders them readily accessible and exploitable by the international community. The CDPP also provides services to enable on-line data \n"
						+ "                        analysis (AMDA), 3D data visualization in context (3DView), and a propagation tool which bridges solar perturbations to in-situ measurements. \n"
						+ "                        The CDPP is involved in the development of interoperability, participates in several Virtual Observatory projects, and supports data distribution for\n"
						+ "                        scientific missions (Solar Orbiter, JUICE).");
		service.setReferenceURL("http://amda.cdpp.eu");
		service.setShortName("AMDA");
		service.setTitle("CDPP AMDA DataBase");
		service.setType("archive");
		service.setUpdated("2014-11-13T17:00:00");
		return service;
	}

	/**
	 * Test if the incomplete service appears like not valid.
	 */
	@SuppressWarnings("static-method") // Otherwise JUnit doesn't work.
	@Test
	public void isNotValid() {
		assertTrue("The complete service is not valid.", createService().isValid());
	}

	/**
	 * Test if the complete service appears like valid.
	 */
	@SuppressWarnings("static-method") // Otherwise JUnit doesn't work.
	@Test
	public void isValid() {
		assertFalse("The incomplete service is valid.", createIncompleteService().isValid());
	}
}