Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing up the SW archives a bit to use the actual jar on the CP

  • Loading branch information...
commit e39cf97e789b9afd134f529945f8336850537620 1 parent 2820780
@LightGuard authored
View
25 ...src/test/java/org/apache/deltaspike/test/core/api/temptestutil/ShrinkWrapArchiveUtil.java
@@ -25,6 +25,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -97,8 +98,28 @@ private static JavaArchive createArchive(URL foundFile, String markerFile,
String jarUrlPath = isJarUrl(urlString);
if (jarUrlPath != null)
{
- return addJarArchive((new URL(ensureCorrectUrlFormat(jarUrlPath))).openStream(),
- includeIfPackageExists, excludeIfPackageExists);
+ final JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(URI.create(jarUrlPath)));
+
+ if (excludeIfPackageExists != null)
+ {
+ for (String excludePackage : excludeIfPackageExists)
+ {
+ if (foundJar.contains(excludePackage.replaceAll("\\.", "\\/"))) {
+ return null;
+ }
+ }
+ }
+ if (includeIfPackageExists != null)
+ {
+ for (String includePackage : includeIfPackageExists)
+ {
+ if (foundJar.contains(includePackage.replaceAll("\\.", "\\/")))
+ {
+ return foundJar;
+ }
+ }
+ }
+ return null; // couldn't find any jar
}
else
{
View
25 ...es/security/impl/src/test/java/org/apache/deltaspike/test/util/ShrinkWrapArchiveUtil.java
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -95,8 +96,28 @@ private static JavaArchive createArchive(URL foundFile, String markerFile,
String jarUrlPath = isJarUrl(urlString);
if (jarUrlPath != null)
{
- return addJarArchive((new URL(ensureCorrectUrlFormat(jarUrlPath))).openStream(),
- includeIfPackageExists, excludeIfPackageExists);
+ final JavaArchive foundJar = ShrinkWrap.createFromZipFile(JavaArchive.class, new File(URI.create(jarUrlPath)));
+
+ if (excludeIfPackageExists != null)
+ {
+ for (String excludePackage : excludeIfPackageExists)
+ {
+ if (foundJar.contains(excludePackage.replaceAll("\\.", "\\/"))) {
+ return null;
+ }
+ }
+ }
+ if (includeIfPackageExists != null)
+ {
+ for (String includePackage : includeIfPackageExists)
+ {
+ if (foundJar.contains(includePackage.replaceAll("\\.", "\\/")))
+ {
+ return foundJar;
+ }
+ }
+ }
+ return null; // couldn't find any jar
}
else
{
Please sign in to comment.
Something went wrong with that request. Please try again.