Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
test: exclude unit test inner classes from Arquillian
Browse files Browse the repository at this point in the history
  • Loading branch information
seanf committed Apr 5, 2016
1 parent 875c58d commit 72e3a9a
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions zanata-war/src/test/java/org/zanata/arquillian/Deployments.java
Expand Up @@ -28,12 +28,14 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.function.Consumer;

import com.google.common.base.Joiner;
import org.apache.deltaspike.core.api.projectstage.ProjectStage;
import org.apache.deltaspike.core.util.ProjectStageProducer;
import org.jboss.arquillian.container.test.api.Deployment;
Expand Down Expand Up @@ -105,13 +107,6 @@ public static Archive<?> createDeployment() {
// as a class file)
return !object.get().startsWith("/org/zanata/model/") &&
!object.get().startsWith("/org/zanata/util/RequestContextValueStore") &&
!object.get().startsWith("/org/zanata/seam/AutowireContexts") &&
!object.get().startsWith("/org/zanata/seam/AutowireInstance") &&
!object.get().startsWith("/org/zanata/seam/AutowireTransaction") &&
!object.get().startsWith("/org/zanata/seam/FieldComponentAccessor") &&
!object.get().startsWith("/org/zanata/seam/MethodComponentAccessor") &&
!object.get().startsWith("/org/zanata/seam/SeamAutowire") &&
!object.get().startsWith("/org/zanata/seam/test") &&
notUnusedGwtClientCode(object) &&
notUnitTest(object);
};
Expand Down Expand Up @@ -143,10 +138,16 @@ public static Archive<?> createDeployment() {

addRemoteHelpers(archive);

// Export (to actually see what is being deployed)
// archive.as(ZipExporter.class).exportTo(new
// File("/home/pahuang/temp/archive.war"), true);
// uncomment to see what will be in the war
// ArrayList<ArchivePath> paths =
// new ArrayList<>(archive.getContent().keySet());
// Collections.sort(paths);
// String contents = " " + Joiner.on("\n ").join(paths);
// System.out.println(contents);

// Export (to actually see what is being deployed)
// archive.as(ZipExporter.class).exportTo(
// new File("/tmp/zanata-arquillian.war"), true);
return archive;
}

Expand Down Expand Up @@ -200,7 +201,10 @@ private static boolean notUnitTest(ArchivePath object) {
|| context.contains("RestTest")
|| context.contains("TestAsyncBean")
|| context.contains("ResourceTestObjectFactory")
|| !context.matches(".+Test(s)?\\.class$");
// unit test classes
|| !(context.matches(".+Test(s)?\\.class$") ||
// inner classes of unit test classes
context.matches(".+Test(s)?\\$.*\\.class$"));
}

private static boolean notUnusedGwtClientCode(ArchivePath object) {
Expand Down

0 comments on commit 72e3a9a

Please sign in to comment.