You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2018/04/27 09:57:16 UTC

[sling-org-apache-sling-feature-applicationbuilder] branch master created (now cc73548)

This is an automated email from the ASF dual-hosted git repository.

davidb pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git.


      at cc73548  User felix util manifest Parser instead of sling commons.osgi one.

This branch includes the following new commits:

     new bb26356  Move feature model to whiteboard git
     new 6044d7f  Update the example to work with the latest changes in the mvn url vs id parsing.
     new a61639c  Start changing start level handling to start order handling
     new f77bb7f  SLING-7512 Order features based on their dependencies.
     new 9c766e8  Update to parent pom 33
     new efcb9d3  SLING-7521 Order bundles in the generated app based on feature order and start order
     new 073087e  Update the comparison method for generated Application JSON
     new a0f92b4  [Feature Model] Support separate phases for reading variables
     new a3c3814  Support variables in converting from features to provisioning model
     new fcfbd88  Move the process package from the feature api module to the support one.
     new 449e26b  Move resolving to separate package
     new 8d06a46  Remove resolver usage from application builder
     new 477bbe4  Move artifact handling to separate package
     new 4574ee8  Include new artifacts in the feature-appplicationbuilder
     new 482a5bc  Rename process package to builder
     new 4d643d5  Rename packages
     new 058c418  Refactor to use Capabilities and Requirements from Felix utils project
     new 31db881  [Sling Feature Model] Split off IO packages into separate module.
     new 84f1151  [Sling Feature Model] Refactor FeatureUtil out of the support module
     new c066892  Use felix utils ResourceBuilder and Parser instead of the ManifestParser and ManifestUtil. As with that the feature-support module is empty, remove it.
     new cc73548  User felix util manifest Parser instead of sling commons.osgi one.

The 21 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 09/21: Support variables in converting from features to provisioning model

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit a3c381478248f0b17a03b115d0cc08725495ed00
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Tue Mar 20 10:46:52 2018 +0000

    Support variables in converting from features to provisioning model
---
 .../sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 9d84329..6efa834 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -29,7 +29,7 @@ import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.json.FeatureJSONReader;
-import org.apache.sling.feature.support.json.FeatureJSONReader.Phase;
+import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -156,7 +156,7 @@ public class ApplicationBuilderTest {
         final ArtifactHandler featureArtifact = artifactManager.getArtifactHandler(file);
 
         try (final FileReader r = new FileReader(featureArtifact.getFile())) {
-            final Feature f = FeatureJSONReader.read(r, featureArtifact.getUrl(), Phase.RESOLVE);
+            final Feature f = FeatureJSONReader.read(r, featureArtifact.getUrl(), SubstituteVariables.RESOLVE);
             return f;
         }
     }

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 01/21: Move feature model to whiteboard git

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit bb26356cf550b539eb5f64b986cd07f7954cc527
Author: Carsten Ziegeler <cz...@adobe.com>
AuthorDate: Fri Nov 3 15:06:50 2017 +0100

    Move feature model to whiteboard git
---
 pom.xml                                            | 127 ++++++++++++
 .../feature/applicationbuilder/impl/Main.java      | 213 +++++++++++++++++++++
 2 files changed, 340 insertions(+)

diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..c30dc54
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+    <!--
+        Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+        agreements. See the NOTICE file distributed with this work for additional information
+        regarding copyright ownership. The ASF licenses this file to you under the Apache License,
+        Version 2.0 (the "License"); you may not use this file except in compliance with the
+        License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing, software distributed under the
+        License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+        either express or implied. See the License for the specific language governing permissions
+        and limitations under the License.
+    -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>32</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.sling.feature.applicationbuilder</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <name>Apache Sling Feature Application Builder</name>
+    <description>
+        A feature describes an OSGi system
+    </description>
+
+    <properties>
+        <sling.java.version>8</sling.java.version>
+    </properties>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/support/feature-applicationbuilder</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/support/feature-applicationbuilder</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/tooling/support/feature-applicationbuilder</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                <execution>
+                    <id>unpack-dependencies</id>
+                    <phase>prepare-package</phase>
+                    <goals>
+                        <goal>unpack-dependencies</goal>
+                    </goals>
+                    <configuration>
+                        <excludes>META-INF/**</excludes>
+                        <outputDirectory>${project.build.directory}/classes</outputDirectory>
+                        <overWriteReleases>false</overWriteReleases>
+                        <overWriteSnapshots>true</overWriteSnapshots>
+                        <includeArtifactIds>commons-cli,org.apache.sling.feature,org.apache.sling.feature.support,org.apache.sling.commons.johnzon,slf4j-api,slf4j-simple,osgi.core,org.apache.felix.converter</includeArtifactIds>
+                    </configuration>
+                </execution>
+            </executions>
+            </plugin>
+                <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>org.apache.sling.feature.applicationbuilder.impl.Main</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+             <groupId>commons-cli</groupId>
+             <artifactId>commons-cli</artifactId>
+             <version>1.3.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.support</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.johnzon</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.converter</artifactId>
+            <version>0.1.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+      <!-- Testing -->
+        <dependency>
+        	<groupId>junit</groupId>
+        	<artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
new file mode 100644
index 0000000..80c609d
--- /dev/null
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.sling.feature.applicationbuilder.impl;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.sling.feature.Application;
+import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.Bundles;
+import org.apache.sling.feature.Configurations;
+import org.apache.sling.feature.Extension;
+import org.apache.sling.feature.ExtensionType;
+import org.apache.sling.feature.Extensions;
+import org.apache.sling.feature.KeyValueMap;
+import org.apache.sling.feature.support.ArtifactHandler;
+import org.apache.sling.feature.support.ArtifactManager;
+import org.apache.sling.feature.support.ArtifactManagerConfig;
+import org.apache.sling.feature.support.FeatureUtil;
+import org.apache.sling.feature.support.json.ApplicationJSONReader;
+import org.apache.sling.feature.support.json.ApplicationJSONWriter;
+import org.apache.sling.feature.support.json.FeatureJSONWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Main {
+
+    private static Logger LOGGER;
+
+    private static String output;
+
+    private static String filesInput;
+
+    private static String dirsInput;
+
+    private static String repoUrls;
+
+    private static String propsFile;
+
+    /**
+     * Parse the command line parameters and update a configuration object.
+     * @param args Command line parameters
+     * @return Configuration object.
+     */
+    private static void parseArgs(final String[] args) {
+        final Option repoOption =  Option.builder("u").hasArg().argName("Set repository url")
+                .desc("repository url").build();
+
+        final Option filesOption =  new Option("f", true, "Set feature files (comma separated)");
+        final Option dirsOption = new Option("d", true, "Set feature file dirs (comma separated)");
+        final Option propsOption =  new Option("p", true, "sling.properties file");
+
+
+        final Option outputOption = Option.builder("o").hasArg().argName("Set output file")
+                .desc("output file").build();
+
+        final Options options = new Options();
+        options.addOption(repoOption);
+        options.addOption(filesOption);
+        options.addOption(dirsOption);
+        options.addOption(outputOption);
+        options.addOption(propsOption);
+
+        final CommandLineParser parser = new DefaultParser();
+        try {
+            final CommandLine cl = parser.parse(options, args);
+
+            if ( cl.hasOption(repoOption.getOpt()) ) {
+                repoUrls = cl.getOptionValue(repoOption.getOpt());
+            }
+            if ( cl.hasOption(filesOption.getOpt()) ) {
+                filesInput = cl.getOptionValue(filesOption.getOpt());
+            }
+            if ( cl.hasOption(dirsOption.getOpt()) ) {
+                dirsInput = cl.getOptionValue(dirsOption.getOpt());
+            }
+            if ( cl.hasOption(outputOption.getOpt()) ) {
+                output = cl.getOptionValue(outputOption.getOpt());
+            }
+            if ( cl.hasOption(propsOption.getOpt()) ) {
+                propsFile = cl.getOptionValue(propsOption.getOpt());
+            }
+        } catch ( final ParseException pe) {
+            LOGGER.error("Unable to parse command line: {}", pe.getMessage(), pe);
+            System.exit(1);
+        }
+        if ( filesInput == null && dirsInput == null) {
+            LOGGER.error("Required argument missing: model files or directory");
+            System.exit(1);
+        }
+    }
+
+    private static ArtifactManager getArtifactManager() {
+        final ArtifactManagerConfig amConfig = new ArtifactManagerConfig();
+        if ( repoUrls != null ) {
+            amConfig.setRepositoryUrls(repoUrls.split(","));
+        }
+        try {
+            return ArtifactManager.getArtifactManager(amConfig);
+        } catch ( IOException ioe) {
+            LOGGER.error("Unable to create artifact manager " + ioe.getMessage(), ioe);
+            System.exit(1);
+        }
+        // we never reach this, but have to keep the compiler happy
+        return null;
+    }
+
+    public static void main(final String[] args) {
+        // setup logging
+        System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
+        System.setProperty("org.slf4j.simpleLogger.showThreadName", "false");
+        System.setProperty("org.slf4j.simpleLogger.levelInBrackets", "true");
+        System.setProperty("org.slf4j.simpleLogger.showLogName", "false");
+
+        LOGGER = LoggerFactory.getLogger("applicationbuilder");
+
+        LOGGER.info("Apache Sling Feature Application Builder");
+        LOGGER.info("");
+
+        parseArgs(args);
+
+        final ArtifactManagerConfig amConfig = new ArtifactManagerConfig();
+        if ( repoUrls != null ) {
+            amConfig.setRepositoryUrls(repoUrls.split(","));
+        }
+
+        final ArtifactManager am = getArtifactManager();
+
+
+        final String[] files =
+                Stream.concat(
+                    Stream.of(filesInput != null ? filesInput.split(",") : new String[0])
+                        .map(path -> new File(path))
+                        .filter(File::isFile),
+                    Stream.of(dirsInput != null ? dirsInput.split(",") : new String[0])
+                        .map(path -> new File(path))
+                        .filter(File::isDirectory)
+                        .flatMap(dir ->
+                            Stream.of(dir.listFiles())))
+                .filter(file -> !file.getName().startsWith("."))
+                .sorted()
+                .map(File::getAbsolutePath)
+                .toArray(String[]::new);
+
+        if (files.length == 0) {
+            LOGGER.error("No feature files found.");
+            System.exit(1);
+        }
+
+        try {
+            writeApplication(buildApplication(FeatureUtil.assembleApplication(null, am, files)), output == null ? "application.json" : output);
+
+        } catch ( final IOException ioe) {
+            LOGGER.error("Unable to read feature/application files " + ioe.getMessage(), ioe);
+            System.exit(1);
+        }
+    }
+
+    private static Application buildApplication(final Application app) {
+        app.getBundles().add(1, new org.apache.sling.feature.Artifact(ArtifactId.fromMvnId("org.apache.sling/org.apache.sling.launchpad.api/1.2.0")));
+        // sling.properties (TODO)
+        if ( propsFile == null ) {
+            app.getFrameworkProperties().put("org.osgi.framework.bootdelegation", "sun.*,com.sun.*");
+        } else {
+
+        }
+        // felix framework hard coded for now
+        app.setFramework(FeatureUtil.getFelixFrameworkId(null));
+        return app;
+    }
+
+    private static void writeApplication(final Application app, final String out) {
+        LOGGER.info("Writing application...");
+        final File file = new File(out);
+        try ( final FileWriter writer = new FileWriter(file)) {
+            ApplicationJSONWriter.write(writer, app);
+        } catch ( final IOException ioe) {
+            LOGGER.error("Unable to write application to {} : {}", out, ioe.getMessage(), ioe);
+            System.exit(1);
+        }
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 21/21: User felix util manifest Parser instead of sling commons.osgi one.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit cc73548366c9e91290bc585446adbd8fc96c36f8
Author: Karl Pauls <kp...@adobe.com>
AuthorDate: Thu Apr 26 12:09:11 2018 +0200

    User felix util manifest Parser instead of sling commons.osgi one.
---
 pom.xml | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index cc16c11..fed4c08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,12 +151,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.osgi</artifactId>
-            <version>2.4.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.service.resolver</artifactId>
             <version>1.0.1</version>

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 15/21: Rename process package to builder

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 482a5bcc88ced0b973bde46327c24d0ca6f7c29d
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 18 09:34:13 2018 +0200

    Rename process package to builder
---
 .../feature/applicationbuilder/impl/ApplicationBuilderTest.java     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index ee4bc13..524991c 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -39,6 +39,9 @@ import javax.json.stream.JsonGenerator;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
+import org.apache.sling.feature.builder.ApplicationBuilder;
+import org.apache.sling.feature.builder.BuilderContext;
+import org.apache.sling.feature.builder.FeatureProvider;
 import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.FeatureUtil;
 import org.apache.sling.feature.support.artifact.ArtifactHandler;
@@ -47,9 +50,6 @@ import org.apache.sling.feature.support.artifact.ArtifactManagerConfig;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.json.FeatureJSONReader;
 import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
-import org.apache.sling.feature.support.process.ApplicationBuilder;
-import org.apache.sling.feature.support.process.BuilderContext;
-import org.apache.sling.feature.support.process.FeatureProvider;
 import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.junit.After;
 import org.junit.Before;

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 16/21: Rename packages

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 4d643d5e5b2da5629ad0292b11041e4c7bb627d7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 18 10:26:45 2018 +0200

    Rename packages
---
 .../apache/sling/feature/applicationbuilder/impl/Main.java   |  6 +++---
 .../applicationbuilder/impl/ApplicationBuilderTest.java      | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 2c38faa..58f8e44 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -24,11 +24,11 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.io.ArtifactManager;
+import org.apache.sling.feature.io.ArtifactManagerConfig;
+import org.apache.sling.feature.io.json.ApplicationJSONWriter;
 import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.FeatureUtil;
-import org.apache.sling.feature.support.artifact.ArtifactManager;
-import org.apache.sling.feature.support.artifact.ArtifactManagerConfig;
-import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 524991c..9426520 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -42,14 +42,14 @@ import org.apache.sling.feature.Feature;
 import org.apache.sling.feature.builder.ApplicationBuilder;
 import org.apache.sling.feature.builder.BuilderContext;
 import org.apache.sling.feature.builder.FeatureProvider;
+import org.apache.sling.feature.io.ArtifactHandler;
+import org.apache.sling.feature.io.ArtifactManager;
+import org.apache.sling.feature.io.ArtifactManagerConfig;
+import org.apache.sling.feature.io.json.ApplicationJSONWriter;
+import org.apache.sling.feature.io.json.FeatureJSONReader;
+import org.apache.sling.feature.io.json.FeatureJSONReader.SubstituteVariables;
 import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.FeatureUtil;
-import org.apache.sling.feature.support.artifact.ArtifactHandler;
-import org.apache.sling.feature.support.artifact.ArtifactManager;
-import org.apache.sling.feature.support.artifact.ArtifactManagerConfig;
-import org.apache.sling.feature.support.json.ApplicationJSONWriter;
-import org.apache.sling.feature.support.json.FeatureJSONReader;
-import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
 import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.junit.After;
 import org.junit.Before;

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 02/21: Update the example to work with the latest changes in the mvn url vs id parsing.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 6044d7f1f001d4d63ada5b292b3fa0e65664493f
Author: Karl Pauls <kp...@adobe.com>
AuthorDate: Mon Nov 13 15:14:29 2017 +0100

    Update the example to work with the latest changes in the mvn url vs id parsing.
---
 .../java/org/apache/sling/feature/applicationbuilder/impl/Main.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 80c609d..232c99b 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -188,7 +188,7 @@ public class Main {
     }
 
     private static Application buildApplication(final Application app) {
-        app.getBundles().add(1, new org.apache.sling.feature.Artifact(ArtifactId.fromMvnId("org.apache.sling/org.apache.sling.launchpad.api/1.2.0")));
+        app.getBundles().add(1, new org.apache.sling.feature.Artifact(ArtifactId.parse("org.apache.sling/org.apache.sling.launchpad.api/1.2.0")));
         // sling.properties (TODO)
         if ( propsFile == null ) {
             app.getFrameworkProperties().put("org.osgi.framework.bootdelegation", "sun.*,com.sun.*");

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 07/21: Update the comparison method for generated Application JSON

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 073087e2de441e92cc213d0251136801ea2023de
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Mon Mar 12 17:56:18 2018 +0000

    Update the comparison method for generated Application JSON
---
 pom.xml                                            | 24 +++++-----
 .../feature/applicationbuilder/impl/Main.java      | 14 +++---
 .../impl/ApplicationBuilderTest.java               | 55 +++++++++++++++++-----
 3 files changed, 62 insertions(+), 31 deletions(-)

diff --git a/pom.xml b/pom.xml
index 917e103..9f470e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,6 +104,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.analyser</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>        
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.resolver</artifactId>
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
@@ -133,6 +139,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>5.6.10</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.osgi</artifactId>
             <version>2.4.0</version>
@@ -151,17 +163,5 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.framework</artifactId>
-            <version>5.6.10</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature.analyser</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>        
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index db733cb..3235e81 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -16,12 +16,6 @@
  */
 package org.apache.sling.feature.applicationbuilder.impl;
 
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.stream.Stream;
-
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.CommandLineParser;
 import org.apache.commons.cli.DefaultParser;
@@ -39,6 +33,12 @@ import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.stream.Stream;
+
 public class Main {
 
     private static Logger LOGGER;
@@ -190,7 +190,7 @@ public class Main {
     }
 
     private static void writeApplication(final Application app, final String out) {
-        LOGGER.info("Writing application...");
+        LOGGER.info("Writing application: " + out);
         final File file = new File(out);
         try ( final FileWriter writer = new FileWriter(file)) {
             ApplicationJSONWriter.write(writer, app);
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 414d426..0c88957 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -36,6 +36,7 @@ import org.osgi.framework.Constants;
 
 import java.io.File;
 import java.io.FileReader;
+import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URL;
@@ -45,6 +46,12 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.Map;
 
+import javax.json.Json;
+import javax.json.JsonStructure;
+import javax.json.JsonWriter;
+import javax.json.JsonWriterFactory;
+import javax.json.stream.JsonGenerator;
+
 import static org.junit.Assert.assertEquals;
 
 public class ApplicationBuilderTest {
@@ -80,16 +87,21 @@ public class ApplicationBuilderTest {
 
         try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
             Application app = ApplicationBuilder.assemble(null, bc, fr, features);
-            String genApp = writeApplication(app);
+            String actualJSON = writeApplication(app);
 
-            String expected = "{\"features\":["
+            String expectedJSON = "{\"features\":["
                     + "\"org.apache.sling.test.features:featureB:1.0.0\","
                     + "\"org.apache.sling.test.features:featureA:1.0.0\"],"
                 + "\"bundles\":["
-                    + "{\"id\":\"commons-io:commons-io:2.6\",\"start-order\":\"10\"},"
-                    + "{\"id\":\"org.apache.felix:org.apache.felix.http.servlet-api:1.1.2\",\"start-order\":\"15\"},"
-                    + "{\"id\":\"commons-fileupload:commons-fileupload:1.3.3\",\"start-order\":\"16\"}]}";
-            assertEquals(expected, genApp);
+                    + "{\"id\":\"commons-io:commons-io:2.6\",\"start-level\":\"10\",\"start-order\":\"10\"},"
+                    + "{\"id\":\"org.apache.felix:org.apache.felix.http.servlet-api:1.1.2\",\"start-level\":\"15\",\"start-order\":\"15\"},"
+                    + "{\"id\":\"commons-fileupload:commons-fileupload:1.3.3\",\"start-level\":\"16\",\"start-order\":\"16\"}]}";
+
+            StringWriter expectedWriter = new StringWriter();
+            StringWriter actualWriter = new StringWriter();
+
+            canonicalize(expectedJSON, expectedWriter, actualJSON, actualWriter);
+            assertEquals(expectedWriter.toString(), actualWriter.toString());
         }
     }
 
@@ -112,15 +124,28 @@ public class ApplicationBuilderTest {
             String expected = "{\"features\":["
                     + "\"org.apache.sling.test.features:featureC:1.0.0\","
                     + "\"org.apache.sling.test.features:featureD:1.0.0\"],"
-                    + "\"bundles\":[{\"id\":\"org.slf4j:slf4j-api:1.7.25\",\"start-order\":\"6\"}]}";
-            assertEquals(expected, genApp);
+                    + "\"bundles\":[{\"id\":\"org.slf4j:slf4j-api:1.7.25\",\"start-level\":\"6\",\"start-order\":\"6\"}]}";
+
+            StringWriter expectedWriter = new StringWriter();
+            StringWriter actualWriter = new StringWriter();
+            canonicalize(expected, expectedWriter, genApp, actualWriter);
+
+            assertEquals(expectedWriter.toString(), actualWriter.toString());
         }
     }
 
-    private static String writeApplication(Application app) throws Exception {
-        Writer writer = new StringWriter();
-        ApplicationJSONWriter.write(writer, app);
-        return writer.toString();
+    // Turn JSON into pretty-formatted canoncical JSON that should be comparable using String compare
+    private void canonicalize(String expected, StringWriter expectedWriter, String actual, StringWriter actualWriter) {
+        JsonStructure es = Json.createReader(new StringReader(expected)).read();
+        JsonStructure ea = Json.createReader(new StringReader(actual)).read();
+
+        JsonWriterFactory writerFactory = Json.createWriterFactory(
+                Collections.singletonMap(JsonGenerator.PRETTY_PRINTING, true));
+        JsonWriter w = writerFactory.createWriter(expectedWriter);
+        w.write(es);
+
+        JsonWriter w2 = writerFactory.createWriter(actualWriter);
+        w2.write(ea);
     }
 
     private Feature readFeature(final String res,
@@ -135,6 +160,12 @@ public class ApplicationBuilderTest {
         }
     }
 
+    private static String writeApplication(Application app) throws Exception {
+        Writer writer = new StringWriter();
+        ApplicationJSONWriter.write(writer, app);
+        return writer.toString();
+    }
+
     private static class TestFeatureProvider implements FeatureProvider {
         @Override
         public Feature provide(ArtifactId id) {

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 20/21: Use felix utils ResourceBuilder and Parser instead of the ManifestParser and ManifestUtil. As with that the feature-support module is empty, remove it.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit c066892781039122089b7dc06c4edc618c0a179b
Author: Karl Pauls <kp...@adobe.com>
AuthorDate: Thu Apr 26 12:00:25 2018 +0200

    Use felix utils ResourceBuilder and Parser instead of the ManifestParser and ManifestUtil. As with that the feature-support module is empty, remove it.
---
 pom.xml | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3cb9e08..cc16c11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,12 +122,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.feature.support</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.johnzon</artifactId>
             <version>1.0.0</version>
             <scope>provided</scope>

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 08/21: [Feature Model] Support separate phases for reading variables

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit a0f92b4a9712cecdbc4ccdf39d49a1bb695caeba
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Fri Mar 16 12:01:14 2018 +0000

    [Feature Model] Support separate phases for reading variables
    
    Variables in the feature model must be substituted at different points in
    time, depending on where they reside. Variables in the includes, bundle,
    requirements and capabilities section must be substituted before the
    resolver runs, as they influence the resolver result. They should not be
    substituted at launch time. Other variables, such as configuration and
    framework properties variables must be substituted at launch time.
---
 .../sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 0c88957..9d84329 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -29,6 +29,7 @@ import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.json.FeatureJSONReader;
+import org.apache.sling.feature.support.json.FeatureJSONReader.Phase;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -155,7 +156,7 @@ public class ApplicationBuilderTest {
         final ArtifactHandler featureArtifact = artifactManager.getArtifactHandler(file);
 
         try (final FileReader r = new FileReader(featureArtifact.getFile())) {
-            final Feature f = FeatureJSONReader.read(r, featureArtifact.getUrl());
+            final Feature f = FeatureJSONReader.read(r, featureArtifact.getUrl(), Phase.RESOLVE);
             return f;
         }
     }

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 03/21: Start changing start level handling to start order handling

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit a61639ce742fbafbd4cecb924a46cb4dec30c590
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Jan 18 16:14:50 2018 +0100

    Start changing start level handling to start order handling
---
 .../feature/applicationbuilder/impl/Main.java      | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 232c99b..9964a3e 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -17,17 +17,8 @@
 package org.apache.sling.feature.applicationbuilder.impl;
 
 import java.io.File;
-import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import org.apache.commons.cli.CommandLine;
@@ -38,19 +29,10 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
-import org.apache.sling.feature.Bundles;
-import org.apache.sling.feature.Configurations;
-import org.apache.sling.feature.Extension;
-import org.apache.sling.feature.ExtensionType;
-import org.apache.sling.feature.Extensions;
-import org.apache.sling.feature.KeyValueMap;
-import org.apache.sling.feature.support.ArtifactHandler;
 import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
-import org.apache.sling.feature.support.json.ApplicationJSONReader;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
-import org.apache.sling.feature.support.json.FeatureJSONWriter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -188,7 +170,9 @@ public class Main {
     }
 
     private static Application buildApplication(final Application app) {
-        app.getBundles().add(1, new org.apache.sling.feature.Artifact(ArtifactId.parse("org.apache.sling/org.apache.sling.launchpad.api/1.2.0")));
+        final org.apache.sling.feature.Artifact a = new org.apache.sling.feature.Artifact(ArtifactId.parse("org.apache.sling/org.apache.sling.launchpad.api/1.2.0"));
+        a.getMetadata().put(org.apache.sling.feature.Artifact.KEY_START_ORDER, "1");
+        app.getBundles().add(a);
         // sling.properties (TODO)
         if ( propsFile == null ) {
             app.getFrameworkProperties().put("org.osgi.framework.bootdelegation", "sun.*,com.sun.*");

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 19/21: [Sling Feature Model] Refactor FeatureUtil out of the support module

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 84f1151b6780b89da483f84e76ed02ee678e5731
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Wed Apr 25 13:40:18 2018 +0100

    [Sling Feature Model] Refactor FeatureUtil out of the support module
    
    Also move the Resolver API to the resolver module.
---
 .../org/apache/sling/feature/applicationbuilder/impl/Main.java   | 9 +++++----
 .../feature/applicationbuilder/impl/ApplicationBuilderTest.java  | 8 ++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 58f8e44..d07be10 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -26,10 +26,11 @@ import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.io.ArtifactManager;
 import org.apache.sling.feature.io.ArtifactManagerConfig;
+import org.apache.sling.feature.io.IOUtils;
 import org.apache.sling.feature.io.json.ApplicationJSONWriter;
+import org.apache.sling.feature.resolver.ApplicationResolverAssembler;
+import org.apache.sling.feature.resolver.FeatureResolver;
 import org.apache.sling.feature.resolver.FrameworkResolver;
-import org.apache.sling.feature.support.FeatureUtil;
-import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -163,7 +164,7 @@ public class Main {
         }
 
         try (FeatureResolver fr = getFeatureResolver(am)) {
-            writeApplication(buildApplication(FeatureUtil.assembleApplication(null, am, fr, files)), output == null ? "application.json" : output);
+            writeApplication(buildApplication(ApplicationResolverAssembler.assembleApplication(null, am, fr, files)), output == null ? "application.json" : output);
 
         } catch ( final IOException ioe) {
             LOGGER.error("Unable to read feature/application files " + ioe.getMessage(), ioe);
@@ -185,7 +186,7 @@ public class Main {
 
         }
         // felix framework hard coded for now
-        app.setFramework(FeatureUtil.getFelixFrameworkId(null));
+        app.setFramework(IOUtils.getFelixFrameworkId(null));
         return app;
     }
 
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 9426520..c80f485 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -48,9 +48,9 @@ import org.apache.sling.feature.io.ArtifactManagerConfig;
 import org.apache.sling.feature.io.json.ApplicationJSONWriter;
 import org.apache.sling.feature.io.json.FeatureJSONReader;
 import org.apache.sling.feature.io.json.FeatureJSONReader.SubstituteVariables;
+import org.apache.sling.feature.resolver.ApplicationResolverAssembler;
+import org.apache.sling.feature.resolver.FeatureResolver;
 import org.apache.sling.feature.resolver.FrameworkResolver;
-import org.apache.sling.feature.support.FeatureUtil;
-import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -88,7 +88,7 @@ public class ApplicationBuilderTest {
         Feature[] features = {fa, fb};
 
         try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
-            Application app = ApplicationBuilder.assemble(null, bc, FeatureUtil.sortFeatures(fr, features));
+            Application app = ApplicationBuilder.assemble(null, bc, ApplicationResolverAssembler.sortFeatures(fr, features));
             String actualJSON = writeApplication(app);
 
             String expectedJSON = "{\"features\":["
@@ -120,7 +120,7 @@ public class ApplicationBuilderTest {
         Feature[] features = {fd, fc};
 
         try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
-            Application app = ApplicationBuilder.assemble(null, bc, FeatureUtil.sortFeatures(fr, features));
+            Application app = ApplicationBuilder.assemble(null, bc, ApplicationResolverAssembler.sortFeatures(fr, features));
             String genApp = writeApplication(app);
 
             String expected = "{\"features\":["

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 13/21: Move artifact handling to separate package

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 477bbe4fff4c99a36a30c26292c8a85414767456
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Apr 17 09:51:30 2018 +0200

    Move artifact handling to separate package
---
 .../java/org/apache/sling/feature/applicationbuilder/impl/Main.java | 4 ++--
 .../feature/applicationbuilder/impl/ApplicationBuilderTest.java     | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index fc9b591..2c38faa 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -25,9 +25,9 @@ import org.apache.commons.cli.ParseException;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.resolver.FrameworkResolver;
-import org.apache.sling.feature.support.ArtifactManager;
-import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
+import org.apache.sling.feature.support.artifact.ArtifactManager;
+import org.apache.sling.feature.support.artifact.ArtifactManagerConfig;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.slf4j.Logger;
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index f0532e5..ee4bc13 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -40,10 +40,10 @@ import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
 import org.apache.sling.feature.resolver.FrameworkResolver;
-import org.apache.sling.feature.support.ArtifactHandler;
-import org.apache.sling.feature.support.ArtifactManager;
-import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
+import org.apache.sling.feature.support.artifact.ArtifactHandler;
+import org.apache.sling.feature.support.artifact.ArtifactManager;
+import org.apache.sling.feature.support.artifact.ArtifactManagerConfig;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.json.FeatureJSONReader;
 import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 06/21: SLING-7521 Order bundles in the generated app based on feature order and start order

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit efcb9d351f28430fb9cd8b0c9acd9373c6a11417
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Mon Mar 5 15:05:23 2018 +0000

    SLING-7521 Order bundles in the generated app based on feature order and start order
    
    Order resource (bundles and features) in the resulting application based on the order
    of resolved features and then also in the order of the start order within the feature.
---
 pom.xml                                            |  31 ++++-
 .../impl/ApplicationBuilderTest.java               | 144 +++++++++++++++++++++
 src/test/resources/featureA.json                   |   5 +
 src/test/resources/featureB.json                   |  14 ++
 src/test/resources/featureC.json                   |  18 +++
 src/test/resources/featureD.json                   |   5 +
 6 files changed, 214 insertions(+), 3 deletions(-)

diff --git a/pom.xml b/pom.xml
index 9f0d02f..917e103 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,11 +132,36 @@
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.4.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.resolver</artifactId>
+            <version>1.0.1</version>
+            <scope>provided</scope>
+        </dependency>
                 
-      <!-- Testing -->
+        <!-- Testing -->
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
-        	<groupId>junit</groupId>
-        	<artifactId>junit</artifactId>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>5.6.10</version>
+            <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.analyser</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>        
     </dependencies>
 </project>
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
new file mode 100644
index 0000000..414d426
--- /dev/null
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.feature.applicationbuilder.impl;
+
+import org.apache.sling.feature.Application;
+import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.Feature;
+import org.apache.sling.feature.process.ApplicationBuilder;
+import org.apache.sling.feature.process.BuilderContext;
+import org.apache.sling.feature.process.FeatureProvider;
+import org.apache.sling.feature.process.FeatureResolver;
+import org.apache.sling.feature.resolver.FrameworkResolver;
+import org.apache.sling.feature.support.ArtifactHandler;
+import org.apache.sling.feature.support.ArtifactManager;
+import org.apache.sling.feature.support.ArtifactManagerConfig;
+import org.apache.sling.feature.support.json.ApplicationJSONWriter;
+import org.apache.sling.feature.support.json.FeatureJSONReader;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Constants;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+public class ApplicationBuilderTest {
+    private Path tempDir;
+
+    @Before
+    public void setup() throws Exception {
+        tempDir = Files.createTempDirectory(getClass().getSimpleName());
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        // Delete the temp dir again
+        Files.walk(tempDir)
+            .sorted(Comparator.reverseOrder())
+            .map(Path::toFile)
+            .forEach(File::delete);
+    }
+
+    private Map<String, String> getFrameworkProps() {
+        return Collections.singletonMap(Constants.FRAMEWORK_STORAGE, tempDir.toFile().getAbsolutePath());
+    }
+
+    @Test
+    public void testBundleOrdering() throws Exception {
+        FeatureProvider fp = new TestFeatureProvider();
+        BuilderContext bc = new BuilderContext(fp);
+        ArtifactManager am = ArtifactManager.getArtifactManager(new ArtifactManagerConfig());
+
+        Feature fa = readFeature("/featureA.json", am);
+        Feature fb = readFeature("/featureB.json", am);
+        Feature[] features = {fa, fb};
+
+        try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
+            Application app = ApplicationBuilder.assemble(null, bc, fr, features);
+            String genApp = writeApplication(app);
+
+            String expected = "{\"features\":["
+                    + "\"org.apache.sling.test.features:featureB:1.0.0\","
+                    + "\"org.apache.sling.test.features:featureA:1.0.0\"],"
+                + "\"bundles\":["
+                    + "{\"id\":\"commons-io:commons-io:2.6\",\"start-order\":\"10\"},"
+                    + "{\"id\":\"org.apache.felix:org.apache.felix.http.servlet-api:1.1.2\",\"start-order\":\"15\"},"
+                    + "{\"id\":\"commons-fileupload:commons-fileupload:1.3.3\",\"start-order\":\"16\"}]}";
+            assertEquals(expected, genApp);
+        }
+    }
+
+    @Test
+    public void testFeatureDependency() throws Exception {
+        FeatureProvider fp = new TestFeatureProvider();
+        BuilderContext bc = new BuilderContext(fp);
+        ArtifactManager am = ArtifactManager.getArtifactManager(new ArtifactManagerConfig());
+
+        // Feature D has a bundle (slf4j-api) with a dependency on feature C,
+        // which provides a package for slf4j
+        Feature fc = readFeature("/featureC.json", am);
+        Feature fd = readFeature("/featureD.json", am);
+        Feature[] features = {fd, fc};
+
+        try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
+            Application app = ApplicationBuilder.assemble(null, bc, fr, features);
+            String genApp = writeApplication(app);
+
+            String expected = "{\"features\":["
+                    + "\"org.apache.sling.test.features:featureC:1.0.0\","
+                    + "\"org.apache.sling.test.features:featureD:1.0.0\"],"
+                    + "\"bundles\":[{\"id\":\"org.slf4j:slf4j-api:1.7.25\",\"start-order\":\"6\"}]}";
+            assertEquals(expected, genApp);
+        }
+    }
+
+    private static String writeApplication(Application app) throws Exception {
+        Writer writer = new StringWriter();
+        ApplicationJSONWriter.write(writer, app);
+        return writer.toString();
+    }
+
+    private Feature readFeature(final String res,
+            final ArtifactManager artifactManager) throws Exception {
+        URL url = getClass().getResource(res);
+        String file = new File(url.toURI()).getAbsolutePath();
+        final ArtifactHandler featureArtifact = artifactManager.getArtifactHandler(file);
+
+        try (final FileReader r = new FileReader(featureArtifact.getFile())) {
+            final Feature f = FeatureJSONReader.read(r, featureArtifact.getUrl());
+            return f;
+        }
+    }
+
+    private static class TestFeatureProvider implements FeatureProvider {
+        @Override
+        public Feature provide(ArtifactId id) {
+            return null;
+        }
+    }
+}
diff --git a/src/test/resources/featureA.json b/src/test/resources/featureA.json
new file mode 100644
index 0000000..1daed33
--- /dev/null
+++ b/src/test/resources/featureA.json
@@ -0,0 +1,5 @@
+{
+    "id": "org.apache.sling.test.features/featureA/1.0.0",
+    "bundles": 
+        ["commons-fileupload/commons-fileupload/1.3.3"]
+}
\ No newline at end of file
diff --git a/src/test/resources/featureB.json b/src/test/resources/featureB.json
new file mode 100644
index 0000000..952c810
--- /dev/null
+++ b/src/test/resources/featureB.json
@@ -0,0 +1,14 @@
+{
+    "id": "org.apache.sling.test.features/featureB/1.0.0",
+    "bundles": 
+        [
+            {
+                "id": "org.apache.felix/org.apache.felix.http.servlet-api/1.1.2",
+                "start-order" : 10
+            },
+            {
+                "id": "commons-io/commons-io/2.6",
+                "start-order" : 5
+            }
+        ]
+}
\ No newline at end of file
diff --git a/src/test/resources/featureC.json b/src/test/resources/featureC.json
new file mode 100644
index 0000000..0aed875
--- /dev/null
+++ b/src/test/resources/featureC.json
@@ -0,0 +1,18 @@
+{
+    "id": "org.apache.sling.test.features/featureC/1.0.0",
+    "capabilities": [
+        {
+            "namespace": "org.foo.bar",
+            "attributes": {
+                "org.foo.bar": "toast",
+                "version:Version": "1.1"
+            }
+        }, {
+            "namespace": "osgi.wiring.package",
+            "attributes": {
+                "osgi.wiring.package": "org.slf4j.impl",
+                "version:Version": "1.7.1.test"
+            }
+        }
+    ]
+}
\ No newline at end of file
diff --git a/src/test/resources/featureD.json b/src/test/resources/featureD.json
new file mode 100644
index 0000000..e9aa806
--- /dev/null
+++ b/src/test/resources/featureD.json
@@ -0,0 +1,5 @@
+{
+    "id": "org.apache.sling.test.features/featureD/1.0.0",
+    "bundles": 
+        ["org.slf4j/slf4j-api/1.7.25"]
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 04/21: SLING-7512 Order features based on their dependencies.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit f77bb7faf0ca5892db498ad7986a2e1367360198
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Fri Feb 23 13:42:28 2018 +0000

    SLING-7512 Order features based on their dependencies.
    
    Very initial implementation which contains the refactoring of
    Requirements and Capabilities to use the OSGi ones.
---
 pom.xml                                               | 13 +++++++++++++
 .../sling/feature/applicationbuilder/impl/Main.java   | 19 ++++++++++++-------
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index c30dc54..a61c49f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.resolver</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.support</artifactId>
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>
@@ -118,6 +124,13 @@
             <version>0.1.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.configurator</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+                
       <!-- Testing -->
         <dependency>
         	<groupId>junit</groupId>
diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 9964a3e..db733cb 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -19,6 +19,7 @@ package org.apache.sling.feature.applicationbuilder.impl;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.Collections;
 import java.util.stream.Stream;
 
 import org.apache.commons.cli.CommandLine;
@@ -29,6 +30,8 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.process.FeatureResolver;
+import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
@@ -118,6 +121,10 @@ public class Main {
         return null;
     }
 
+    private static FeatureResolver getFeatureResolver(ArtifactManager am) {
+        return new FrameworkResolver(am, Collections.emptyMap());
+    }
+
     public static void main(final String[] args) {
         // setup logging
         System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info");
@@ -132,11 +139,6 @@ public class Main {
 
         parseArgs(args);
 
-        final ArtifactManagerConfig amConfig = new ArtifactManagerConfig();
-        if ( repoUrls != null ) {
-            amConfig.setRepositoryUrls(repoUrls.split(","));
-        }
-
         final ArtifactManager am = getArtifactManager();
 
 
@@ -160,12 +162,15 @@ public class Main {
             System.exit(1);
         }
 
-        try {
-            writeApplication(buildApplication(FeatureUtil.assembleApplication(null, am, files)), output == null ? "application.json" : output);
+        try (FeatureResolver fr = getFeatureResolver(am)) {
+            writeApplication(buildApplication(FeatureUtil.assembleApplication(null, am, fr, files)), output == null ? "application.json" : output);
 
         } catch ( final IOException ioe) {
             LOGGER.error("Unable to read feature/application files " + ioe.getMessage(), ioe);
             System.exit(1);
+        } catch ( final Exception e) {
+            LOGGER.error("Problem generating application", e);
+            System.exit(1);
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 14/21: Include new artifacts in the feature-appplicationbuilder

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 4574ee85b313bdddc5d1013f361338bbd28a6ef5
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Apr 17 22:35:38 2018 +0300

    Include new artifacts in the feature-appplicationbuilder
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 9f470e2..885c31f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,7 @@
                         <outputDirectory>${project.build.directory}/classes</outputDirectory>
                         <overWriteReleases>false</overWriteReleases>
                         <overWriteSnapshots>true</overWriteSnapshots>
-                        <includeArtifactIds>commons-cli,org.apache.sling.feature,org.apache.sling.feature.support,org.apache.sling.commons.johnzon,slf4j-api,slf4j-simple,osgi.core,org.apache.felix.converter</includeArtifactIds>
+                        <includeArtifactIds>commons-cli,org.apache.sling.feature,org.apache.sling.feature.support,org.apache.sling.commons.johnzon,slf4j-api,slf4j-simple,osgi.core,org.apache.felix.converter,org.osgi.service.resolver,org.apache.sling.feature.resolver,org.apache.sling.feature.analyser</includeArtifactIds>
                     </configuration>
                 </execution>
             </executions>

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 18/21: [Sling Feature Model] Split off IO packages into separate module.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 31db88184c6711d8c1b3a8fc151c0701d83e7487
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Wed Apr 25 10:58:43 2018 +0100

    [Sling Feature Model] Split off IO packages into separate module.
---
 pom.xml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pom.xml b/pom.xml
index 70f0bfb..3cb9e08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,12 @@
         </dependency>        
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.feature.io</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.feature.resolver</artifactId>
             <version>0.0.1-SNAPSHOT</version>
             <scope>provided</scope>

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 17/21: Refactor to use Capabilities and Requirements from Felix utils project

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 058c41862f0630c0285c3cd39490fc1fe2f07367
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Sun Apr 22 21:19:43 2018 +0100

    Refactor to use Capabilities and Requirements from Felix utils project
---
 pom.xml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/pom.xml b/pom.xml
index 885c31f..70f0bfb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,6 +145,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.utils</artifactId>
+            <version>1.11.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.osgi</artifactId>
             <version>2.4.0</version>

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 05/21: Update to parent pom 33

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 9c766e884e1fd3d0dc12bf18afbbf51deca01135
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Feb 26 13:24:32 2018 +0100

    Update to parent pom 33
---
 pom.xml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index a61c49f..9f0d02f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>32</version>
+        <version>33</version>
         <relativePath />
     </parent>
 
@@ -79,6 +79,8 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>osgi.core</artifactId>
+            <version>6.0.0</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 12/21: Remove resolver usage from application builder

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 8d06a4614c191a10f16c899fe49c72d394815a31
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Apr 17 09:42:30 2018 +0200

    Remove resolver usage from application builder
---
 .../impl/ApplicationBuilderTest.java               | 43 +++++++++++-----------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 07faad6..f0532e5 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -16,24 +16,7 @@
  */
 package org.apache.sling.feature.applicationbuilder.impl;
 
-import org.apache.sling.feature.Application;
-import org.apache.sling.feature.ArtifactId;
-import org.apache.sling.feature.Feature;
-import org.apache.sling.feature.resolver.FrameworkResolver;
-import org.apache.sling.feature.support.ArtifactHandler;
-import org.apache.sling.feature.support.ArtifactManager;
-import org.apache.sling.feature.support.ArtifactManagerConfig;
-import org.apache.sling.feature.support.json.ApplicationJSONWriter;
-import org.apache.sling.feature.support.json.FeatureJSONReader;
-import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
-import org.apache.sling.feature.support.process.ApplicationBuilder;
-import org.apache.sling.feature.support.process.BuilderContext;
-import org.apache.sling.feature.support.process.FeatureProvider;
-import org.apache.sling.feature.support.resolver.FeatureResolver;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Constants;
+import static org.junit.Assert.assertEquals;
 
 import java.io.File;
 import java.io.FileReader;
@@ -53,7 +36,25 @@ import javax.json.JsonWriter;
 import javax.json.JsonWriterFactory;
 import javax.json.stream.JsonGenerator;
 
-import static org.junit.Assert.assertEquals;
+import org.apache.sling.feature.Application;
+import org.apache.sling.feature.ArtifactId;
+import org.apache.sling.feature.Feature;
+import org.apache.sling.feature.resolver.FrameworkResolver;
+import org.apache.sling.feature.support.ArtifactHandler;
+import org.apache.sling.feature.support.ArtifactManager;
+import org.apache.sling.feature.support.ArtifactManagerConfig;
+import org.apache.sling.feature.support.FeatureUtil;
+import org.apache.sling.feature.support.json.ApplicationJSONWriter;
+import org.apache.sling.feature.support.json.FeatureJSONReader;
+import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
+import org.apache.sling.feature.support.process.ApplicationBuilder;
+import org.apache.sling.feature.support.process.BuilderContext;
+import org.apache.sling.feature.support.process.FeatureProvider;
+import org.apache.sling.feature.support.resolver.FeatureResolver;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Constants;
 
 public class ApplicationBuilderTest {
     private Path tempDir;
@@ -87,7 +88,7 @@ public class ApplicationBuilderTest {
         Feature[] features = {fa, fb};
 
         try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
-            Application app = ApplicationBuilder.assemble(null, bc, fr, features);
+            Application app = ApplicationBuilder.assemble(null, bc, FeatureUtil.sortFeatures(fr, features));
             String actualJSON = writeApplication(app);
 
             String expectedJSON = "{\"features\":["
@@ -119,7 +120,7 @@ public class ApplicationBuilderTest {
         Feature[] features = {fd, fc};
 
         try (FeatureResolver fr = new FrameworkResolver(am, getFrameworkProps())) {
-            Application app = ApplicationBuilder.assemble(null, bc, fr, features);
+            Application app = ApplicationBuilder.assemble(null, bc, FeatureUtil.sortFeatures(fr, features));
             String genApp = writeApplication(app);
 
             String expected = "{\"features\":["

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 10/21: Move the process package from the feature api module to the support one.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit fcfbd889d94021349e75ac08b94ecd0e65568fd4
Author: David Bosschaert <da...@gmail.com>
AuthorDate: Wed Apr 11 16:51:50 2018 +0100

    Move the process package from the feature api module to the support one.
    
    Also move the associated tests.
---
 .../org/apache/sling/feature/applicationbuilder/impl/Main.java    | 2 +-
 .../feature/applicationbuilder/impl/ApplicationBuilderTest.java   | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 3235e81..57c08b2 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -24,12 +24,12 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
-import org.apache.sling.feature.process.FeatureResolver;
 import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
+import org.apache.sling.feature.support.process.FeatureResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 6efa834..4887eb7 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -19,10 +19,6 @@ package org.apache.sling.feature.applicationbuilder.impl;
 import org.apache.sling.feature.Application;
 import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
-import org.apache.sling.feature.process.ApplicationBuilder;
-import org.apache.sling.feature.process.BuilderContext;
-import org.apache.sling.feature.process.FeatureProvider;
-import org.apache.sling.feature.process.FeatureResolver;
 import org.apache.sling.feature.resolver.FrameworkResolver;
 import org.apache.sling.feature.support.ArtifactHandler;
 import org.apache.sling.feature.support.ArtifactManager;
@@ -30,6 +26,10 @@ import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
 import org.apache.sling.feature.support.json.FeatureJSONReader;
 import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariables;
+import org.apache.sling.feature.support.process.ApplicationBuilder;
+import org.apache.sling.feature.support.process.BuilderContext;
+import org.apache.sling.feature.support.process.FeatureProvider;
+import org.apache.sling.feature.support.process.FeatureResolver;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.

[sling-org-apache-sling-feature-applicationbuilder] 11/21: Move resolving to separate package

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-applicationbuilder.git

commit 449e26b8149f08834fa6ecb6917ce155dd33a2b4
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Apr 17 09:25:12 2018 +0200

    Move resolving to separate package
---
 .../java/org/apache/sling/feature/applicationbuilder/impl/Main.java     | 2 +-
 .../sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
index 57c08b2..fc9b591 100644
--- a/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
+++ b/src/main/java/org/apache/sling/feature/applicationbuilder/impl/Main.java
@@ -29,7 +29,7 @@ import org.apache.sling.feature.support.ArtifactManager;
 import org.apache.sling.feature.support.ArtifactManagerConfig;
 import org.apache.sling.feature.support.FeatureUtil;
 import org.apache.sling.feature.support.json.ApplicationJSONWriter;
-import org.apache.sling.feature.support.process.FeatureResolver;
+import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
index 4887eb7..07faad6 100644
--- a/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
+++ b/src/test/java/org/apache/sling/feature/applicationbuilder/impl/ApplicationBuilderTest.java
@@ -29,7 +29,7 @@ import org.apache.sling.feature.support.json.FeatureJSONReader.SubstituteVariabl
 import org.apache.sling.feature.support.process.ApplicationBuilder;
 import org.apache.sling.feature.support.process.BuilderContext;
 import org.apache.sling.feature.support.process.FeatureProvider;
-import org.apache.sling.feature.support.process.FeatureResolver;
+import org.apache.sling.feature.support.resolver.FeatureResolver;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

-- 
To stop receiving notification emails like this one, please contact
davidb@apache.org.