org.jboss.arquillian.test.spi.TestClass Java Examples
The following examples show how to use
org.jboss.arquillian.test.spi.TestClass.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SmallRyeGraphQLArchiveProcessor.java From smallrye-graphql with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> applicationArchive, TestClass testClass) { if (applicationArchive instanceof WebArchive) { WebArchive testDeployment = (WebArchive) applicationArchive; final File[] dependencies = Maven.resolver() .loadPomFromFile("pom.xml") .resolve("io.smallrye:smallrye-graphql-servlet") .withTransitivity() .asFile(); // Make sure it's unique Set<File> dependenciesSet = new LinkedHashSet<>(Arrays.asList(dependencies)); testDeployment.addAsLibraries(dependenciesSet.toArray(new File[] {})); } }
Example #2
Source File: SmallRyeHealthArchiveProcessor.java From smallrye-health with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> applicationArchive, TestClass testClass) { if (applicationArchive instanceof WebArchive) { WebArchive testDeployment = (WebArchive) applicationArchive; // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism testDeployment.addClass(SmallRyeBeanArchiveHandler.class); testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class); String[] deps = { "io.smallrye:smallrye-health", "io.smallrye.config:smallrye-config", "io.smallrye:smallrye-health-tck", "org.eclipse.microprofile.health:microprofile-health-tck", "org.jboss.weld.servlet:weld-servlet-core" }; File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity() .asFile(); testDeployment.addAsLibraries(dependencies); } }
Example #3
Source File: DeploymentProcessor.java From quarkus with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { if (archive instanceof WebArchive) { WebArchive war = WebArchive.class.cast(archive); // enable tracing on the client side war.addAsServiceProvider(ClientTracingRegistrarProvider.class, ResteasyClientTracingRegistrarProvider.class); war.addClasses(ResteasyClientTracingRegistrarProvider.class); // override the default TracerProducer war.addClass(MockTracerProducer.class); // workaround for RESTEASY-1758 war.addClass(ExceptionMapper.class); } }
Example #4
Source File: SmallRyeHealthArchiveProcessor.java From smallrye-health with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> applicationArchive, TestClass testClass) { if (applicationArchive instanceof WebArchive) { WebArchive testDeployment = (WebArchive) applicationArchive; // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism testDeployment.addClass(SmallRyeBeanArchiveHandler.class); testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class); String[] deps = { "io.smallrye:smallrye-health", "io.smallrye.config:smallrye-config", "io.smallrye:smallrye-health-tck", "org.eclipse.microprofile.health:microprofile-health-tck", "org.jboss.weld.servlet:weld-servlet-core" }; File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity() .asFile(); testDeployment.addAsLibraries(dependencies); } }
Example #5
Source File: CommonTomcatDeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { if (DeploymentArchiveProcessorUtils.checkRunOnServerDeployment(archive)) return; modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH); DeploymentArchiveProcessorUtils.SAML_CONFIGS.forEach(path -> modifySAMLAdapterConfig(archive, path)); TomcatDeploymentArchiveProcessorUtils.copyWarClasspathFilesToCommonTomcatClasspath(archive); // KEYCLOAK-9606 - might be unnecessary, however for now we need to test what is in docs TomcatDeploymentArchiveProcessorUtils.replaceKEYCLOAKMethodWithBASIC(archive); if (containsSAMLAdapterConfig(archive)) { TomcatDeploymentArchiveProcessorUtils.replaceOIDCValveWithSAMLValve(archive); } if (TomcatDeploymentArchiveProcessorUtils.isJaxRSApp(archive)) { TomcatDeploymentArchiveProcessorUtils.removeServletConfigurationInWebXML(archive); if (!TomcatDeploymentArchiveProcessorUtils.containsApplicationConfigClass(archive)) { ((WebArchive) archive).addClass(TomcatConfigApplication.class); } } }
Example #6
Source File: Tomcat7DeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { super.process(archive, testClass); if (DeploymentArchiveProcessorUtils.checkRunOnServerDeployment(archive)) return; Set<Class<?>> configClasses = TomcatDeploymentArchiveProcessorUtils.getApplicationConfigClasses(archive); if (!configClasses.isEmpty()) { // Tomcat 7 doesn't work with resteasy-servlet-initializer therefore we need to configure Tomcat the old way // jax-rs docs: http://docs.jboss.org/resteasy/docs/3.6.1.Final/userguide/html_single/#d4e161 Document webXmlDoc; try { webXmlDoc = IOUtil.loadXML( archive.get(WEBXML_PATH).getAsset().openStream()); } catch (Exception ex) { throw new RuntimeException("Error when processing " + archive.getName(), ex); } addContextParam(webXmlDoc); addServlet(webXmlDoc, configClasses.iterator().next().getName()); addServletMapping(webXmlDoc); archive.add(new StringAsset((documentToString(webXmlDoc))), DeploymentArchiveProcessorUtils.WEBXML_PATH); } }
Example #7
Source File: ConfigApplicationArchiveProcessor.java From quarkus with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> applicationArchive, TestClass testClass) { if (applicationArchive instanceof WebArchive) { WebArchive war = applicationArchive.as(WebArchive.class); Node libNode = war.get(PATH_LIBRARY); if (libNode != null) { for (Node child : libNode.getChildren()) { Asset childAsset = child.getAsset(); if (childAsset instanceof ArchiveAsset) { ArchiveAsset archiveAsset = (ArchiveAsset) childAsset; if (archiveAsset.getArchive() instanceof JavaArchive) { JavaArchive libArchive = (JavaArchive) archiveAsset.getArchive(); libArchive.deleteClass(testClass.getName()); } } } } } }
Example #8
Source File: BaseWarArchiveProcessor.java From microprofile-jwt-auth with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> appArchive, TestClass testClass) { if (!(appArchive instanceof WebArchive)) { return; } log.info("Preparing archive: "+appArchive); WebArchive war = WebArchive.class.cast(appArchive); // Add WEB-INF resources String[] webInfRes = getWebInfResources(); for(String resName : webInfRes) { war.addAsWebInfResource(resName); } // Add WEB-INF/lib libraries String[] artifactNames = getWebInfLibArtifacts(); // TODO; use shrinkwrap resolvers for (String mvnArtifact: artifactNames) { // Resolve this artifact... } }
Example #9
Source File: RestClientArchiveProcessor.java From thorntail with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> appArchive, TestClass testClass) { if (!(appArchive instanceof WebArchive)) { return; } log.info("Preparing archive: " + appArchive); WARArchive war = appArchive.as(WARArchive.class); PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile("pom.xml"); // Wiremock classes that need to be present File[] wiremockDeps = pom .resolve("com.github.tomakehurst:wiremock") .withTransitivity() .asFile(); war.addAsLibraries(wiremockDeps); // TCK Classes that need to present war.addPackages(true, "org.eclipse.microprofile.rest.client.tck.ext"); log.fine("Augmented war: \n" + war.toString(true)); }
Example #10
Source File: RedmineGovernorRecorder.java From arquillian-governor with Apache License 2.0 | 6 votes |
public void redmineReportEntries(@Observes After event) { final Method testMethod = event.getTestMethod(); final TestClass testClass = event.getTestClass(); final String redmineServerURL = redmineGovernorConfigurationInstance.get().getServer(); final Redmine redmineValue = getRedmineValue(testMethod, testClass); if (redmineValue != null) { final String issueURL = constructRedmineIssueURL(redmineServerURL, redmineValue.value()); final TableEntry redmineDetector = new TableEntry(); redmineDetector.setTableName("RedmineOptions"); redmineDetector.getTableHead().getRow().addCells(new TableCellEntry("Force")); final TableRowEntry row = new TableRowEntry(); row.addCells(new TableCellEntry(String.valueOf(redmineValue.force()))); redmineDetector.getTableBody().addRow(row); propertyReportEvent.fire(new PropertyReportEvent(new KeyValueEntry("Redmine URL", issueURL))); propertyReportEvent.fire(new PropertyReportEvent(redmineDetector)); } }
Example #11
Source File: TestObserver.java From tomee with Apache License 2.0 | 6 votes |
private BeanContext beanContext() { final TestClass tc = testClass.get(); if (tc == null) { return null; } final String className = tc.getName(); final ContainerSystem containerSystem = SystemInstance.get().getComponent(ContainerSystem.class); for (final AppContext app : containerSystem.getAppContexts()) { final BeanContext context = containerSystem.getBeanContext(app.getId() + "_" + className); if (context != null) { return context; } } return null; }
Example #12
Source File: DeploymentTargetModifier.java From keycloak with Apache License 2.0 | 6 votes |
private void checkTestDeployments(List<DeploymentDescription> descriptions, TestClass testClass, boolean isAdapterTest) { for (DeploymentDescription deployment : descriptions) { if (deployment.getTarget() != null) { String containerQualifier = deployment.getTarget().getName(); if (AUTH_SERVER_CURRENT.equals(containerQualifier) || (!isAdapterTest && "_DEFAULT_".equals(containerQualifier))) { String newAuthServerQualifier = AuthServerTestEnricher.AUTH_SERVER_CONTAINER; updateServerQualifier(deployment, testClass, newAuthServerQualifier); } else if (containerQualifier.contains(APP_SERVER_CURRENT)) { String suffix = containerQualifier.split(APP_SERVER_CURRENT)[1]; String newAppServerQualifier = ContainerConstants.APP_SERVER_PREFIX + AppServerTestEnricher.CURRENT_APP_SERVER + "-" + suffix; updateServerQualifier(deployment, testClass, newAppServerQualifier); } else { String newServerQualifier = StringPropertyReplacer.replaceProperties(containerQualifier); if (!newServerQualifier.equals(containerQualifier)) { updateServerQualifier(deployment, testClass, newServerQualifier); } } } } }
Example #13
Source File: FileAutomaticDeployment.java From arquillian-container-chameleon with Apache License 2.0 | 6 votes |
@Override protected Archive<?> build(TestClass testClass) { if (testClass.isAnnotationPresent(File.class)) { final File file = testClass.getAnnotation(File.class); final String location = file.value(); java.io.File archiveLocation = new java.io.File(location); if (!archiveLocation.isAbsolute()) { String rootPath = Paths.get(".").toAbsolutePath().toString(); archiveLocation = new java.io.File(rootPath, location); } return ShrinkWrap .create(ZipImporter.class, getArchiveName(location)) .importFrom(archiveLocation) .as(file.type()); } return null; }
Example #14
Source File: DeploymentConfigurationPopulatorTest.java From arquillian-container-chameleon with Apache License 2.0 | 6 votes |
@Test public void should_generate_deployment_custom_content() { // given // when final DeploymentConfiguration deploymentConfiguration = DeploymentConfigurationPopulator.populate(new TestClass(ParametrizedConfigurationTest.class), archive).get(); // then softly.assertThat(deploymentConfiguration.getArchive()).isEqualTo(archive); softly.assertThat(deploymentConfiguration.getOverProtocol().value()).isEqualTo("https"); softly.assertThat(deploymentConfiguration.getDescriptor()).isNull(); softly.assertThat(deploymentConfiguration.getShouldThrowException()).isNull(); softly.assertThat(deploymentConfiguration.getTargets().value()).isEqualTo("container"); final Deployment deployment = deploymentConfiguration.getDeployment(); softly.assertThat(deployment.managed()).isFalse(); softly.assertThat(deployment.order()).isEqualTo(1); softly.assertThat(deployment.testable()).isFalse(); }
Example #15
Source File: DeploymentConfigurationPopulatorTest.java From arquillian-container-chameleon with Apache License 2.0 | 6 votes |
@Test public void should_generate_default_deployment_content() { // given // when final DeploymentConfiguration deploymentConfiguration = DeploymentConfigurationPopulator.populate(new TestClass(DefaultConfigurationTest.class), archive).get(); // then softly.assertThat(deploymentConfiguration.getArchive()).isEqualTo(archive); softly.assertThat(deploymentConfiguration.getOverProtocol()).isNull(); softly.assertThat(deploymentConfiguration.getDescriptor()).isNull(); softly.assertThat(deploymentConfiguration.getShouldThrowException()).isNull(); softly.assertThat(deploymentConfiguration.getTargets()).isNull(); final Deployment deployment = deploymentConfiguration.getDeployment(); softly.assertThat(deployment.managed()).isTrue(); softly.assertThat(deployment.order()).isEqualTo(-1); softly.assertThat(deployment.testable()).isTrue(); }
Example #16
Source File: WindupFurnaceAddonDeploymentEnhancer.java From windup with Eclipse Public License 1.0 | 6 votes |
@Override public List<DeploymentDescription> enhance(TestClass testClass, List<DeploymentDescription> deployments) { if(Boolean.getBoolean("maven.surefire.debug")) { String version = getWindupVersion(deployments); if(version != null) { // AddonId id = AddonId.from("org.jboss.windup.rexster:windup-rexster", version); // AddonDeploymentArchive archive = ShrinkWrap.create(AddonDeploymentArchive.class).setAddonId(id); // // archive.setDeploymentTimeoutUnit(TimeUnit.MILLISECONDS); // archive.setDeploymentTimeoutQuantity(10000); // // DeploymentDescription deploymentDescription = new DeploymentDescription(id.toCoordinates(), archive); // deploymentDescription.shouldBeTestable(false); // deployments.add(deploymentDescription); } } return deployments; }
Example #17
Source File: EAP6DeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 6 votes |
private void modifyWebXML(Archive<?> archive, TestClass testClass) { if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return; if (testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class) && archive.contains(DeploymentArchiveProcessorUtils.JBOSS_DEPLOYMENT_XML_PATH)) { log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter."); DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass); DeploymentArchiveProcessorUtils.addFilterDependencies(archive, testClass); } try { Document webXmlDoc = IOUtil.loadXML(archive.get(DeploymentArchiveProcessorUtils.WEBXML_PATH).getAsset().openStream()); IOUtil.modifyDocElementValue(webXmlDoc, "param-value", ".*infinispan\\.InfinispanSessionCacheIdMapperUpdater", "org.keycloak.adapters.saml.jbossweb.infinispan.InfinispanSessionCacheIdMapperUpdater"); archive.add(new StringAsset((IOUtil.documentToString(webXmlDoc))), WEBXML_PATH); } catch (IllegalArgumentException ex) { throw new RuntimeException("Error when processing " + archive.getName(), ex); } }
Example #18
Source File: HammockArchiveAppender.java From hammock with Apache License 2.0 | 6 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { EnableRandomWebServerPort annotation = testClass.getJavaClass().getAnnotation(EnableRandomWebServerPort.class); JavaArchive jar = archive.as(JavaArchive.class) .addPackage("io.astefanutti.metrics.cdi") .addAsResource(TOMCAT_BASE, "hammock.properties") .addAsManifestResource(BEANS_XML, "beans.xml"); if(annotation != null) { if (annotation.enableSecure()) { jar.addAsServiceProviderAndClasses(ConfigSource.class, RandomWebServerPort.class, RandomWebServerSecuredPort.class); } else { jar.addAsServiceProviderAndClasses(ConfigSource.class, RandomWebServerPort.class); } } }
Example #19
Source File: SuiteDeployer.java From arquillian-suite-extension with Apache License 2.0 | 6 votes |
/** * Startup event. * * @param event AfterStart event to catch */ public void startup(@Observes(precedence = -100) final BeforeSuite event) { if (extensionEnabled()) { debug("Catching BeforeSuite event {0}", event.toString()); executeInClassScope(new Callable<Void>() { @Override public Void call() { generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass))); suiteDeploymentScenario = classDeploymentScenario.get(); return null; } }); deployDeployments = true; extendedSuiteContext.get().activate(); suiteDeploymentScenarioInstanceProducer.set(suiteDeploymentScenario); } }
Example #20
Source File: DeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 6 votes |
public void addFilterDependencies(Archive<?> archive, TestClass testClass) { TestContext testContext = testContextProducer.get(); if (testContext.getAppServerInfo().isUndertow()) { return; } Node jbossDeploymentStructureXml = archive.get(JBOSS_DEPLOYMENT_XML_PATH); if (jbossDeploymentStructureXml == null) { log.debug("Archive doesn't contain " + JBOSS_DEPLOYMENT_XML_PATH); return; } log.info("Adding filter dependencies to " + archive.getName()); String dependency = testClass.getAnnotation(UseServletFilter.class).filterDependency(); ((WebArchive) archive).addAsLibraries(KeycloakDependenciesResolver.resolveDependencies((dependency + ":" + System.getProperty("project.version")))); Document jbossXmlDoc = loadXML(jbossDeploymentStructureXml.getAsset().openStream()); removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-saml-core"); removeNodeByAttributeValue(jbossXmlDoc, "dependencies", "module", "name", "org.keycloak.keycloak-adapter-spi"); archive.add(new StringAsset((documentToString(jbossXmlDoc))), JBOSS_DEPLOYMENT_XML_PATH); }
Example #21
Source File: UndertowDeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 5 votes |
private void modifyWebXML(Archive<?> archive, TestClass testClass) { if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return; if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return; log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter."); DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass); }
Example #22
Source File: JettyDeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { if (DeploymentArchiveProcessorUtils.checkRunOnServerDeployment(archive)) return; if (!System.getProperty("app.server", "jetty").contains("jetty")) return; modifyWebXML(archive, testClass); modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH); modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH); modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH_TENANT1); modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH_TENANT2); modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH_JS); }
Example #23
Source File: WildflyDeprecatedDeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { if (DeploymentArchiveProcessorUtils.checkRunOnServerDeployment(archive)) { return; } modifyWebXML(archive, testClass); modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH); modifyOIDCAdapterConfig(archive, DeploymentArchiveProcessorUtils.ADAPTER_CONFIG_PATH_JS); modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH); modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH_TENANT1); modifySAMLAdapterConfig(archive, DeploymentArchiveProcessorUtils.SAML_ADAPTER_CONFIG_PATH_TENANT2); }
Example #24
Source File: ConfigArchiveAppender.java From hammock with Apache License 2.0 | 5 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { if (archive instanceof WebArchive) { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "geronimo-config.jar") .addPackages(true, ConfigImpl.class.getPackage()) .addAsServiceProvider(Converter.class, DuckConverter.class) .addAsServiceProvider(ConfigProviderResolver.class, DefaultConfigProvider.class) .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); archive.as(WebArchive.class).addAsLibrary(jar); } }
Example #25
Source File: WildflyDeprecatedDeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 5 votes |
private void modifyWebXML(Archive<?> archive, TestClass testClass) { if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return; if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return; if (!archive.contains(DeploymentArchiveProcessorUtils.JBOSS_DEPLOYMENT_XML_PATH)) return; log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter."); DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass); DeploymentArchiveProcessorUtils.addFilterDependencies(archive, testClass); }
Example #26
Source File: DefaultFileNameBuilderTest.java From arquillian-recorder with Apache License 2.0 | 5 votes |
@Test public void builderIsClearedAfterBuildTest() throws NoSuchMethodException, SecurityException { FakeResourceMetaData fmd = new FakeResourceMetaData(); fmd.setTestClass(new TestClass(FakeTestClass.class)).setTestMethod(FakeTestClass.class.getMethod("fakeTestMethod")); fileNameBuilder.withStage(When.AFTER).withMetaData(fmd); Assert.assertEquals("fakeTestMethod_after", fileNameBuilder.build()); // subsequent built is done on cleaned builder so it will produce just UUID UUID.fromString(fileNameBuilder.build()); }
Example #27
Source File: ScreenshooterLifecycleObserver.java From arquillian-recorder with Apache License 2.0 | 5 votes |
private BlurLevel resolveBlurLevel(TestEvent event) { if (event.getTestMethod().getAnnotation(Blur.class) != null) { return event.getTestMethod().getAnnotation(Blur.class).value(); } else { Class<? extends TestClass> testClass = event.getTestClass().getClass(); Class<?> annotatedClass = ReflectionUtil.getClassWithAnnotation(testClass, Blur.class); BlurLevel blurLevel = null; if (annotatedClass != null) { blurLevel = annotatedClass .getAnnotation(Blur.class).value(); } return blurLevel; } }
Example #28
Source File: JettyDeploymentArchiveProcessor.java From keycloak with Apache License 2.0 | 5 votes |
private void modifyWebXML(Archive<?> archive, TestClass testClass) { if (!archive.contains(DeploymentArchiveProcessorUtils.WEBXML_PATH)) return; if (!testClass.getJavaClass().isAnnotationPresent(UseServletFilter.class)) return; log.debug("Modifying WEB.XML in " + archive.getName() + " for Servlet Filter."); DeploymentArchiveProcessorUtils.modifyWebXMLForServletFilter(archive, testClass); }
Example #29
Source File: HammockArchiveAppender.java From hammock with Apache License 2.0 | 5 votes |
@Override public void process(Archive<?> archive, TestClass testClass) { if (archive instanceof WebArchive) { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "hammock.jar") .addPackages(true, "ws.ament.hammock") .addPackage("io.astefanutti.metrics.cdi") .addAsManifestResource(BEANS_XML, "beans.xml"); archive.as(WebArchive.class).addAsLibrary(jar); } else { archive.as(JavaArchive.class).addPackages(true, "ws.ament.hammock"); } }
Example #30
Source File: AbstractApplicationArchiveProcessor.java From appengine-tck with Apache License 2.0 | 5 votes |
public void process(Archive<?> archive, TestClass testClass) { if (archive instanceof EnterpriseArchive) { final EnterpriseArchive ear = (EnterpriseArchive) archive; Map<ArchivePath, Node> wars = ear.getContent(Filters.include(".*\\.war")); for (Map.Entry<ArchivePath, Node> war : wars.entrySet()) { handleWebArchive(ear.getAsType(WebArchive.class, war.getKey())); } } else if (archive instanceof WebArchive) { handleWebArchive((WebArchive) archive); } else { throw new IllegalArgumentException("Can only handle .ear or .war deployments: " + archive); } }