/** * Deploy * @param raa The resource adapter archive * @exception Throwable If an error occurs */ public void deploy(ResourceAdapterArchive raa) throws Throwable { if (raa == null) throw new IllegalArgumentException("Url is null"); if (!raa.getName().endsWith(".rar")) throw new IllegalArgumentException(raa.getName() + " doesn't end with .rar"); if (!started) throw new IllegalStateException("Container not started"); File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir")); File raaFile = new File(parentDirectory, raa.getName()); if (shrinkwrapDeployments != null && shrinkwrapDeployments.contains(raaFile)) throw new IOException(raa.getName() + " already deployed"); if (raaFile.exists()) recursiveDelete(raaFile); raa.as(ZipExporter.class).exportTo(raaFile, true); if (shrinkwrapDeployments == null) shrinkwrapDeployments = new ArrayList<File>(1); shrinkwrapDeployments.add(raaFile); log.debugf("Deploying: %s", raaFile); kernel.getMainDeployer().deploy(raaFile.toURI().toURL()); }
/** * Undeploy * @param raa The resource adapter archive * @exception Throwable If an error occurs */ public void undeploy(ResourceAdapterArchive raa) throws Throwable { if (raa == null) throw new IllegalArgumentException("Url is null"); if (!started) throw new IllegalStateException("Container not started"); File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir")); File raaFile = new File(parentDirectory, raa.getName()); log.debugf("Undeploying: %s", raaFile); if (shrinkwrapDeployments == null || !shrinkwrapDeployments.contains(raaFile)) throw new IOException(raa.getName() + " not deployed"); kernel.getMainDeployer().undeploy(raaFile.toURI().toURL()); removeDeployment(raaFile); }
/** * Undeploy * @param raa The resource adapter archive * @exception Throwable If an error occurs */ public void undeploy(ResourceAdapterArchive raa) throws Throwable { if (raa == null) throw new IllegalArgumentException("Url is null"); if (!started) throw new IllegalStateException("Container not started"); File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir")); File raaFile = new File(parentDirectory, raa.getName()); log.debugf("Undeploying: %s", raaFile); if (shrinkwrapDeployments == null || !shrinkwrapDeployments.contains(raaFile)) throw new IOException(raa.getName() + " not deployed"); kernel.getMainDeployer().undeploy(raaFile.toURI().toURL()); removeDeployment(raaFile); }
/** * Deploy * @param raa The resource adapter archive * @exception Throwable If an error occurs */ public void deploy(ResourceAdapterArchive raa) throws Throwable { if (raa == null) throw new IllegalArgumentException("Url is null"); if (!raa.getName().endsWith(".rar")) throw new IllegalArgumentException(raa.getName() + " doesn't end with .rar"); if (!started) throw new IllegalStateException("Container not started"); File parentDirectory = new File(SecurityActions.getSystemProperty("java.io.tmpdir")); File raaFile = new File(parentDirectory, raa.getName()); if (shrinkwrapDeployments != null && shrinkwrapDeployments.contains(raaFile)) throw new IOException(raa.getName() + " already deployed"); if (raaFile.exists()) recursiveDelete(raaFile); raa.as(ZipExporter.class).exportTo(raaFile, true); if (shrinkwrapDeployments == null) shrinkwrapDeployments = new ArrayList<File>(1); shrinkwrapDeployments.add(raaFile); log.debugf("Deploying: %s", raaFile); kernel.getMainDeployer().deploy(raaFile.toURI().toURL()); }
@Test public void shouldCreateArchiveWithCorrectExtensionForResourceAdapterArchive() throws Exception { ResourceAdapterArchive resourceAdapterArchive = ShrinkWrap.create(ResourceAdapterArchive.class); String archiveExtension = resourceAdapterArchive.getName().substring( resourceAdapterArchive.getName().lastIndexOf(".")); Assert.assertEquals("ResourceAdapterArchive should have proper extension", ".rar", archiveExtension); }
@Test public void shouldCreateResourceAdapterArchiveWithGivenName() throws Exception { String archiveName = "testArchive"; ResourceAdapterArchive resourceAdapterArchive = ShrinkWrap.create(ResourceAdapterArchive.class, archiveName); Assert.assertEquals("ResourceAdapterArchive should have given name", archiveName, resourceAdapterArchive.getName()); }
@After public void ls() { System.out.println("test@jboss:/$ ls -l " + archive.getName()); System.out.println(archive.toString(true)); }