You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:58:27 UTC

[sling-org-apache-sling-provisioning-model] annotated tag org.apache.sling.provisioning.model-1.4.2 created (now 2fe7aec)

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

rombert pushed a change to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git.


      at 2fe7aec  (tag)
 tagging 7e1771e81826449e347a787ea9a1644fe24d37a7 (commit)
      by Carsten Ziegeler
      on Tue Dec 22 06:08:22 2015 +0000

- Log -----------------------------------------------------------------
org.apache.sling.provisioning.model-1.4.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 11a204a  Add slingstart model
     new 03f094c  Add slingstart model
     new a86fcd4  Update javadocs and rename subsystem to deliverable and run mode to feature
     new 58cc5a6  Add simple txt parser
     new 43a5c06  Add simple txt parser
     new fdc1ccf  Fully support Apach Felix config file format. Move from properties to getter and setter methods
     new 470e4bc  Fully support Apach Felix config file format. Move from properties to getter and setter methods
     new 9857e6c  Fully support Apach Felix config file format. Move from properties to getter and setter methods
     new 75a411c  Simplify model, move completely to getter/setter methods
     new 1a36bd0  Implement txt format for reading and writing
     new 7bee16a  Add merger utility and variable replacement
     new ca9289e  Finish configuration support
     new 245be2d  Add resolver to resolve variables from environment, system properties etc.
     new ffb35f8  Don't output jar extension if not necessary
     new 252bf2d  Remove support for xml
     new 456ebb1  Implement provisioning model
     new 380d68e  Rename some constants
     new c58f1ab  Cleanup methods and constants
     new d3b6bc4  Update to Sling Parent POM 22 with baselining enabled
     new 5154296  Correct method name
     new 55e51ed  Remove old slingstart model
     new 4b98c32  Refactor model and add basic read/write test
     new 98736d5  Consistent method naming and javadocs
     new 2341da7  Rename to provisoning model
     new 4d55db0  Rename to provisioning model
     new dc48bc1  Keep ${sling.home} in settings
     new fb3de37  Remove artifact on merge regardless of the start level
     new 43e7bcf  Fix writing out raw configs
     new 54361e3  Fix writing out raw configs
     new d71c810  Fix reading configs
     new bbe9bcd  Allow comments in configurations
     new bccda6c  Add some tests to verify the parsed and effective models
     new c47da2f  [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.0.0
     new e93aff8  [maven-release-plugin] prepare for next development iteration
     new 7aee9d5  Fix comments
     new ee05f2c  Update to latest launchpad base release
     new 523138f  SLING-4473 : Provide a way to remove settings, artifacts and features through a model SLING-4475 : Artifact is twice in feature after merge
     new 94c918f  [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.1.0
     new 15d9a12  [maven-release-plugin] prepare for next development iteration
     new 89e8cf9  Add test case for run modes
     new 97ac28f  Update test case
     new 52ee32c  Fix javadocs
     new 7a21cc8  Add missing licence headers
     new ceeb1f7  SLING-4698 - Set parent.relativePath to empty for all modules
     new 43429c2  SLING-4768 : Sort entries alphabetical in written model
     new fba2533  SLING-4768 : Sort entries alphabetical in written model
     new ee04adc  SLING-4768 : Sort entries alphabetical in written model
     new 9c0eaaa  SLING-4766 Provisioning Model does not support adding variables to Sling Settings - allow escaping with \${var}
     new 9dcb074  SLING-4768 : Sort entries alphabetical in written model
     new 1f2cf68  SLING-4782 : Update to latest format from Apache Felix config admin
     new f66c21e  SLING-4786 : Attributes and configuration format are wronlgy written out
     new 2192bda  SLING-4126 : Provide a mechanism to merge configurations
     new 5f9f27c  SLING-4126 : Provide a mechanism to merge configurations
     new bd96e54  SLING-4124 : Bootstrap command file can't be appended
     new c2b343f  SLING-4790 : Removal of artifacts from inherited model is not possible
     new 9c0fcd5  [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.2.0
     new 690eb71  [maven-release-plugin] prepare for next development iteration
     new 0972528  SLING-4807 : Variables in configurations are not replaced
     new 312ade9  Update to Sling Parent 23
     new 1d0ef5f  Remove superflous sling.java.version=6 as it's the default now
     new 58dbd4a  set parent version to 24 and add empty relativePath where missing
     new 3509c1f  SLING-4645 Update Tika to 1.9
     new bbf7873  SLING-4880 Allow to get artifact versions from POM
     new 6a392fa  SLING-4879 refactor model processing logic from ModelUtility#getEffectiveModel into separate class to make it reusable
     new 82e4d3f  SLING-4879 move resolver/replace logic to separate class ModelResolverUtility
     new 7d6e31f  SLING-4807 make sure variable replacement is applied whether custom resolver exists or not
     new 5eea7de  SLING-4879 add ModelUtility.applyVariables method that allows to inject further variables from a custom variable resolver
     new ce9607f  SLING-4880 apply resolved dependencies to raw model instead of attaching effective model add new optional parameter "allowUnresolvedPomDependencies" (default: false)
     new 84e3f39  fix some javadoc errors java 8 complains about
     new 9a36bf7  SLING-4807 introduce explicit boolean flag to make sure variable replacement does not take place when merging models
     new e3b7720  [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.3.0
     new b0181cd  [maven-release-plugin] prepare for next development iteration
     new 9a80232  Update the main reactor to parent 25
     new b36cc99  SLING-5148 : Support OSGi Subsystems in the Sling Provisioning model. Apply patch from David Bosschaert
     new d0779ce  SLING-5172 : Provide support for custom sections in the provisioning model
     new 7fa8736  SLING-5148 : Support OSGi Subsystems in the Sling Provisioning model.
     new 94bc251  SLING-5174 : Refactor merging of models into separate utility class and add merge options
     new 4a90126  git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1709754 13f79535-47bb-0310-9956-ffa450edef68
     new b0f38e7  SLING-5172 : Provide support for custom sections in the provisioning model
     new 42a911c  SLING-5174 : Refactor merging of models into separate utility class and add merge options
     new b05b9ce  [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.4.0
     new d7059e2  [maven-release-plugin] prepare for next development iteration
     new 6bb2a5e  SLING-5185 : Version comparision is wrong in case of qualifiers
     new 2c05c45  SLING-5189 : Improve start level handling when merging models
     new 967d25a  SLING-5318 : Sling provisioning model does not propagate Artifact metadata during processing. Apply patch from David Bosschaert
     new a4b997d  [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.4.2
     new 7e1771e  [maven-release-plugin] copy for tag org.apache.sling.provisioning.model-1.4.2

The 87 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
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-provisioning-model] 02/06: SLING-5185 : Version comparision is wrong in case of qualifiers

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit 6bb2a5eeabfd0f396cea8c6f8de916544667c23c
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Oct 22 12:02:38 2015 +0000

    SLING-5185 : Version comparision is wrong in case of qualifiers
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1709998 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/provisioning/model/Version.java   |  9 ++++++-
 .../sling/provisioning/model/VersionTest.java      | 29 +++++++++++++++++-----
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/sling/provisioning/model/Version.java b/src/main/java/org/apache/sling/provisioning/model/Version.java
index 8d5e990..028057d 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Version.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Version.java
@@ -119,7 +119,14 @@ public class Version implements Comparable<Version> {
 	            if (result == 0) {
 	                result = microVersion - other.microVersion;
 	                if (result == 0) {
-	                    result = other.qualifier.compareTo(qualifier);
+	                    result = qualifier.compareTo(other.qualifier);
+	                    if ( result != 0 ) {
+	                        if ( "SNAPSHOT".equals(qualifier) ) {
+	                            result = -1;
+	                        } else if ( "SNAPSHOT".equals(other.qualifier) ) {
+	                            result = 1;
+	                        }
+	                    }
 	                }
 	            }
 
diff --git a/src/test/java/org/apache/sling/provisioning/model/VersionTest.java b/src/test/java/org/apache/sling/provisioning/model/VersionTest.java
index d242c8c..f478df9 100644
--- a/src/test/java/org/apache/sling/provisioning/model/VersionTest.java
+++ b/src/test/java/org/apache/sling/provisioning/model/VersionTest.java
@@ -60,13 +60,30 @@ public class VersionTest {
     }
 
     @Test
-    public void testQualifier() {
-        final String v1 = "1";
-        final String v1snapshot = "1-SNAPSHOT";
+    public void testSnapshotQualifier() {
+        final Version v1 = new Version("1");
+        final Version v1snapshot = new Version("1-SNAPSHOT");
+        final Version v1a = new Version("1-A");
 
-        final Version ve1 = new Version(v1);
-        final Version ve1snapshot = new Version(v1snapshot);
+        // snapshot is lower than the corresponding version
+        assertTrue(v1.compareTo(v1snapshot) > 0);
+        assertTrue(v1snapshot.compareTo(v1) < 0);
+
+        // qualifier is higher than the version
+        assertTrue(v1a.compareTo(v1) > 0);
+        assertTrue(v1.compareTo(v1a) < 0);
+
+        // qualifier is higher than snapshot
+        assertTrue(v1a.compareTo(v1snapshot) > 0);
+        assertTrue(v1snapshot.compareTo(v1a) < 0);
+    }
+
+    @Test
+    public void testQualifiers() {
+        final Version va = new Version("1-A");
+        final Version vb = new Version("1-B");
 
-        assertTrue(ve1.compareTo(ve1snapshot) > 0);
+        assertTrue(va.compareTo(vb) < 0);
+        assertTrue(vb.compareTo(va) > 0);
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-provisioning-model] 05/06: [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.4.2

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit a4b997d8316fb875f08a3663b46776e260e51f06
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 22 06:08:09 2015 +0000

    [maven-release-plugin] prepare release org.apache.sling.provisioning.model-1.4.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1721297 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 03dfcf9..1b23598 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     </parent>
 
     <artifactId>org.apache.sling.provisioning.model</artifactId>
-    <version>1.4.1-SNAPSHOT</version>
+    <version>1.4.2</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Provisioning Model</name>
@@ -31,9 +31,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/tooling/support/provisioning-model</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.provisioning.model-1.4.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.provisioning.model-1.4.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.provisioning.model-1.4.2</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-provisioning-model] 03/06: SLING-5189 : Improve start level handling when merging models

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit 2c05c45ef6962dcc61f2b89c1dcfb156d55b940f
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 26 17:52:10 2015 +0000

    SLING-5189 : Improve start level handling when merging models
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1710664 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/provisioning/model/MergeUtility.java     | 25 ++++++++++++++++++++-
 .../sling/provisioning/model/MergeUtilityTest.java | 19 ++++++++++++++++
 src/test/resources/merge/startlevel-base.txt       | 26 ++++++++++++++++++++++
 src/test/resources/merge/startlevel-merge.txt      | 26 ++++++++++++++++++++++
 4 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java b/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java
index 85e3ad5..0d18a05 100644
--- a/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java
+++ b/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java
@@ -84,6 +84,21 @@ public abstract class MergeUtility {
 
     /**
      * Merge the additional model into the base model.
+     * <p>
+     * Merging is performed feature by feature. Each feature is treated separately.
+     * If the base model does not have a feature from the additional model, the complete
+     * feature is added. If the base model has a feature which is not in the additional model,
+     * the feature is left as is.
+     * <p>
+     * For each feature, the following actions are performed:
+     * <ul>
+     *   <li>The feature type of the base feature is set to the type of the additional feature.</li>
+     *   <li>All additional sections of the additional feature are added to the base feature.</li>
+     *   <li>All variables from the additional feature are set on the base feature, overriding
+     *    values if already present.</li>
+     *   <li>Each run mode of the additional feature is merged into the base feature.</li>
+     * </ul>
+     * <p>
      * @param base The base model.
      * @param additional The additional model.
      * @param options The merge options
@@ -115,6 +130,8 @@ public abstract class MergeUtility {
                 for(final ArtifactGroup group : runMode.getArtifactGroups()) {
                     final ArtifactGroup baseGroup = baseRunMode.getOrCreateArtifactGroup(group.getStartLevel());
 
+                    int foundStartLevel = 0;
+
                     for(final Artifact artifact : group) {
                         boolean addArtifact = true;
                         for(final ArtifactGroup searchGroup : baseRunMode.getArtifactGroups()) {
@@ -122,11 +139,13 @@ public abstract class MergeUtility {
                             if ( found != null ) {
                                 if ( options.isLatestArtifactWins() ) {
                                     searchGroup.remove(found);
+                                    foundStartLevel = searchGroup.getStartLevel();
                                 } else {
                                     final Version baseVersion = new Version(found.getVersion());
                                     final Version mergeVersion = new Version(artifact.getVersion());
                                     if ( baseVersion.compareTo(mergeVersion) <= 0 ) {
                                         searchGroup.remove(found);
+                                        foundStartLevel = searchGroup.getStartLevel();
                                     } else {
                                         addArtifact = false;
                                     }
@@ -134,7 +153,11 @@ public abstract class MergeUtility {
                             }
                         }
                         if ( addArtifact ) {
-                            baseGroup.add(artifact);
+                            if ( group.getStartLevel() == 0 && foundStartLevel != 0 ) {
+                                baseRunMode.getOrCreateArtifactGroup(foundStartLevel).add(artifact);
+                            } else {
+                                baseGroup.add(artifact);
+                            }
                         }
                     }
                 }
diff --git a/src/test/java/org/apache/sling/provisioning/model/MergeUtilityTest.java b/src/test/java/org/apache/sling/provisioning/model/MergeUtilityTest.java
index 6f35fb0..afff784 100644
--- a/src/test/java/org/apache/sling/provisioning/model/MergeUtilityTest.java
+++ b/src/test/java/org/apache/sling/provisioning/model/MergeUtilityTest.java
@@ -272,4 +272,23 @@ public class MergeUtilityTest {
         assertEquals("bar", cfgB.getProperties().get("foo"));
         assertArrayEquals(new Integer[] {1,2,3}, (Integer[])cfgC.getProperties().get("array"));
     }
+
+    @Test public void mergeStartlevelTest() throws Exception {
+        final Model model = U.readTestModel("merge/startlevel-base.txt");
+        final Model merge = U.readTestModel("merge/startlevel-merge.txt");
+        MergeUtility.merge(model, merge);
+
+        assertNotNull(model.getFeature("f"));
+        assertNotNull(model.getFeature("f").getRunMode());
+        assertNotNull(model.getFeature("f").getRunMode().getArtifactGroup(3));
+        assertNotNull(model.getFeature("f").getRunMode().getArtifactGroup(5));
+        final List<Artifact> list5 = U.assertArtifactsInGroup(model.getFeature("f").getRunMode().getArtifactGroup(5), 1);
+        U.assertArtifact(list5.get(0), "g", "a", "2.0.0", "jar", null);
+
+        final List<Artifact> list3 = U.assertArtifactsInGroup(model.getFeature("f").getRunMode().getArtifactGroup(3), 1);
+        U.assertArtifact(list3.get(0), "g", "b", "1.1.0", "jar", null);
+
+        final List<Artifact> list = U.assertArtifactsInGroup(model.getFeature("f").getRunMode().getArtifactGroup(0), 1);
+        U.assertArtifact(list.get(0), "g", "c", "1.6.0", "jar", null);
+    }
 }
diff --git a/src/test/resources/merge/startlevel-base.txt b/src/test/resources/merge/startlevel-base.txt
new file mode 100644
index 0000000..bddadbd
--- /dev/null
+++ b/src/test/resources/merge/startlevel-base.txt
@@ -0,0 +1,26 @@
+#
+#  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.
+#
+[feature name=f]
+
+[artifacts startLevel=5]
+ g/a/1.0.0
+ 
+[artifacts]
+ g/b/1.0.0
+ g/c/1.0.0 
diff --git a/src/test/resources/merge/startlevel-merge.txt b/src/test/resources/merge/startlevel-merge.txt
new file mode 100644
index 0000000..ae04e2a
--- /dev/null
+++ b/src/test/resources/merge/startlevel-merge.txt
@@ -0,0 +1,26 @@
+#
+#  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.
+#
+[feature name=f]
+
+[artifacts]
+ g/a/2.0.0
+ g/c/1.6.0
+ 
+[artifacts startLevel=3]
+ g/b/1.1.0

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-provisioning-model] 01/06: [maven-release-plugin] prepare for next development iteration

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit d7059e2b3e572dfd356732e354a6961266150c74
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Oct 21 13:03:41 2015 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1709827 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 8fe0978..03dfcf9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
     </parent>
 
     <artifactId>org.apache.sling.provisioning.model</artifactId>
-    <version>1.4.0</version>
+    <version>1.4.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Provisioning Model</name>
@@ -31,9 +31,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.provisioning.model-1.4.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.provisioning.model-1.4.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.provisioning.model-1.4.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/tooling/support/provisioning-model</url>
     </scm>
 
     <build>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-provisioning-model] 04/06: SLING-5318 : Sling provisioning model does not propagate Artifact metadata during processing. Apply patch from David Bosschaert

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit 967d25a0bb0336717aca9b4d6a7de3476703fed7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Nov 27 07:21:10 2015 +0000

    SLING-5318 : Sling provisioning model does not propagate Artifact metadata during processing. Apply patch from David Bosschaert
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1716803 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/provisioning/model/Artifact.java  | 20 +++++++++++++++
 .../model/EffectiveModelProcessor.java             |  4 +--
 .../sling/provisioning/model/ModelUtility.java     |  3 ++-
 .../sling/provisioning/model/package-info.java     |  2 +-
 .../org/apache/sling/provisioning/model/U.java     | 30 ++++++++++++++--------
 src/test/resources/example.txt                     |  4 +--
 6 files changed, 46 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/sling/provisioning/model/Artifact.java b/src/main/java/org/apache/sling/provisioning/model/Artifact.java
index 9649671..f410066 100644
--- a/src/main/java/org/apache/sling/provisioning/model/Artifact.java
+++ b/src/main/java/org/apache/sling/provisioning/model/Artifact.java
@@ -16,6 +16,7 @@
  */
 package org.apache.sling.provisioning.model;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -54,6 +55,24 @@ public class Artifact extends Commentable implements Comparable {
             final String version,
             final String classifier,
             final String type) {
+        this(gId, aId, version, classifier, type, Collections.<String, String>emptyMap());
+    }
+
+    /**
+     * Create a new artifact object
+     * @param gId   The group id (required)
+     * @param aId   The artifact id (required)
+     * @param version The version (required)
+     * @param classifier The classifier (optional)
+     * @param type The type/extension (optional, defaults to jar)
+     * @param metadata The metadata associated with the Artifact
+     */
+    public Artifact(final String gId,
+            final String aId,
+            final String version,
+            final String classifier,
+            final String type,
+            final Map<String, String> metadata) {
         this.groupId = (gId != null ? gId.trim() : null);
         this.artifactId = (aId != null ? aId.trim() : null);
         this.version = (version != null ? version.trim() : null);
@@ -69,6 +88,7 @@ public class Artifact extends Commentable implements Comparable {
         } else {
             this.classifier = trimmedClassifier;
         }
+        this.metadata.putAll(metadata);
     }
 
     /**
diff --git a/src/main/java/org/apache/sling/provisioning/model/EffectiveModelProcessor.java b/src/main/java/org/apache/sling/provisioning/model/EffectiveModelProcessor.java
index 8a18d8f..c2efa5c 100644
--- a/src/main/java/org/apache/sling/provisioning/model/EffectiveModelProcessor.java
+++ b/src/main/java/org/apache/sling/provisioning/model/EffectiveModelProcessor.java
@@ -31,7 +31,7 @@ import org.apache.sling.provisioning.model.ModelUtility.VariableResolver;
  * Resolves all variables and artifact dependencies for the {@link ModelUtility#getEffectiveModel(Model)} method.
  */
 class EffectiveModelProcessor extends ModelProcessor {
-    
+
     private final ResolverOptions options;
 
     public EffectiveModelProcessor(ResolverOptions options) {
@@ -50,7 +50,7 @@ class EffectiveModelProcessor extends ModelProcessor {
         final String type = replace(newFeature, artifact.getType(), options.getVariableResolver());
         final String resolvedVersion = resolveArtifactVersion(groupId, artifactId, version, classifier, type,
                 options.getArtifactVersionResolver());
-        return new Artifact(groupId, artifactId, resolvedVersion, classifier, type);
+        return new Artifact(groupId, artifactId, resolvedVersion, classifier, type, artifact.getMetadata());
     }
 
     @Override
diff --git a/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java b/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java
index f01445d..376a80a 100644
--- a/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java
+++ b/src/main/java/org/apache/sling/provisioning/model/ModelUtility.java
@@ -310,7 +310,8 @@ public abstract class ModelUtility {
                         artifact.getArtifactId(),
                         newVersion,
                         artifact.getClassifier(),
-                        artifact.getType());
+                        artifact.getType(),
+                        artifact.getMetadata());
             }
         };
 
diff --git a/src/main/java/org/apache/sling/provisioning/model/package-info.java b/src/main/java/org/apache/sling/provisioning/model/package-info.java
index 656dcb0..a8beffb 100644
--- a/src/main/java/org/apache/sling/provisioning/model/package-info.java
+++ b/src/main/java/org/apache/sling/provisioning/model/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.4.0")
+@Version("1.5.0")
 package org.apache.sling.provisioning.model;
 
 import aQute.bnd.annotation.Version;
diff --git a/src/test/java/org/apache/sling/provisioning/model/U.java b/src/test/java/org/apache/sling/provisioning/model/U.java
index 45ac79c..064cc0e 100644
--- a/src/test/java/org/apache/sling/provisioning/model/U.java
+++ b/src/test/java/org/apache/sling/provisioning/model/U.java
@@ -16,22 +16,23 @@
  */
 package org.apache.sling.provisioning.model;
 
-import static org.apache.sling.provisioning.model.ModelConstants.DEFAULT_RUN_MODE;
-import static org.apache.sling.provisioning.model.ModelConstants.DEFAULT_START_LEVEL;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.sling.provisioning.model.io.ModelReader;
 
+import static org.apache.sling.provisioning.model.ModelConstants.DEFAULT_RUN_MODE;
+import static org.apache.sling.provisioning.model.ModelConstants.DEFAULT_START_LEVEL;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 /** Test utilities */
 public class U {
 
@@ -39,10 +40,16 @@ public class U {
             new String[] {"boot.txt", "example.txt", "main.txt", "oak.txt"};
 
     public static void assertArtifact(ArtifactGroup g, String mvnUrl) {
+        assertArtifact(g, mvnUrl, Collections.<String,String>emptyMap());
+    }
+
+    public static void assertArtifact(ArtifactGroup g, String mvnUrl, Map<String, String> metadata) {
         final Artifact a = Artifact.fromMvnUrl(mvnUrl);
-        if(!g.items.contains(a)) {
+        int idx = g.items.indexOf(a);
+        if(idx < 0) {
             fail("Expecting ArtifactGroup to contain '" + mvnUrl + "': " + g);
         }
+        assertEquals("Incorrect metadata", metadata, g.items.get(idx).getMetadata());
     }
 
     /** Read our test model by merging our TEST_MODEL_FILENAMES */
@@ -111,7 +118,8 @@ public class U {
 
         {
             final ArtifactGroup g = getGroup(m, "example", DEFAULT_RUN_MODE, DEFAULT_START_LEVEL);
-            U.assertArtifact(g, "mvn:commons-collections/commons-collections/3.2.1/jar");
+            U.assertArtifact(g, "mvn:commons-collections/commons-collections/3.2.1/jar",
+                    Collections.singletonMap("private-packages", "*"));
             U.assertArtifact(g, "mvn:org.example/jar-is-default/1.2/jar");
         }
 
@@ -135,7 +143,7 @@ public class U {
         final Feature exampleFeature = m.getFeature("example");
         final RunMode defaultExampleRM = exampleFeature.getRunMode();
         final List<Configuration> configs = assertConfigurationsInRunMode(defaultExampleRM, 3);
-        assertEquals(FeatureTypes.SUBSYSTEM_FEATURE, exampleFeature.getType());
+        assertEquals(FeatureTypes.SUBSYSTEM_COMPOSITE, exampleFeature.getType());
         final Configuration cfg = assertConfiguration(configs, "org.apache.sling.another.config");
     }
 
diff --git a/src/test/resources/example.txt b/src/test/resources/example.txt
index 8dc198b..796ce17 100644
--- a/src/test/resources/example.txt
+++ b/src/test/resources/example.txt
@@ -20,7 +20,7 @@
 #
 # A feature consists of variables and run mode dependent artifacts.
 #
-[feature name=example type=osgi.subsystem.feature]
+[feature name=example type=osgi.subsystem.composite]
 # The variables are global and can be used within artifact definitions, configurations,
 # and settings.
 #
@@ -38,7 +38,7 @@
 [artifacts]
     commons-io/commons-io/1.4/jar
     commons-fileupload/commons-fileupload/1.3.1/jar
-    commons-collections/commons-collections/3.2.1/jar
+    commons-collections/commons-collections/3.2.1/jar [private-packages=*]
     commons-codec/commons-codec/1.9/jar
     commons-lang/commons-lang/2.6/jar
     org.apache.commons/commons-math/2.2/jar

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-provisioning-model] 06/06: [maven-release-plugin] copy for tag org.apache.sling.provisioning.model-1.4.2

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

rombert pushed a commit to annotated tag org.apache.sling.provisioning.model-1.4.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit 7e1771e81826449e347a787ea9a1644fe24d37a7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 22 06:08:22 2015 +0000

    [maven-release-plugin] copy for tag org.apache.sling.provisioning.model-1.4.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.provisioning.model-1.4.2@1721298 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.