/** * @param j2sramp */ public static void closeQuietly(ZipToSrampArchive j2sramp) { try { if (j2sramp != null) j2sramp.close(); } catch (IOException e) { } }
/** * Test method for {@link org.overlord.sramp.atom.archive.jar.ZipToSrampArchive.jar.JarToSrampArchive#JarToSrampArchive(java.io.InputStream)}. */ @Test public void testJarToSrampArchiveInputStream() throws Exception { InputStream resourceAsStream = ZipToSrampArchiveTest.class.getResourceAsStream("sample-webservice-0.0.1.jar"); //$NON-NLS-1$ ZipToSrampArchive j2sramp = null; try { j2sramp = new ZipToSrampArchive(resourceAsStream){}; File jarWorkDir = getJarWorkDir(j2sramp); Assert.assertNotNull(jarWorkDir); Assert.assertTrue(jarWorkDir.isDirectory()); Collection<File> files = FileUtils.listFiles(jarWorkDir, new String[] {"xsd", "wsdl"}, true); //$NON-NLS-1$ //$NON-NLS-2$ Assert.assertEquals(2, files.size()); Set<String> fnames = new HashSet<String>(); for (File f : files) { fnames.add(f.getName()); } Assert.assertTrue(fnames.contains("teetime.xsd")); //$NON-NLS-1$ Assert.assertTrue(fnames.contains("teetime.wsdl")); //$NON-NLS-1$ } finally { if (j2sramp != null) j2sramp.close(); } }