public synchronized void setTargetServerGroups(@Observes BeforeDeploy event) { final String deploymentName = event.getDeployment().getName(); if (serverGroupTargets.containsKey(deploymentName)) { final DeploymentDescription deploymentDescription = event.getDeployment(); final Archive<?> delegate = deploymentDescription.getArchive(); // Note that this breaks if anything else replaces this archive deploymentDescription.setTestableArchive(new ServerGroupArchive<>(delegate, Collections.unmodifiableSet(serverGroupTargets.get(deploymentName)))); } }
public void export(@Observes BeforeDeploy event) throws Exception { String deploymentOutputFolder = System.getProperty(ARQUILLIAN_TOOLING_DEPLOYMENT_FOLDER); if (deploymentOutputFolder == null) // tooling not activated, nothing to do { return; } Archive<?> deployment = event.getDeployment().getTestableArchive(); // deployment not in context?, nothing to do if (deployment == null) { return; } /* TestClass testClass = event.getTestClass(); String deploymentContent = deployment.toString(new ToolingDeploymentFormatter(testClass.getJavaClass())); writeOutToFile( new File(deploymentOutputFolder + "/" + testClass.getName() + ".xml"), deploymentContent); */ }
public void export(@Observes BeforeDeploy event) throws Exception { String deploymentOutputFolder = System.getProperty(ARQUILLIAN_TOOLING_DEPLOYMENT_FOLDER); if (deploymentOutputFolder == null) // tooling not activated, nothing to do { return; } Archive<?> deployment = event.getDeployment().getTestableArchive(); // deployment not in context?, nothing to do if (deployment == null) { return; } /* TestClass testClass = event.getTestClass(); String deploymentContent = deployment.toString(new ToolingDeploymentFormatter(testClass.getJavaClass())); writeOutToFile( new File(deploymentOutputFolder + "/" + testClass.getName() + ".xml"), deploymentContent); */ }
final String containerName = container.getName(); if (setupTasks.containsKey(containerName)) { setupTasks.get(containerName).deployments.add(event.getDeployment()); return; holder.deployments.add(event.getDeployment()); setupTasks.put(containerName, holder); holder.setup(setup, containerName);
final String containerName = container.getName(); if (setupTasks.containsKey(containerName)) { setupTasks.get(containerName).deployments.add(event.getDeployment()); return; holder.deployments.add(event.getDeployment()); setupTasks.put(containerName, holder); holder.setup(setup, containerName);
: Boolean.parseBoolean(systemExport); if (exportPath != null && event.getDeployment().isArchiveDeployment()) { File exportDir = new File(exportPath); if (exportDir.isFile()) { if (event.getDeployment().testable()) { deployment = event.getDeployment().getTestableArchive(); } else { deployment = event.getDeployment().getArchive(); final File fileToExport = new File(exportDir, createFileName(event.getDeployment(), deployment)); deleteIfExists(fileToExport); exportDir, createFileName(event.getDeployment(), deployment)); } else { deployment.as(ZipExporter.class).exportTo(fileToExport,
public synchronized void doServiceDeploy(@Observes(precedence = 1) BeforeDeploy event, Container container, ServiceArchiveHolder archiveHolder) { // already deployed? if (serviceArchiveDeployed.contains(container.getName())) { archiveHolder.deploymentExistsAndRemove(event.getDeployment().getName()); // cleanup return; } // only deploy the service if the deployment has been enriched by the jmx-as7 protocol if (archiveHolder.deploymentExistsAndRemove(event.getDeployment().getName())) { JavaArchive serviceArchive = (JavaArchive) archiveHolder.getArchive(); try { log.infof("Deploy arquillian service: %s", serviceArchive); final Map<String, String> props = container.getContainerConfiguration().getContainerProperties(); //MASSIVE HACK //write the management connection props to the archive, so we can access them from the server final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bytes); out.writeObject(props.get("managementPort")); out.writeObject(NetworkUtils.formatPossibleIpv6Address(props.get("managementAddress"))); out.writeObject(NetworkUtils.formatPossibleIpv6Address(props.get("managementProtocol"))); out.writeObject(props.get("authenticationConfig")); out.close(); serviceArchive.addAsManifestResource(new ByteArrayAsset(bytes.toByteArray()), "org.jboss.as.managementConnectionProps"); DeployableContainer<?> deployableContainer = container.getDeployableContainer(); deployableContainer.deploy(serviceArchive); serviceArchiveDeployed.add(container.getName()); } catch (Throwable th) { log.error("Cannot deploy arquillian service", th); } } }
: Boolean.parseBoolean(systemExport); if (exportPath != null && event.getDeployment().isArchiveDeployment()) { File exportDir = new File(exportPath); if (exportDir.isFile()) { if (event.getDeployment().testable()) { deployment = event.getDeployment().getTestableArchive(); } else { deployment = event.getDeployment().getArchive(); final File fileToExport = new File(exportDir, createFileName(event.getDeployment(), deployment)); deleteIfExists(fileToExport); exportDir, createFileName(event.getDeployment(), deployment)); } else { deployment.as(ZipExporter.class).exportTo(fileToExport,
public synchronized void doServiceDeploy(@Observes(precedence = 1) BeforeDeploy event, Container container, ServiceArchiveHolder archiveHolder) { // already deployed? if (serviceArchiveDeployed.contains(container.getName())) { archiveHolder.deploymentExistsAndRemove(event.getDeployment().getName()); // cleanup return; } // only deploy the service if the deployment has been enriched by the jmx-as7 protocol if (archiveHolder.deploymentExistsAndRemove(event.getDeployment().getName())) { JavaArchive serviceArchive = (JavaArchive) archiveHolder.getArchive(); try { log.infof("Deploy arquillian service: %s", serviceArchive); final Map<String, String> props = container.getContainerConfiguration().getContainerProperties(); //MASSIVE HACK //write the management connection props to the archive, so we can access them from the server final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bytes); out.writeObject(props.get("managementPort")); out.writeObject(NetworkUtils.formatPossibleIpv6Address(props.get("managementAddress"))); out.writeObject(NetworkUtils.formatPossibleIpv6Address(props.get("managementProtocol"))); out.writeObject(props.get("authenticationConfig")); out.close(); serviceArchive.addAsManifestResource(new ByteArrayAsset(bytes.toByteArray()), "org.jboss.as.managementConnectionProps"); DeployableContainer<?> deployableContainer = container.getDeployableContainer(); deployableContainer.deploy(serviceArchive); serviceArchiveDeployed.add(container.getName()); } catch (Throwable th) { log.error("Cannot deploy arquillian service", th); } } }
public void parsePortletXml(@Observes BeforeDeploy event) { boolean processed = false; Archive applicationArchive = event.getDeployment().getArchive(); TestClass testClass = testClassInstance.get(); for (Field field : testClass.getJavaClass().getDeclaredFields()) { if (field.isAnnotationPresent(PortalURL.class)) { processed = processPortletXml(applicationArchive); if (processed) { break; } } } if (!processed) { for (Method method : testClass.getJavaClass().getDeclaredMethods()) { Annotation[][] methodParameterAnnotations = method.getParameterAnnotations(); for (Annotation[] parameterAnnotations : methodParameterAnnotations) { for (Annotation annotation : parameterAnnotations) { if (annotation instanceof PortalURL) { processed = processPortletXml(applicationArchive); if (processed) { break; } } } } } } }
public synchronized void doServiceDeploy(@Observes BeforeDeploy event, Container container, ServiceArchiveHolder archiveHolder) { // already deployed? if (serviceArchiveDeployed.contains(container.getName())) { archiveHolder.deploymentExistsAndRemove(event.getDeployment().getName()); // cleanup return; } // only deploy the service if the deployment has been enriched by the jmx-as7 protocol if (archiveHolder.deploymentExistsAndRemove(event.getDeployment().getName())) { JavaArchive serviceArchive = (JavaArchive) archiveHolder.getArchive(); try { log.infof("Deploy arquillian service: %s", serviceArchive); final Map<String, String> props = container.getContainerConfiguration().getContainerProperties(); //MASSIVE HACK //write the management connection props to the archive, so we can access them from the server final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bytes); out.writeObject(props.get("managementPort")); out.writeObject(NetworkUtils.formatPossibleIpv6Address(props.get("managementAddress"))); out.close(); serviceArchive.addAsManifestResource(new ByteArrayAsset(bytes.toByteArray()), "org.jboss.as.managementConnectionProps"); DeployableContainer<?> deployableContainer = container.getDeployableContainer(); deployableContainer.deploy(serviceArchive); serviceArchiveDeployed.add(container.getName()); } catch (Throwable th) { log.error("Cannot deploy arquillian service", th); } } }
public void parsePortletXml(@Observes BeforeDeploy event) { boolean processed = false; Archive applicationArchive = event.getDeployment().getArchive(); TestClass testClass = testClassInstance.get(); for (Field field : testClass.getJavaClass().getDeclaredFields()) { if (field.isAnnotationPresent(PortalURL.class)) { processed = processPortletXml(applicationArchive); if (processed) { break; } } } if (!processed) { for (Method method : testClass.getJavaClass().getDeclaredMethods()) { Annotation[][] methodParameterAnnotations = method.getParameterAnnotations(); for (Annotation[] parameterAnnotations : methodParameterAnnotations) { for (Annotation annotation : parameterAnnotations) { if (annotation instanceof PortalURL) { processed = processPortletXml(applicationArchive); if (processed) { break; } } } } } } }
public void onBeforeDeploy(@Observes BeforeDeploy event, AndroidDevice androidDevice) { if (event.getDeployableContainer().getConfigurationClass() != AndroidContainerConfiguration.class) { return; } AndroidDeviceRegister register = androidDeviceRegister.get(); if (register.contains(androidDevice)) { AndroidDeviceMetadata metadata = register.getMetadata(androidDevice); metadata.addDeploymentName(event.getDeployment().getName()); register.put(androidDevice, metadata); } else { throw new IllegalStateException("It seems you are trying to deploy deployment to device which is not ready yet. " + "This should never happen."); } AndroidApplicationManager androidApplicationManager = new AndroidApplicationManager(androidDevice, androidSDK.get()); this.androidApplicationManager.set(androidApplicationManager); }
public void observeBeforeDeploy(@Observes BeforeDeploy event) { DeploymentReport deploymentReport = new DeploymentReport(); DeploymentDescription description = event.getDeployment(); deploymentReport.setArchiveName(description.getArchive().getName()); deploymentReport.setName(description.getName()); int order = description.getOrder(); if (order > 0) { deploymentReport.setOrder(order); } String protocol = description.getProtocol().getName(); if (!protocol.equals("_DEFAULT_")) { deploymentReport.setProtocol(protocol); } else { deploymentReport.setProtocol("_DEFAULT_"); } deploymentReport.setTarget(description.getTarget().getName()); boolean reported = false; for (ContainerReport containerReport : reporter.get().getLastTestSuiteReport().getContainerReports()) { if (containerReport.getQualifier().equals(deploymentReport.getTarget())) { containerReport.getDeploymentReports().add(deploymentReport); reported = true; break; } } if (!reported) { if (reporter.get().getLastTestSuiteReport().getContainerReports().size() == 1) { reporter.get().getLastTestSuiteReport().getContainerReports().get(0).getDeploymentReports().add(deploymentReport); } } }