Examples of DeployProjectArtifact


Examples of org.arquillian.tutorial.extension.deployment.api.DeployProjectArtifact

*/
public class ProjectArtifactDeploymentGenerator implements DeploymentScenarioGenerator {
    @Override
    public List<DeploymentDescription> generate(TestClass testClass) {
        if (testClass.isAnnotationPresent(DeployProjectArtifact.class)) {
            DeployProjectArtifact config = testClass.getAnnotation(DeployProjectArtifact.class);
            String archiveName = config.value();
            if (archiveName.length() == 0) {
                archiveName = getArchiveNameFromPom();
            }
            Class<? extends Archive<?>> type = JavaArchive.class;
            if (archiveName.endsWith(".war")) {
                type = WebArchive.class;
            }
            else if (archiveName.endsWith(".ear")) {
                type = EnterpriseArchive.class;
            }
            File archiveFile = new File("target/" + archiveName);
            if (!archiveFile.exists()) {
                throw new IllegalStateException("Project artifact has not been generated: " + archiveFile.getAbsolutePath());
            }
            Archive<?> archive = ShrinkWrap.create(type, archiveName).as(ZipImporter.class)
                    .importFrom(new File("target/" + archiveName)).as(type);
            DeploymentDescription dd = new DeploymentDescription("application", archive);
            dd.shouldBeTestable(config.testable());
            return Arrays.asList(dd);
        }
        return Collections.emptyList();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.