Skip to content

Commit

Permalink
Merge pull request #2743 from mkouba/mp-config-tck-fix
Browse files Browse the repository at this point in the history
MP Config TCK - fix a regression caused by #2629
  • Loading branch information
geoand committed Jun 11, 2019
2 parents e9cba5f + 126b7b6 commit ca52194
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 6 deletions.
22 changes: 22 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,25 @@ jobs:
jdkVersionOption: '1.11'
goals: 'install'
options: '-B --settings azure-mvn-settings.xml -Dno-native -Dno-format'

- job: Run_TCKs
timeoutInMinutes: 45
pool:
vmImage: 'Ubuntu 16.04'

variables:
imageName: 'quarkus:$(build.buildId)'

steps:

- task: Maven@3
displayName: 'Maven Install'
inputs:
goals: 'install'
options: '-B --settings azure-mvn-settings.xml -Dno-native -Dno-format -DskipTests -Dtcks'

- task: Maven@3
displayName: 'Maven Verify'
inputs:
goals: 'verify'
mavenPomFile: 'tcks/pom.xml'
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package io.quarkus.tck.config;

import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.test.spi.TestClass;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Node;
import org.jboss.shrinkwrap.api.asset.ArchiveAsset;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;

/**
* Arquillian automatically adds the test class to a test deployment. However, some MP Config tests do add the test class to a
* library jar too. As a result, we get ambiguous dependency when trying to instantiate the test class. Unfortunately, we can't
* use an ApplicationArchiveProcessor to remove the test class added by Arquillian because it's applied
* before the test class is added. Therefore, we deciced to remove the test class from any library jar.
*/
public class ConfigApplicationArchiveProcessor implements ApplicationArchiveProcessor {

private static final ArchivePath PATH_LIBRARY = ArchivePaths.create("WEB-INF/lib");

@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());
}
}
}
}
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.quarkus.tck.config;

import org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor;
import org.jboss.arquillian.core.spi.LoadableExtension;

public class ConfigExtension implements LoadableExtension {

@Override
public void register(ExtensionBuilder builder) {
builder.service(ApplicationArchiveProcessor.class, ConfigApplicationArchiveProcessor.class);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.quarkus.tck.config.ConfigExtension

0 comments on commit ca52194

Please sign in to comment.