Search in sources :

Example 1 with PayaraClientException

use of fish.payara.arquillian.container.payara.clientutils.PayaraClientException in project Payara by payara.

the class CommonPayaraManager method undeploy.

public void undeploy(Archive<?> archive) throws DeploymentException {
    if (archive == null) {
        throw new IllegalArgumentException("archive must not be null");
    }
    deploymentName = createDeploymentName(archive.getName());
    try {
        // Build up the POST form to send to Payara
        FormDataMultiPart form = new FormDataMultiPart();
        form.field("target", configuration.getTarget(), TEXT_PLAIN_TYPE);
        form.field("operation", DELETE_OPERATION, TEXT_PLAIN_TYPE);
        payaraClient.doUndeploy(deploymentName, form);
    } catch (PayaraClientException e) {
        throw new DeploymentException("Could not undeploy " + archive.getName(), e);
    }
}
Also used : FormDataMultiPart(org.glassfish.jersey.media.multipart.FormDataMultiPart) DeploymentException(org.jboss.arquillian.container.spi.client.container.DeploymentException) PayaraClientException(fish.payara.arquillian.container.payara.clientutils.PayaraClientException)

Example 2 with PayaraClientException

use of fish.payara.arquillian.container.payara.clientutils.PayaraClientException in project Payara by payara.

the class CommonPayaraManager method deploy.

public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
    if (archive == null) {
        throw new IllegalArgumentException("archive must not be null");
    }
    final String archiveName = archive.getName();
    final ProtocolMetaData protocolMetaData = new ProtocolMetaData();
    try {
        InputStream deployment = archive.as(ZipExporter.class).exportAsInputStream();
        // Build up the POST form to send to Payara
        final FormDataMultiPart form = new FormDataMultiPart();
        form.bodyPart(new StreamDataBodyPart("id", deployment, archiveName));
        deploymentName = createDeploymentName(archiveName);
        addDeployFormFields(deploymentName, form);
        // Do Deploy the application on the remote Payara
        HTTPContext httpContext = payaraClient.doDeploy(deploymentName, form);
        protocolMetaData.addContext(httpContext);
    } catch (PayaraClientException e) {
        throw new DeploymentException("Could not deploy " + archiveName, e);
    }
    return protocolMetaData;
}
Also used : StreamDataBodyPart(org.glassfish.jersey.media.multipart.file.StreamDataBodyPart) InputStream(java.io.InputStream) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) FormDataMultiPart(org.glassfish.jersey.media.multipart.FormDataMultiPart) HTTPContext(org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext) DeploymentException(org.jboss.arquillian.container.spi.client.container.DeploymentException) ProtocolMetaData(org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData) PayaraClientException(fish.payara.arquillian.container.payara.clientutils.PayaraClientException)

Aggregations

PayaraClientException (fish.payara.arquillian.container.payara.clientutils.PayaraClientException)2 FormDataMultiPart (org.glassfish.jersey.media.multipart.FormDataMultiPart)2 DeploymentException (org.jboss.arquillian.container.spi.client.container.DeploymentException)2 InputStream (java.io.InputStream)1 StreamDataBodyPart (org.glassfish.jersey.media.multipart.file.StreamDataBodyPart)1 HTTPContext (org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext)1 ProtocolMetaData (org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData)1 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)1