karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggrzy...@apache.org
Subject [karaf] branch master updated: [KARAF-6159] Allow feature processing in karaf-maven-plugin:verify
Date Fri, 15 Feb 2019 14:32:21 GMT
This is an automated email from the ASF dual-hosted git repository.

ggrzybek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 9965d29  [KARAF-6159] Allow feature processing in karaf-maven-plugin:verify
9965d29 is described below

commit 9965d296351e4c685d331d2eda50572b8d6e825c
Author: Grzegorz Grzybek <gr.grzybek@gmail.com>
AuthorDate: Fri Feb 15 15:32:06 2019 +0100

    [KARAF-6159] Allow feature processing in karaf-maven-plugin:verify
---
 .../java/org/apache/karaf/tooling/VerifyMojo.java   | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
index 7ff8092..5ffc224 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/VerifyMojo.java
@@ -77,6 +77,7 @@ import org.apache.karaf.features.internal.model.Features;
 import org.apache.karaf.features.internal.model.JaxbUtil;
 import org.apache.karaf.features.internal.resolver.ResourceUtils;
 import org.apache.karaf.features.internal.service.Deployer;
+import org.apache.karaf.features.internal.service.FeaturesProcessor;
 import org.apache.karaf.features.internal.service.FeaturesProcessorImpl;
 import org.apache.karaf.features.internal.service.FeaturesServiceConfig;
 import org.apache.karaf.features.internal.service.State;
@@ -122,6 +123,9 @@ public class VerifyMojo extends MojoSupport {
     @Parameter(property = "blacklistedDescriptors")
     protected Set<String> blacklistedDescriptors;
 
+    @Parameter(property = "featureProcessingInstructions")
+    protected File featureProcessingInstructions;
+
     @Parameter(property = "features")
     protected List<String> features;
 
@@ -331,9 +335,15 @@ public class VerifyMojo extends MojoSupport {
         }
         Set<String> successes = new LinkedHashSet<>();
         Set<String> ignored = new LinkedHashSet<>();
+        Set<String> skipped = new LinkedHashSet<>();
         Map<String, Exception> failures = new LinkedHashMap<>();
         for (Feature feature : featuresToTest) {
             String id = feature.getId();
+            if (feature.isBlacklisted()) {
+                skipped.add(id);
+                getLog().info("Verification of feature " + id + " skipped");
+                continue;
+            }
             try {
                 verifyResolution(new CustomDownloadManager(resolver, executor),
                                  repositories, Collections.singleton(id), properties);
@@ -389,7 +399,7 @@ public class VerifyMojo extends MojoSupport {
             }
         }
         int nb = successes.size() + ignored.size() + failures.size();
-        getLog().info("Features verified: " + nb + ", failures: " + failures.size() + ",
ignored: " + ignored.size());
+        getLog().info("Features verified: " + nb + ", failures: " + failures.size() + ",
ignored: " + ignored.size() + ", skipped: " + skipped.size());
         if (!failures.isEmpty()) {
             getLog().info("Failures: " + String.join(", ", failures.keySet()));
         }
@@ -570,7 +580,13 @@ public class VerifyMojo extends MojoSupport {
         final Map<String, Features> loaded = new HashMap<>();
         final Downloader downloader = manager.createDownloader();
 
-        FeaturesProcessorImpl processor = new FeaturesProcessorImpl(new FeaturesServiceConfig());
+        FeaturesServiceConfig config = null;
+        if (featureProcessingInstructions != null) {
+            config = new FeaturesServiceConfig(featureProcessingInstructions.toURI().toString(),
null);
+        } else {
+            config = new FeaturesServiceConfig();
+        }
+        FeaturesProcessorImpl processor = new FeaturesProcessorImpl(config);
         if (blacklistedDescriptors != null) {
             blacklistedDescriptors.forEach(lp -> {
                 processor.getInstructions().getBlacklistedRepositoryLocationPatterns()
@@ -587,6 +603,7 @@ public class VerifyMojo extends MojoSupport {
                     public void downloaded(final StreamProvider provider) throws Exception
{
                         try (InputStream is = provider.open()) {
                             Features featuresModel = JaxbUtil.unmarshal(provider.getUrl(),
is, false);
+                            processor.process(featuresModel);
                             synchronized (loaded) {
                                 loaded.put(provider.getUrl(), featuresModel);
                                 for (String innerRepository : featuresModel.getRepository())
{


Mime
View raw message