From 396262634e86aad490df4b43150f3c903c60973f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Sun, 10 Nov 2024 13:35:37 +0100 Subject: [PATCH] Add testcase for conditional packages with bnd-process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a testacse where conditional package is used with bnd-process Signed-off-by: Christoph Läubrich --- .../src/it/bnd-process-conditional/README.txt | 5 +++ .../invoker.properties | 7 ++++ .../src/it/bnd-process-conditional/other.bnd | 1 + .../src/it/bnd-process-conditional/pom.xml | 37 +++++++++++++++++++ .../bnd-process-conditional/postbuild.groovy | 6 +++ .../main/java/org/example/impl/Config.java | 13 +++++++ 6 files changed, 69 insertions(+) create mode 100644 maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/README.txt create mode 100644 maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/invoker.properties create mode 100644 maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/other.bnd create mode 100644 maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/pom.xml create mode 100644 maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/postbuild.groovy create mode 100644 maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/src/main/java/org/example/impl/Config.java diff --git a/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/README.txt b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/README.txt new file mode 100644 index 0000000000..d2de030cdb --- /dev/null +++ b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/README.txt @@ -0,0 +1,5 @@ +This is an example bundle that used bnd-process together with conditional package. + +Points of interest: + +* the conditional packages apaer in the maven output folder diff --git a/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/invoker.properties b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/invoker.properties new file mode 100644 index 0000000000..9c7a7746f7 --- /dev/null +++ b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/invoker.properties @@ -0,0 +1,7 @@ +invoker.goals=--no-transfer-progress package + +# Run mvn with --debug for debug logging +#invoker.debug=true + +# Run mvn in debugging mode and wait for a debugger to attach +#invoker.environmentVariables.MAVEN_DEBUG_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 diff --git a/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/other.bnd b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/other.bnd new file mode 100644 index 0000000000..33ddcaec20 --- /dev/null +++ b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/other.bnd @@ -0,0 +1 @@ +-conditionalpackage: com.google.common.cache \ No newline at end of file diff --git a/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/pom.xml b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/pom.xml new file mode 100644 index 0000000000..e371012bd5 --- /dev/null +++ b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + + biz.aQute.bnd-test + test + 0.0.2 + ../process-parent + + test-bnd-process-conditional + 0.0.1-SNAPSHOT + + + Apache License, Version 2.0 + http://www.opensource.org/licenses/apache2.0.php + repo + + + + + com.google.guava + guava + 32.0.1-jre + + + + + + + biz.aQute.bnd + bnd-maven-plugin + + + + + diff --git a/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/postbuild.groovy b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/postbuild.groovy new file mode 100644 index 0000000000..f3df74b995 --- /dev/null +++ b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/postbuild.groovy @@ -0,0 +1,6 @@ +import java.util.jar.JarFile; +import java.util.jar.JarEntry + +JarFile jar = new JarFile( new File(basedir, 'target/test-bnd-process-conditional-0.0.1-SNAPSHOT.jar')) +JarEntry entry = jar.getEntry('com/google/common/cache/Cache.class') +assert entry != null \ No newline at end of file diff --git a/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/src/main/java/org/example/impl/Config.java b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/src/main/java/org/example/impl/Config.java new file mode 100644 index 0000000000..582bfed795 --- /dev/null +++ b/maven-plugins/bnd-maven-plugin/src/it/bnd-process-conditional/src/main/java/org/example/impl/Config.java @@ -0,0 +1,13 @@ +package org.example.impl; + +import java.util.concurrent.TimeUnit; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; + +public class Config { + public static void main(String[] args) { + Cache myCache = CacheBuilder.newBuilder().maximumSize(100) + .expireAfterWrite(30, TimeUnit.SECONDS).build(); + } +}