package at.asitplus.eidas.specific.connector.test; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.BlockJUnit4ClassRunner; import org.springframework.core.io.Resource; import at.asitplus.eidas.specific.connector.MsSpecificEidasNodeSpringResourceProvider; import at.gv.egiz.eaaf.core.test.TestConstants; @RunWith(BlockJUnit4ClassRunner.class) public class MsConnectorSpringResourceProviderTest { @Test public void testSpringConfig() { final MsSpecificEidasNodeSpringResourceProvider test = new MsSpecificEidasNodeSpringResourceProvider(); for (final Resource el : test.getResourcesToLoad()) { try { IOUtils.toByteArray(el.getInputStream()); } catch (final IOException e) { Assert.fail("Ressouce: " + el.getFilename() + " not found"); } } Assert.assertNotNull("no Name", test.getName()); Assert.assertNull("Find package definitions", test.getPackagesToScan()); } @Test public void testSpILoaderConfig() { final InputStream el = this.getClass().getResourceAsStream(TestConstants.TEST_SPI_LOADER_PATH); try { final String spiFile = IOUtils.toString(el, "UTF-8"); Assert.assertEquals("Wrong classpath in SPI file", MsSpecificEidasNodeSpringResourceProvider.class.getName(), spiFile); } catch (final IOException e) { Assert.fail("Ressouce: " + TestConstants.TEST_SPI_LOADER_PATH + " not found"); } } }