You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/06/25 00:05:42 UTC

[sling-org-apache-sling-feature-cpconverter] branch avoid_subpackages_flattering updated (abb5743 -> 5cb7b39)

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

simonetripodi pushed a change to branch avoid_subpackages_flattering
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git.


    from abb5743  SLING-8529 - Avoid flattening of subpackages during convertion in featuremodel
     add f33f968  SLING-8528 - ACLs for Serviceusers on nodes with nodetypes registered via content-package may break startup in repoinit.
     new 5cb7b39  Merge branch 'master' into avoid_subpackages_flattering

The 1 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.


Summary of changes:
 .../ContentPackage2FeatureModelConverter.java      | 12 +++++
 .../sling/feature/cpconverter/acl/AclManager.java  |  2 +
 .../feature/cpconverter/acl/DefaultAclManager.java | 27 ++++++++++
 .../vltpkg/BaseVaultPackageScanner.java            | 40 ++++++++++++--
 .../cpconverter/vltpkg/VaultPackageAssembler.java  | 35 ++++++------
 .../ContentPackage2FeatureModelConverterTest.java  | 38 +++++++++++++
 .../cpconverter/vltpkg/NodeTypesDetectionTest.java | 63 ++++++++++++++++++++++
 7 files changed, 198 insertions(+), 19 deletions(-)
 create mode 100644 src/test/java/org/apache/sling/feature/cpconverter/vltpkg/NodeTypesDetectionTest.java


[sling-org-apache-sling-feature-cpconverter] 01/01: Merge branch 'master' into avoid_subpackages_flattering

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

simonetripodi pushed a commit to branch avoid_subpackages_flattering
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git

commit 5cb7b3907b7fe61cb477423def6d7b6b459f113c
Merge: abb5743 f33f968
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 25 02:05:34 2019 +0200

    Merge branch 'master' into avoid_subpackages_flattering
    
    # Conflicts:
    #	src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java

 .../ContentPackage2FeatureModelConverter.java      | 12 +++++
 .../sling/feature/cpconverter/acl/AclManager.java  |  2 +
 .../feature/cpconverter/acl/DefaultAclManager.java | 27 ++++++++++
 .../vltpkg/BaseVaultPackageScanner.java            | 40 ++++++++++++--
 .../cpconverter/vltpkg/VaultPackageAssembler.java  | 35 ++++++------
 .../ContentPackage2FeatureModelConverterTest.java  | 38 +++++++++++++
 .../cpconverter/vltpkg/NodeTypesDetectionTest.java | 63 ++++++++++++++++++++++
 7 files changed, 198 insertions(+), 19 deletions(-)

diff --cc src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
index 3bd9fe8,0769975..524966c
--- a/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/ContentPackage2FeatureModelConverter.java
@@@ -276,26 -292,14 +278,36 @@@ public class ContentPackage2FeatureMode
          entryHandler.handle(entryPath, archive, entry, this);
      }
  
 +    private static ArtifactId toArtifactId(VaultPackage vaultPackage) {
 +        PackageId packageId = vaultPackage.getId();
 +        String groupId = requireNonNull(packageId.getGroup(),
 +                                        PackageProperties.NAME_GROUP
 +                                        + " property not found in content-package "
 +                                        + vaultPackage
 +                                        + ", please check META-INF/vault/properties.xml").replace('/', '.'); 
 +
 +        String artifactid = requireNonNull(packageId.getName(),
 +                                           PackageProperties.NAME_NAME
 +                                           + " property not found in content-package "
 +                                           + vaultPackage
 +                                           + ", please check META-INF/vault/properties.xml");
 +
 +        String version = packageId.getVersionString();
 +        if (version == null || version.isEmpty()) {
 +            version = DEFEAULT_VERSION;
 +        }
 +
 +        return new ArtifactId(groupId, artifactid, version, PACKAGE_CLASSIFIER, ZIP_TYPE);
 +    }
 +
+     @Override
+     protected void onCndEntry(String path, Archive archive, Entry entry) throws Exception {
+         try (BufferedReader reader = new BufferedReader(new InputStreamReader(archive.openInputStream(entry)))) {
+             String nodetypeRegistrationSentence;
+             while ((nodetypeRegistrationSentence = reader.readLine()) != null) {
+                 aclManager.addNodetypeRegistrationSentence(nodetypeRegistrationSentence);
+             }
+         }
+     }
+ 
  }
diff --cc src/test/java/org/apache/sling/feature/cpconverter/vltpkg/NodeTypesDetectionTest.java
index 0000000,767a60e..fe0bee8
mode 000000,100644..100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/vltpkg/NodeTypesDetectionTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/vltpkg/NodeTypesDetectionTest.java
@@@ -1,0 -1,63 +1,63 @@@
+ /*
+  * 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.cpconverter.vltpkg;
+ 
+ import static org.junit.Assert.assertEquals;
+ import static org.junit.Assert.assertFalse;
+ import static org.junit.Assert.assertTrue;
+ import static org.apache.commons.io.FileUtils.toFile;
+ 
+ import java.io.File;
+ import java.net.URL;
+ import java.util.LinkedList;
+ import java.util.List;
+ 
+ import org.apache.jackrabbit.vault.fs.io.Archive;
+ import org.apache.jackrabbit.vault.fs.io.Archive.Entry;
+ import org.apache.sling.feature.cpconverter.vltpkg.BaseVaultPackageScanner;
+ import org.junit.Before;
+ import org.junit.Test;
+ 
+ public class NodeTypesDetectionTest {
+ 
+     private File packageFile;
+ 
+     @Before
+     public void setUp() {
 -        URL packageURL = getClass().getResource("test_a-1.0.zip");
++        URL packageURL = getClass().getResource("../test_a-1.0.zip");
+         packageFile = toFile(packageURL);
+     }
+ 
+     @Test
+     public void detectMetaInfVaultNodetypesCdnFile() throws Exception {
+         final List<String> detectedCndFiles = new LinkedList<>();
+ 
+         new BaseVaultPackageScanner(true) {
+ 
+             @Override
+             protected void onCndEntry(String path, Archive archive, Entry entry) throws Exception {
+                 detectedCndFiles.add(path);
+             }
+ 
+         }.traverse(packageFile, true);
+ 
+         assertFalse(detectedCndFiles.isEmpty());
+         assertEquals(1, detectedCndFiles.size());
+         assertTrue(detectedCndFiles.contains("META-INF/vault/nodetypes.cnd"));
+     }
+ 
+ }