throw new DeploymentException("Failed to copy the archive assets into the deployment directory", e); } catch (ReflectiveOperationException e) { throw new DefinitionException(e.getCause()); // validation exceptions
private String deployInternal(String name, InputStream input) throws DeploymentException { try { return deployer.deploy(name, input); } catch (Exception ex) { Throwable rootCause = ex.getCause(); while (null != rootCause && rootCause.getCause() != null) { rootCause = rootCause.getCause(); } throw new DeploymentException("Cannot deploy: " + name, rootCause); } } }
@Override public synchronized void undeploy(Archive<?> archive) throws DeploymentException { try { this.delegateContainer.stop(); } catch (Exception e) { throw new DeploymentException("Unable to stop process", e); } }
private String deployInternal(String name, InputStream input) throws DeploymentException { try { return deployer.deploy(name, input); } catch (Exception ex) { Throwable rootCause = ex.getCause(); while (null != rootCause && rootCause.getCause() != null) { rootCause = rootCause.getCause(); } throw new DeploymentException("Cannot deploy: " + name, rootCause); } } }
private static Set<String> getServerGroups(final Archive<?> archive) throws DeploymentException { if (archive instanceof ServerGroupArchive) { return ((ServerGroupArchive<?>) archive).getServerGroups(); } throw new DeploymentException("Could not determine the server-group to deploy the archive to."); }
@Override public void undeploy(Archive<?> archive) throws DeploymentException { AbstractDeployment deployment = deployments.get(archive); if (deployment == null) { throw new DeploymentException("Could not find deployed archive " + archive.getName()); } deployment.stop(); deployments.remove(archive); }
public void undeploy(final String name) throws IOException, DeploymentException { Validate.notNullOrEmpty(name, "Undeployed name must not be null or empty"); // Building URL final StringBuilder command = new StringBuilder(tomcatManagerCommandSpec.getUndeployCommand()); try { command.append(URLEncoder.encode(name, configuration.getUrlCharset())); } catch (final UnsupportedEncodingException e) { throw new DeploymentException("Unable to construct path for Tomcat manager", e); } execute(command.toString(), null, null, -1); }
public void undeploy(Archive<?> archive) throws DeploymentException { if(deploymentManager != null) { try { deploymentManager.stop(); } catch (ServletException e) { throw new DeploymentException(e.getMessage()); } } undertow.stop(); }
@Override public void undeploy(Archive<?> archive) throws DeploymentException { // Get all the server groups we're deploying to final Set<String> serverGroups = getServerGroups(archive); if (!serverGroups.isEmpty()) { final ArchiveDeployer deployer = archiveDeployerInst.get(); deployer.undeploy(archive.getName(), serverGroups); } else { throw new DeploymentException("Could not determine the server-group for the undeploy."); } }
@Override public void undeploy(final Archive<?> archive) throws DeploymentException { try { embeddedHostConfig.undeployWAR(archive.getName()); deleteWar(archive); } catch (final Exception e) { throw new DeploymentException("Failed to undeploy " + archive.getName(), e); } }
@Override public ProtocolMetaData deploy(final Archive<?> archive) throws DeploymentException { try { installBundle(archive, false); } catch (Exception e) { throw new DeploymentException("Can't deploy archive", e); } return new ProtocolMetaData().addContext(new JMXContext(mbeanServer)); }
@Override public void undeploy(final Archive<?> archive) throws DeploymentException { Validate.notNull(archive, "Archive must not be null"); final String archiveName = manager.normalizeArchiveName(archive.getName()); try { manager.undeploy("/" + archiveName); } catch (final IOException e) { throw new DeploymentException("Unable to undeploy an archive " + archive.getName(), e); } } }
@Override public void undeploy(Archive<?> archive) throws DeploymentException { try { Manifest manifest = new Manifest(archive.get("/META-INF/MANIFEST.MF").getAsset().openStream()); OSGiMetaData metadata = OSGiMetaDataBuilder.load(manifest); undeploy(metadata.getBundleSymbolicName()); } catch (IOException e) { throw new DeploymentException("Cannot undeploy: " + archive.getName(), e); } }
public void undeploy(Archive<?> archive) throws DeploymentException { try { glassfish.getDeployer().undeploy(createDeploymentName(archive.getName())); } catch (Exception e) { throw new DeploymentException("Could not undeploy " + archive.getName(), e); } }
@Override public void undeploy(final Archive<?> archive) throws DeploymentException { Validate.notNull(archive, "Archive must not be null"); final String archiveName = manager.normalizeArchiveName(archive.getName()); try { manager.undeploy("/" + archiveName); } catch (final IOException e) { throw new DeploymentException("Unable to undeploy an archive " + archive.getName(), e); } }
@Test(expected = DeploymentException.class) public void shouldRethrowExceptionIfWrongExpectedType() throws Exception { TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", new NullPointerException()); Mockito.when(serviceLoader.all(DeploymentExceptionTransformer.class)) .thenReturn(Collections.singletonList(transformer)); fire(new DeployDeployment( container, new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class)) .setExpectedException(IllegalArgumentException.class)))); }
@Test public void shouldCallDeploymentTransformers() throws Exception { TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", new IllegalArgumentException()); Mockito.when(serviceLoader.all(DeploymentExceptionTransformer.class)) .thenReturn(Collections.singletonList(transformer)); fire(new DeployDeployment( container, new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class)) .setExpectedException(IllegalArgumentException.class)))); Mockito.verify(transformer, Mockito.times(1)).transform(Mockito.isA(Exception.class)); }
@Test public void shouldCallDeploymentTransformersWithEmptyCauseException() throws Exception { TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", null); Mockito.when(serviceLoader.all(DeploymentExceptionTransformer.class)) .thenReturn(Collections.singletonList(transformer)); fire(new DeployDeployment( container, new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class)) .setExpectedException(DeploymentException.class)))); Mockito.verify(transformer, Mockito.times(1)).transform(TestExceptionDeployThrower.shouldThrow); }
@Test(expected = DeploymentException.class) public void shouldRethrowExceptionIfExpectedNotSet() throws Exception { TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", new NullPointerException()); fire(new DeployDeployment( container, new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class))))); }
@Test public void shouldSwallowExceptionIfExpected() throws Exception { TestExceptionDeployThrower.shouldThrow = new DeploymentException("Could not handle ba", new NullPointerException()); fire(new DeployDeployment( container, new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class)) .setExpectedException(NullPointerException.class)))); }