/* * This file is part of vospace-rest * Copyright (C) 2021 Istituto Nazionale di Astrofisica * SPDX-License-Identifier: GPL-3.0-or-later */ package it.inaf.oats.vospace.parent.persistence; import javax.sql.DataSource; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; import static org.junit.jupiter.api.Assertions.assertFalse; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = {DataSourceConfig.class}) @TestPropertySource(locations = "classpath:test.properties") public class LinkedServiceDAOTest { @Autowired private DataSource dataSource; private LinkedServiceDAO dao; @BeforeEach public void init() { dao = new LinkedServiceDAO(dataSource); } @Test void testIsLinkedService() { assertTrue(dao.isLinkedServiceUrl("http://archives.ia2.inaf.it/files/aao/pippofile.fits.gz")); assertFalse(dao.isLinkedServiceUrl("http://noportal.ia2.inaf.it/files/nop/nopippofile.tar.gz")); } }