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/11/07 11:50:20 UTC

[sling-whiteboard] branch master updated: Removing graduted component feature-apiregions

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-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new ae34568  Removing graduted component feature-apiregions
ae34568 is described below

commit ae34568a6eaa5ac51e06fb8c23646f7756d44bf8
Author: David Bosschaert <bo...@adobe.com>
AuthorDate: Wed Nov 7 11:49:28 2018 +0000

    Removing graduted component feature-apiregions
    
    This component has migrated to
    https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-apiregions.git
---
 featuremodel/feature-apiregions/.gitignore         |  17 --
 featuremodel/feature-apiregions/CODE_OF_CONDUCT.md |  22 --
 featuremodel/feature-apiregions/CONTRIBUTING.md    |  24 --
 featuremodel/feature-apiregions/LICENSE            | 202 ----------------
 featuremodel/feature-apiregions/README.md          |  17 --
 featuremodel/feature-apiregions/pom.xml            |  85 -------
 .../sling/feature/apiregions/impl/Activator.java   |  45 ----
 .../feature/apiregions/impl/RegionEnforcer.java    | 161 -------------
 .../feature/apiregions/impl/ResolverHookImpl.java  | 216 -----------------
 .../feature/apiregions/impl/ActivatorTest.java     |  69 ------
 .../apiregions/impl/RegionEnforcerTest.java        | 150 ------------
 .../apiregions/impl/ResolverHookImplTest.java      | 261 ---------------------
 .../src/test/resources/bundles1.properties         |   5 -
 .../src/test/resources/features1.properties        |   4 -
 .../src/test/resources/idbsnver1.properties        |   6 -
 .../src/test/resources/regions1.properties         |   4 -
 16 files changed, 1288 deletions(-)

diff --git a/featuremodel/feature-apiregions/.gitignore b/featuremodel/feature-apiregions/.gitignore
deleted file mode 100644
index 5b783ed..0000000
--- a/featuremodel/feature-apiregions/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-/target
-.idea
-.classpath
-.metadata
-.project
-.settings
-.externalToolBuilders
-maven-eclipse.xml
-*.swp
-*.iml
-*.ipr
-*.iws
-*.bak
-.vlt
-.DS_Store
-jcr.log
-atlassian-ide-plugin.xml
diff --git a/featuremodel/feature-apiregions/CODE_OF_CONDUCT.md b/featuremodel/feature-apiregions/CODE_OF_CONDUCT.md
deleted file mode 100644
index 0fa18e5..0000000
--- a/featuremodel/feature-apiregions/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,22 +0,0 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  ~ 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.
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-Apache Software Foundation Code of Conduct
-====
-
-Being an Apache project, Apache Sling adheres to the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
diff --git a/featuremodel/feature-apiregions/CONTRIBUTING.md b/featuremodel/feature-apiregions/CONTRIBUTING.md
deleted file mode 100644
index ac82a1a..0000000
--- a/featuremodel/feature-apiregions/CONTRIBUTING.md
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-  ~ 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.
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
-Contributing
-====
-
-Thanks for choosing to contribute!
-
-You will find all the necessary details about how you can do this at https://sling.apache.org/contributing.html.
diff --git a/featuremodel/feature-apiregions/LICENSE b/featuremodel/feature-apiregions/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/featuremodel/feature-apiregions/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.
diff --git a/featuremodel/feature-apiregions/README.md b/featuremodel/feature-apiregions/README.md
deleted file mode 100644
index b075f8a..0000000
--- a/featuremodel/feature-apiregions/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-[<img src="http://sling.apache.org/res/logos/sling.png"/>](http://sling.apache.org)
-
-[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
-
-# Apache Sling API Regions runtime component
-
-The API Regions runtime component is implemented as an OSGi Framework Extension bundle.
-This ensures that the runtime component is always present early in the startup process.
-
-This component registers an OSGi resolver hook service which enforces the API regions at runtime. The component looks for properties files that provide the configuration of the API regions. The properties files are generated by the `org.apache.sling.feature.extension.apiregions` component during the extension post-processing.
-
-As the component has no dependencies on any other component, the properties files are looked up via System Properties lookups:
-
-* `apiregions.idbsnver.properties` - provides the location of the `idbsnver.properties` file.
-* `apiregions.bundles.properties` - provides the location of the `bundles.properties` file.
-* `apiregions.features.properties` - provides the location of the `features.properties` file.
-* `apiregions.regions.properties` - provides the location of the `regions.properties` file.
diff --git a/featuremodel/feature-apiregions/pom.xml b/featuremodel/feature-apiregions/pom.xml
deleted file mode 100644
index 77f31d8..0000000
--- a/featuremodel/feature-apiregions/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?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>34</version>
-        <relativePath />
-    </parent>
-
-    <artifactId>org.apache.sling.feature.apiregions</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-    <packaging>bundle</packaging>
-
-    <name>Apache Sling Feature API Regions Runtime</name>
-    <description>
-        A runtime component to enforce API Regions
-    </description>
-
-    <properties>
-        <sling.java.version>8</sling.java.version>
-    </properties>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <ExtensionBundle-Activator>org.apache.sling.feature.apiregions.impl.Activator</ExtensionBundle-Activator>
-                        <Fragment-Host>system.bundle;extension:=framework</Fragment-Host>
-                    </instructions>
-                
-                    <!--  Skip baselining for 0.x version -->
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>*.md</exclude>
-                        <exclude>src/test/resources/*</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-    <dependencies>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>        
-
-        <!-- Testing -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-core</artifactId>
-            <version>2.8.9</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/Activator.java b/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/Activator.java
deleted file mode 100644
index 95f5cc7..0000000
--- a/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/Activator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.apiregions.impl;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.hooks.resolver.ResolverHookFactory;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-public class Activator implements BundleActivator {
-    static final String REGIONS_PROPERTY_NAME = "org.apache.sling.feature.apiregions.regions";
-
-    @Override
-    public synchronized void start(BundleContext context) throws Exception {
-        String regions = context.getProperty(REGIONS_PROPERTY_NAME);
-        if (regions == null)
-            return; // Component not enabled
-
-        Dictionary<String, Object> props = new Hashtable<>();
-        RegionEnforcer enforcer = new RegionEnforcer(props, regions);
-        context.registerService(ResolverHookFactory.class, enforcer, props);
-    }
-
-    @Override
-    public synchronized void stop(BundleContext context) throws Exception {
-    }
-}
diff --git a/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/RegionEnforcer.java b/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/RegionEnforcer.java
deleted file mode 100644
index cf20e0d..0000000
--- a/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/RegionEnforcer.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.apiregions.impl;
-
-import org.osgi.framework.Version;
-import org.osgi.framework.hooks.resolver.ResolverHook;
-import org.osgi.framework.hooks.resolver.ResolverHookFactory;
-import org.osgi.framework.wiring.BundleRevision;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-class RegionEnforcer implements ResolverHookFactory {
-    public static String GLOBAL_REGION = "global";
-
-    static final String PROPERTIES_FILE_PREFIX = "apiregions.";
-    static final String IDBSNVER_FILENAME = "idbsnver.properties";
-    static final String BUNDLE_FEATURE_FILENAME = "bundles.properties";
-    static final String FEATURE_REGION_FILENAME = "features.properties";
-    static final String REGION_PACKAGE_FILENAME = "regions.properties";
-
-    final Map<Map.Entry<String, Version>, List<String>> bsnVerMap;
-    final Map<String, Set<String>> bundleFeatureMap;
-    final Map<String, Set<String>> featureRegionMap;
-    final Map<String, Set<String>> regionPackageMap;
-    final Set<String> enabledRegions;
-
-    RegionEnforcer(Dictionary<String, Object> regProps, String regionsProp) throws IOException {
-        File idbsnverFile = getDataFile(IDBSNVER_FILENAME);
-        bsnVerMap = populateBSNVerMap(idbsnverFile);
-        if (idbsnverFile != null) {
-            regProps.put(IDBSNVER_FILENAME, idbsnverFile.getAbsolutePath());
-        }
-
-        File bundlesFile = getDataFile(BUNDLE_FEATURE_FILENAME);
-        bundleFeatureMap = populateBundleFeatureMap(bundlesFile);
-        if (bundlesFile != null) {
-            regProps.put(BUNDLE_FEATURE_FILENAME, bundlesFile.getAbsolutePath());
-        }
-
-        File featuresFile = getDataFile(FEATURE_REGION_FILENAME);
-        featureRegionMap = populateFeatureRegionMap(featuresFile);
-        if (featuresFile != null) {
-            regProps.put(FEATURE_REGION_FILENAME, featuresFile.getAbsolutePath());
-        }
-
-        File regionsFile = getDataFile(REGION_PACKAGE_FILENAME);
-        regionPackageMap = populateRegionPackageMap(regionsFile);
-        if (regionsFile != null) {
-            regProps.put(REGION_PACKAGE_FILENAME, regionsFile.getAbsolutePath());
-        }
-
-        enabledRegions = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(regionsProp.split(","))));
-    }
-
-    private Map<Map.Entry<String, Version>, List<String>> populateBSNVerMap(File idbsnverFile) throws IOException {
-        if (idbsnverFile != null && idbsnverFile.exists()) {
-            Map<Map.Entry<String, Version>, List<String>> m = new HashMap<>();
-
-            Properties p = new Properties();
-            try (InputStream is = new FileInputStream(idbsnverFile)) {
-                p.load(is);
-            }
-
-            for (String n : p.stringPropertyNames()) {
-                String[] bsnver = p.getProperty(n).split("~");
-                Map.Entry<String, Version> key = new AbstractMap.SimpleEntry<String, Version>(bsnver[0], Version.valueOf(bsnver[1]));
-                List<String> l = m.get(key);
-                if (l == null) {
-                    l = new ArrayList<>();
-                    m.put(key, l);
-                }
-                l.add(n);
-            }
-
-            Map<Map.Entry<String, Version>, List<String>> m2 = new HashMap<>();
-
-            for (Map.Entry<Map.Entry<String, Version>, List<String>> entry : m.entrySet()) {
-                m2.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
-            }
-
-            return Collections.unmodifiableMap(m2);
-        } else {
-            return Collections.emptyMap();
-        }
-    }
-
-    private Map<String, Set<String>> populateBundleFeatureMap(File bundlesFile) throws IOException {
-        return loadMap(bundlesFile);
-    }
-
-    private Map<String, Set<String>> populateFeatureRegionMap(File featuresFile) throws IOException {
-        return loadMap(featuresFile);
-    }
-
-    private Map<String, Set<String>> populateRegionPackageMap(File regionsFile) throws IOException {
-        return loadMap(regionsFile);
-    }
-
-    private Map<String, Set<String>> loadMap(File propsFile) throws IOException {
-        Map<String, Set<String>> m = new HashMap<>();
-
-        if (propsFile != null && propsFile.exists()) {
-            Properties p = new Properties();
-            try (InputStream is = new FileInputStream(propsFile)) {
-                p.load(is);
-            }
-
-            for (String n : p.stringPropertyNames()) {
-                String[] features = p.getProperty(n).split(",");
-                m.put(n, Collections.unmodifiableSet(new HashSet<>(Arrays.asList(features))));
-            }
-        }
-
-        return Collections.unmodifiableMap(m);
-    }
-
-    private File getDataFile(String name) throws IOException {
-        String fn = System.getProperty(PROPERTIES_FILE_PREFIX + name);
-        if (fn == null)
-            return null;
-        return new File(fn);
-    }
-
-    @Override
-    public ResolverHook begin(Collection<BundleRevision> triggers) {
-        if (enabledRegions.size() == 0)
-            return null;
-        return new ResolverHookImpl(bsnVerMap, bundleFeatureMap, featureRegionMap, regionPackageMap);
-    }
-}
diff --git a/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/ResolverHookImpl.java b/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/ResolverHookImpl.java
deleted file mode 100644
index 34f4409..0000000
--- a/featuremodel/feature-apiregions/src/main/java/org/apache/sling/feature/apiregions/impl/ResolverHookImpl.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * 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.apiregions.impl;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-import org.osgi.framework.hooks.resolver.ResolverHook;
-import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleRequirement;
-import org.osgi.framework.wiring.BundleRevision;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-class ResolverHookImpl implements ResolverHook {
-    private static final Logger LOG = Logger.getLogger(ResolverHookImpl.class.getName());
-
-    final Map<Map.Entry<String, Version>, List<String>> bsnVerMap;
-    final Map<String, Set<String>> bundleFeatureMap;
-    final Map<String, Set<String>> featureRegionMap;
-    final Map<String, Set<String>> regionPackageMap;
-
-    ResolverHookImpl(Map<Entry<String, Version>, List<String>> bsnVerMap, Map<String, Set<String>> bundleFeatureMap,
-            Map<String, Set<String>> featureRegionMap, Map<String, Set<String>> regionPackageMap) {
-        this.bsnVerMap = bsnVerMap;
-        this.bundleFeatureMap = bundleFeatureMap;
-        this.featureRegionMap = featureRegionMap;
-        this.regionPackageMap = regionPackageMap;
-    }
-
-    @Override
-    public void filterResolvable(Collection<BundleRevision> candidates) {
-        // Nothing to do
-    }
-
-    @Override
-    public void filterSingletonCollisions(BundleCapability singleton, Collection<BundleCapability> collisionCandidates) {
-        // Nothing to do
-    }
-
-    @Override
-    public void filterMatches(BundleRequirement requirement, Collection<BundleCapability> candidates) {
-        // Filtering is only on package resolution. Any other kind of resolution is not limited
-        if (!PackageNamespace.PACKAGE_NAMESPACE.equals(requirement.getNamespace()))
-            return;
-
-        Bundle reqBundle = requirement.getRevision().getBundle();
-        long reqBundleID = reqBundle.getBundleId();
-        String reqBundleName = reqBundle.getSymbolicName();
-        Version reqBundleVersion = reqBundle.getVersion();
-
-        Set<String> reqRegions = new HashSet<>();
-        List<String> reqFeatures = new ArrayList<>();
-        List<String> aids = bsnVerMap.get(new AbstractMap.SimpleEntry<String, Version>(reqBundleName, reqBundleVersion));
-        if (aids != null) {
-            for (String aid : aids) {
-                Set<String> fid = bundleFeatureMap.get(aid);
-                if (fid != null)
-                    reqFeatures.addAll(fid);
-            }
-
-            for (String feature : reqFeatures) {
-                Set<String> fr = featureRegionMap.get(feature);
-                if (fr != null) {
-                    reqRegions.addAll(fr);
-                }
-            }
-        } else {
-            // Bundle is not coming from a feature
-        }
-
-        Set<BundleCapability> coveredCaps = new HashSet<>();
-
-        Map<BundleCapability, Set<String>> bcRegionMap = new HashMap<>();
-        nextCapability:
-        for (BundleCapability bc : candidates) {
-            BundleRevision rev = bc.getRevision();
-
-            Bundle capBundle = rev.getBundle();
-            long capBundleID = capBundle.getBundleId();
-            if (capBundleID == 0) {
-                // always allow capability from the system bundle
-                coveredCaps.add(bc);
-                continue nextCapability;
-            }
-
-            if (capBundleID == reqBundleID) {
-                // always allow capability from same bundle
-                coveredCaps.add(bc);
-                continue nextCapability;
-            }
-
-            String capBundleName = capBundle.getSymbolicName();
-            Version capBundleVersion = capBundle.getVersion();
-
-            List<String> capBundleArtifacts = bsnVerMap.get(new AbstractMap.SimpleEntry<String, Version>(capBundleName, capBundleVersion));
-            if (capBundleArtifacts == null) {
-                // Capability is not in any feature, everyone can access
-                coveredCaps.add(bc);
-                continue nextCapability;
-            }
-
-            List<String> capFeatures = new ArrayList<>();
-            for (String ba : capBundleArtifacts) {
-                Set<String> capfeats = bundleFeatureMap.get(ba);
-                if (capfeats != null)
-                    capFeatures.addAll(capfeats);
-            }
-
-            if (capFeatures.isEmpty())
-                capFeatures = Collections.singletonList(null);
-
-            for (String capFeat : capFeatures) {
-                if (capFeat == null) {
-                    // always allow capability not coming from a feature
-                    coveredCaps.add(bc);
-                    continue nextCapability;
-                }
-
-                if (reqFeatures.contains(capFeat)) {
-                    // Within a single feature everything can wire to everything else
-                    coveredCaps.add(bc);
-                    continue nextCapability;
-                }
-
-                Set<String> capRegions = featureRegionMap.get(capFeat);
-                if (capRegions == null) {
-                    // If the feature hosting the capability has no regions defined, everyone can access
-                    coveredCaps.add(bc);
-                    continue nextCapability;
-                }
-                bcRegionMap.put(bc, capRegions);
-
-                HashSet<String> sharedRegions = new HashSet<String>(reqRegions);
-                sharedRegions.retainAll(capRegions);
-
-                Object pkg = bc.getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE);
-                if (pkg instanceof String) {
-                    String packageName = (String) pkg;
-
-                    Set<String> globalPackages = regionPackageMap.get("global");
-                    if (globalPackages != null && globalPackages.contains(packageName)) {
-                        // If the export is in the global region everyone can access
-                        coveredCaps.add(bc);
-                        continue nextCapability;
-                    }
-
-                    for (String region : sharedRegions) {
-                        Set<String> regionPackages = regionPackageMap.get(region);
-                        if (regionPackages != null && regionPackages.contains(packageName)) {
-                            // If the export is in a region that the feature is also in, then allow
-                            coveredCaps.add(bc);
-                            continue nextCapability;
-                        }
-                    }
-                }
-            }
-        }
-
-        List<BundleCapability> removedCandidates = new ArrayList<>(candidates);
-        // Remove any capabilities that are not covered
-        if (candidates.retainAll(coveredCaps)) {
-            removedCandidates.removeAll(candidates);
-
-            StringBuilder sb = new StringBuilder();
-            boolean first = true;
-            for (BundleCapability bc : removedCandidates) {
-                if (first)
-                    first = false;
-                else
-                    sb.append(", ");
-
-                sb.append(bc.toString());
-                sb.append("[Regions: ");
-                sb.append(bcRegionMap.get(bc));
-                sb.append("]");
-            }
-
-            LOG.log(Level.INFO,
-                    "API-Regions removed candidates {0} for requirement {1} as the requirement is in the following regions: {2}",
-                    new Object[] {sb, requirement, reqRegions});
-        }
-    }
-
-    @Override
-    public void end() {
-        // Nothing to do
-    }
-}
diff --git a/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/ActivatorTest.java b/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/ActivatorTest.java
deleted file mode 100644
index 20924c9..0000000
--- a/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/ActivatorTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.apiregions.impl;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.hooks.resolver.ResolverHookFactory;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.FEATURE_REGION_FILENAME;
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.PROPERTIES_FILE_PREFIX;
-
-public class ActivatorTest {
-    private Properties savedProps;
-
-    @Before
-    public void setup() {
-        savedProps = new Properties(); // note that new Properties(props) doesn't copy
-        savedProps.putAll(System.getProperties());
-    }
-
-    @After
-    public void teardown() {
-        System.setProperties(savedProps);
-        savedProps = null;
-    }
-
-    @Test
-    public void testStart() throws Exception {
-        String f = getClass().getResource("/features1.properties").getFile();
-        System.setProperty(PROPERTIES_FILE_PREFIX + FEATURE_REGION_FILENAME, f);
-
-        Dictionary<String, Object> expectedProps = new Hashtable<>();
-        expectedProps.put(FEATURE_REGION_FILENAME, f);
-
-        BundleContext bc = Mockito.mock(BundleContext.class);
-        Mockito.when(bc.getProperty(Activator.REGIONS_PROPERTY_NAME)).thenReturn("*");
-
-        Activator a = new Activator();
-        a.start(bc);
-
-        Mockito.verify(bc, Mockito.times(1)).registerService(
-                Mockito.eq(ResolverHookFactory.class),
-                Mockito.isA(RegionEnforcer.class),
-                Mockito.eq(expectedProps));
-    }
-}
diff --git a/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/RegionEnforcerTest.java b/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/RegionEnforcerTest.java
deleted file mode 100644
index 5d3fa22..0000000
--- a/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/RegionEnforcerTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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.apiregions.impl;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-import java.util.AbstractMap;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.BUNDLE_FEATURE_FILENAME;
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.FEATURE_REGION_FILENAME;
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.IDBSNVER_FILENAME;
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.PROPERTIES_FILE_PREFIX;
-import static org.apache.sling.feature.apiregions.impl.RegionEnforcer.REGION_PACKAGE_FILENAME;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class RegionEnforcerTest {
-    private Properties savedProps;
-
-    @Before
-    public void setup() {
-        savedProps = new Properties(); // note that new Properties(props) doesn't copy
-        savedProps.putAll(System.getProperties());
-    }
-
-    @After
-    public void teardown() {
-        System.setProperties(savedProps);
-        savedProps = null;
-    }
-
-    @Test
-    public void testRegionEnforcerNoConfiguration() throws Exception {
-        RegionEnforcer re = new RegionEnforcer(new Hashtable<>(), "*");
-        assertEquals(0, re.bsnVerMap.size());
-        assertEquals(0, re.bundleFeatureMap.size());
-        assertEquals(0, re.featureRegionMap.size());
-        assertEquals(0, re.regionPackageMap.size());
-    }
-
-    @Test
-    public void testLoadBSNVerMap() throws Exception {
-        String f = getClass().getResource("/idbsnver1.properties").getFile();
-        System.setProperty(PROPERTIES_FILE_PREFIX + IDBSNVER_FILENAME, f);
-
-        Hashtable<String, Object> props = new Hashtable<>();
-        RegionEnforcer re = new RegionEnforcer(props, "*");
-        assertEquals(2, re.bsnVerMap.size());
-        assertEquals(Collections.singletonList("g:b1:1"),
-                re.bsnVerMap.get(new AbstractMap.SimpleEntry<String,Version>("b1", new Version(1,0,0))));
-        assertEquals(new HashSet<>(Arrays.asList("g:b2:1.2.3", "g2:b2:1.2.4")),
-                new HashSet<>(re.bsnVerMap.get(new AbstractMap.SimpleEntry<String,Version>("b2", new Version(1,2,3)))));
-        assertEquals(f, props.get(IDBSNVER_FILENAME));
-    }
-
-    @Test
-    public void testLoadBundleFeatureMap() throws Exception {
-        String f = getClass().getResource("/bundles1.properties").getFile();
-        System.setProperty(PROPERTIES_FILE_PREFIX + BUNDLE_FEATURE_FILENAME, f);
-
-        Hashtable<String, Object> props = new Hashtable<>();
-        RegionEnforcer re = new RegionEnforcer(props, "*");
-        assertEquals(3, re.bundleFeatureMap.size());
-        assertEquals(Collections.singleton("org.sling:something:1.2.3:slingosgifeature:myclassifier"),
-                re.bundleFeatureMap.get("org.sling:b1:1"));
-        assertEquals(Collections.singleton("org.sling:something:1.2.3:slingosgifeature:myclassifier"),
-                re.bundleFeatureMap.get("org.sling:b2:1"));
-        assertEquals(new HashSet<>(Arrays.asList("some.other:feature:123", "org.sling:something:1.2.3:slingosgifeature:myclassifier")),
-                re.bundleFeatureMap.get("org.sling:b3:1"));
-        assertEquals(f, props.get(BUNDLE_FEATURE_FILENAME));
-    }
-
-    @Test
-    public void testLoadFeatureRegionMap() throws Exception {
-        String f = getClass().getResource("/features1.properties").getFile();
-        System.setProperty(PROPERTIES_FILE_PREFIX + FEATURE_REGION_FILENAME, f);
-
-        Hashtable<String, Object> props = new Hashtable<>();
-        RegionEnforcer re = new RegionEnforcer(props, "*");
-        assertEquals(2, re.featureRegionMap.size());
-        assertEquals(Collections.singleton("global"),
-                re.featureRegionMap.get("an.other:feature:123"));
-        assertEquals(new HashSet<>(Arrays.asList("global", "internal")),
-                re.featureRegionMap.get("org.sling:something:1.2.3"));
-        assertEquals(f, props.get(FEATURE_REGION_FILENAME));
-    }
-
-    @Test
-    public void testLoadRegionPackageMap() throws Exception {
-        String f = getClass().getResource("/regions1.properties").getFile();
-        System.setProperty(PROPERTIES_FILE_PREFIX + REGION_PACKAGE_FILENAME, f);
-
-        Hashtable<String, Object> props = new Hashtable<>();
-        RegionEnforcer re = new RegionEnforcer(props, "*");
-        assertEquals(2, re.regionPackageMap.size());
-        assertEquals(Collections.singleton("xyz"),
-                re.regionPackageMap.get("internal"));
-        assertEquals(new HashSet<>(Arrays.asList("a.b.c", "d.e.f", "test")),
-                re.regionPackageMap.get("global"));
-        assertEquals(f, props.get(REGION_PACKAGE_FILENAME));
-    }
-
-    @Test
-    public void testBegin() throws Exception {
-        System.setProperty(PROPERTIES_FILE_PREFIX + IDBSNVER_FILENAME,
-                getClass().getResource("/idbsnver1.properties").getFile());
-        System.setProperty(PROPERTIES_FILE_PREFIX + BUNDLE_FEATURE_FILENAME,
-                getClass().getResource("/bundles1.properties").getFile());
-        System.setProperty(PROPERTIES_FILE_PREFIX + FEATURE_REGION_FILENAME,
-                getClass().getResource("/features1.properties").getFile());
-        System.setProperty(PROPERTIES_FILE_PREFIX + REGION_PACKAGE_FILENAME,
-                getClass().getResource("/regions1.properties").getFile());
-
-        RegionEnforcer re = new RegionEnforcer(new Hashtable<>(), "*");
-        assertTrue(re.bsnVerMap.size() > 0);
-        assertTrue(re.bundleFeatureMap.size() > 0);
-        assertTrue(re.featureRegionMap.size() > 0);
-        assertTrue(re.regionPackageMap.size() > 0);
-
-        ResolverHookImpl hook = (ResolverHookImpl) re.begin(null);
-        assertEquals(re.bsnVerMap, hook.bsnVerMap);
-        assertEquals(re.bundleFeatureMap, hook.bundleFeatureMap);
-        assertEquals(re.featureRegionMap, hook.featureRegionMap);
-        assertEquals(re.regionPackageMap, hook.regionPackageMap);
-    }
-}
diff --git a/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/ResolverHookImplTest.java b/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/ResolverHookImplTest.java
deleted file mode 100644
index c27ccd4..0000000
--- a/featuremodel/feature-apiregions/src/test/java/org/apache/sling/feature/apiregions/impl/ResolverHookImplTest.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.apiregions.impl;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleRequirement;
-import org.osgi.framework.wiring.BundleRevision;
-
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-
-public class ResolverHookImplTest {
-    @Test
-    public void testFilterMatches() {
-        Map<Entry<String, Version>, List<String>> bsnvermap = new HashMap<>();
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("system.bundle", new Version(3,2,1)),
-                Collections.singletonList("b0"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("a.b.c", new Version(0,0,0)),
-                Collections.singletonList("b7"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("a.bundle", new Version(1,0,0)),
-                Collections.singletonList("b8"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("some.other.bundle", new Version(9,9,9,"suffix")),
-                Collections.singletonList("b9"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("a-bundle", new Version(1,0,0,"SNAPSHOT")),
-                Collections.singletonList("b10"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("not.in.a.feature", new Version(0,0,1)),
-                Collections.singletonList("b11"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("also.not.in.a.feature", new Version(0,0,1)),
-                Collections.singletonList("b12"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("a.b.c", new Version(1,2,3)),
-                Collections.singletonList("b17"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("x.y.z", new Version(9,9,9)),
-                Collections.singletonList("b19"));
-        bsnvermap.put(new AbstractMap.SimpleEntry<String,Version>("zzz", new Version(1,0,0)),
-                Collections.singletonList("b20"));
-
-        Map<String, Set<String>> bfmap = new HashMap<>();
-        bfmap.put("b7", Collections.singleton("f"));
-        bfmap.put("b8", Collections.singleton("f1"));
-        bfmap.put("b9", Collections.singleton("f2"));
-        bfmap.put("b10", Collections.singleton("f2"));
-        bfmap.put("b17", Collections.singleton("f3"));
-        bfmap.put("b19", Collections.singleton("f3"));
-        bfmap.put("b20", Collections.singleton("f4"));
-
-        Map<String, Set<String>> frmap = new HashMap<>();
-        frmap.put("f", new HashSet<>(Arrays.asList("r1", "r2", RegionEnforcer.GLOBAL_REGION)));
-        frmap.put("f1", Collections.singleton("r1"));
-        frmap.put("f2", Collections.singleton("r2"));
-        frmap.put("f3", Collections.singleton("r3"));
-        frmap.put("f4", Collections.singleton("r3"));
-
-        Map<String, Set<String>> rpmap = new HashMap<>();
-        rpmap.put("r0", Collections.singleton("org.bar"));
-        rpmap.put("r1", new HashSet<>(Arrays.asList("org.blah", "org.foo")));
-        rpmap.put(RegionEnforcer.GLOBAL_REGION, Collections.singleton("org.bar.tar"));
-        rpmap.put("r3", Collections.singleton("xyz"));
-
-        ResolverHookImpl rh = new ResolverHookImpl(bsnvermap, bfmap, frmap, rpmap);
-
-        // Check that we can get the capability from another bundle in the same region
-        // where that region exports the package
-        // Bundle 7 is in feature f with regions r1, r2. Bundle 8 is in feature f1 with regions r1
-        // r1 exports the org.foo package
-        BundleRequirement req0 = mockRequirement("b7", bsnvermap);
-        BundleCapability bc0 = mockCapability("org.foo", "b8", bsnvermap);
-        List<BundleCapability> candidates0 = new ArrayList<>(Arrays.asList(bc0));
-        rh.filterMatches(req0, candidates0);
-        assertEquals(Collections.singletonList(bc0), candidates0);
-
-        // Check that we cannot get the capability from another bundle in the same region
-        // but that region doesn't export the pacakge.
-        // Bundle 7 is in feature f with regions r1, r2. Bundle 9 is in feature f2 with regions r2
-        // r2 does not export any packages
-        BundleRequirement req1 = mockRequirement("b7", bsnvermap);
-        BundleCapability bc1 = mockCapability("org.foo", "b9", bsnvermap);
-        List<BundleCapability> candidates1 = new ArrayList<>(Arrays.asList(bc1));
-        rh.filterMatches(req1, candidates1);
-        assertEquals(Collections.emptyList(), candidates1);
-
-        // Check that we cannot get the capability from another bundle in a different region
-        // Bundle 9 is in feature f2 with region r2
-        // Bundle 17 is in feature f3 with region r3
-        BundleRequirement req2 = mockRequirement("b9", bsnvermap);
-        BundleCapability bc2 = mockCapability("org.bar", "b17", bsnvermap);
-        Collection<BundleCapability> c2 = new ArrayList<>(Arrays.asList(bc2));
-        rh.filterMatches(req2, c2);
-        assertEquals(0, c2.size());
-
-        // Check that we can get the capability from the same bundle
-        BundleRequirement req3 = mockRequirement("b9", bsnvermap);
-        BundleCapability bc3 = mockCapability("abc.xyz", "b9", bsnvermap);
-        Collection<BundleCapability> c3 = new ArrayList<>(Arrays.asList(bc3));
-        rh.filterMatches(req3, c3);
-        assertEquals(Collections.singletonList(bc3), c3);
-
-        // Check that we can get the capability from the another bundle in the same feature
-        BundleRequirement req4 = mockRequirement("b9", bsnvermap);
-        BundleCapability bc4 = mockCapability("some.cool.package", "b10", bsnvermap);
-        Collection<BundleCapability> c4 = new ArrayList<>(Arrays.asList(bc4));
-        rh.filterMatches(req4, c4);
-        assertEquals(Collections.singletonList(bc4), c4);
-
-        // Check that we can get the capability from another bundle where the capability
-        // is globally visible b7 exposes org.bar.tar in the global region, so b17 can see it
-        BundleRequirement req5 = mockRequirement("b17", bsnvermap);
-        BundleCapability bc5 = mockCapability("org.bar.tar", "b7", bsnvermap);
-        Collection<BundleCapability> c5 = new ArrayList<>(Arrays.asList(bc5));
-        rh.filterMatches(req5, c5);
-        assertEquals(Collections.singletonList(bc5), c5);
-
-        // Check that we cannot get at a capability in a region from a bundle not in a feature
-        BundleRequirement req6 = mockRequirement(6, "bundle.not.in.feature", new Version(2,0,0));
-        BundleCapability bc6 = mockCapability("org.foo", "b9", bsnvermap);
-        Collection<BundleCapability> c6 = new ArrayList<>(Arrays.asList(bc6));
-        rh.filterMatches(req6, c6);
-        assertEquals(0, c6.size());
-
-        // Check that capabilities in non-package namespaces are ignored
-        BundleRequirement req7 = Mockito.mock(BundleRequirement.class);
-        Mockito.when(req7.getNamespace()).thenReturn("some.other.namespace");
-        BundleCapability bc7 = mockCapability("org.bar", "b17", bsnvermap);
-        Collection<BundleCapability> c7 = new ArrayList<>(Arrays.asList(bc7));
-        rh.filterMatches(req7, c7);
-        assertEquals(Collections.singletonList(bc7), c7);
-
-        // Check that we can get the capability from another provider in the same region
-        BundleRequirement req8 = mockRequirement("b20", bsnvermap);
-        BundleCapability bc8 = mockCapability("xyz", "b19", bsnvermap);
-        Collection<BundleCapability> c8 = new ArrayList<>(Arrays.asList(bc8));
-        rh.filterMatches(req8, c8);
-        assertEquals(Collections.singletonList(bc8), c8);
-
-        // A requirement from a bundle that has no feature cannot access one in a region
-        // b17 provides package xyz which is in region r3, but b11 is not in any region.
-        BundleRequirement req9 = mockRequirement("b11", bsnvermap);
-        BundleCapability bc9 = mockCapability("xyz", "b17", bsnvermap);
-        Collection<BundleCapability> c9 = new ArrayList<>(Arrays.asList(bc9));
-        rh.filterMatches(req9, c9);
-        assertEquals(0, c9.size());
-
-        // A requirement from a bundle that has no feature can still access one in the global region
-        // b7 exposes org.bar.tar in the global region, so b11 can see it
-        BundleRequirement req10 = mockRequirement("b11", bsnvermap);
-        BundleCapability bc10 = mockCapability("org.bar.tar", "b7", bsnvermap);
-        Collection<BundleCapability> c10 = new ArrayList<>(Arrays.asList(bc10));
-        rh.filterMatches(req10, c10);
-        assertEquals(Collections.singletonList(bc10), c10);
-
-        // A requirement from a bundle that has no feature can be satisfied by a capability
-        // from a bundle that has no feature
-        BundleRequirement req11 = mockRequirement("b11", bsnvermap);
-        BundleCapability bc11 = mockCapability("ding.dong", "b12", bsnvermap);
-        Collection<BundleCapability> c11 = new ArrayList<>(Arrays.asList(bc11));
-        rh.filterMatches(req11, c11);
-        assertEquals(Collections.singletonList(bc11), c11);
-
-        // A capability from the system bundle is always accessible
-        BundleRequirement req12 = mockRequirement("b11", bsnvermap);
-        BundleCapability bc12 = mockCapability("ping.pong", "b0", bsnvermap);
-        Collection<BundleCapability> c12 = new ArrayList<>(Arrays.asList(bc12));
-        rh.filterMatches(req12, c12);
-        assertEquals(Collections.singletonList(bc12), c12);
-
-        // Check that anyone can get a capability from a bundle not in a feature
-        BundleRequirement req13 = mockRequirement("b9", bsnvermap);
-        BundleCapability bc13 = mockCapability("some.package", 999, "no.in.any.feature", new Version(1,0,0));
-        Collection<BundleCapability> c13 = new ArrayList<>(Arrays.asList(bc13));
-        rh.filterMatches(req13, c13);
-        assertEquals(Collections.singletonList(bc13), c13);
-    }
-
-    private BundleCapability mockCapability(String pkgName, String bid, Map<Entry<String, Version>, List<String>> bsnvermap) {
-        for (Map.Entry<Map.Entry<String, Version>, List<String>> entry : bsnvermap.entrySet()) {
-            if (entry.getValue().contains(bid)) {
-                // Remove first letter and use rest as bundle ID
-                long id = Long.parseLong(bid.substring(1));
-                return mockCapability(pkgName, id, entry.getKey().getKey(), entry.getKey().getValue());
-            }
-        }
-        throw new IllegalStateException("Bundle not found " + bid);
-    }
-
-    private BundleCapability mockCapability(String pkg, long bundleID, String bsn, Version version) {
-        Map<String, Object> attrs =
-                Collections.singletonMap(PackageNamespace.PACKAGE_NAMESPACE, pkg);
-
-        Bundle bundle = Mockito.mock(Bundle.class);
-        Mockito.when(bundle.getBundleId()).thenReturn(bundleID);
-        Mockito.when(bundle.getSymbolicName()).thenReturn(bsn);
-        Mockito.when(bundle.getVersion()).thenReturn(version);
-
-        BundleRevision br = Mockito.mock(BundleRevision.class);
-        Mockito.when(br.getBundle()).thenReturn(bundle);
-
-
-        BundleCapability cap = Mockito.mock(BundleCapability.class);
-        Mockito.when(cap.getAttributes()).thenReturn(attrs);
-        Mockito.when(cap.getRevision()).thenReturn(br);
-        return cap;
-    }
-
-    private BundleRequirement mockRequirement(String bid, Map<Map.Entry<String, Version>, List<String>> bsnvermap) {
-        for (Map.Entry<Map.Entry<String, Version>, List<String>> entry : bsnvermap.entrySet()) {
-            if (entry.getValue().contains(bid)) {
-                // Remove first letter and use rest as bundle ID
-                long id = Long.parseLong(bid.substring(1));
-                return mockRequirement(id, entry.getKey().getKey(), entry.getKey().getValue());
-            }
-        }
-        throw new IllegalStateException("Bundle not found " + bid);
-    }
-
-    private BundleRequirement mockRequirement(long bundleID, String bsn, Version version) {
-        Bundle bundle = Mockito.mock(Bundle.class);
-        Mockito.when(bundle.getBundleId()).thenReturn(bundleID);
-        Mockito.when(bundle.getSymbolicName()).thenReturn(bsn);
-        Mockito.when(bundle.getVersion()).thenReturn(version);
-
-        BundleRevision br = Mockito.mock(BundleRevision.class);
-        Mockito.when(br.getBundle()).thenReturn(bundle);
-
-        BundleRequirement req = Mockito.mock(BundleRequirement.class);
-        Mockito.when(req.getNamespace()).thenReturn(PackageNamespace.PACKAGE_NAMESPACE);
-        Mockito.when(req.getRevision()).thenReturn(br);
-
-        return req;
-    }
-}
diff --git a/featuremodel/feature-apiregions/src/test/resources/bundles1.properties b/featuremodel/feature-apiregions/src/test/resources/bundles1.properties
deleted file mode 100644
index 7497eaf..0000000
--- a/featuremodel/feature-apiregions/src/test/resources/bundles1.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-#Generated at Sat Nov 03 10:58:58 GMT 2018
-#Sat Nov 03 10:58:58 GMT 2018
-org.sling\:b3\:1=some.other\:feature\:123,org.sling\:something\:1.2.3\:slingosgifeature\:myclassifier
-org.sling\:b2\:1=org.sling\:something\:1.2.3\:slingosgifeature\:myclassifier
-org.sling\:b1\:1=org.sling\:something\:1.2.3\:slingosgifeature\:myclassifier
diff --git a/featuremodel/feature-apiregions/src/test/resources/features1.properties b/featuremodel/feature-apiregions/src/test/resources/features1.properties
deleted file mode 100644
index 9efad8d..0000000
--- a/featuremodel/feature-apiregions/src/test/resources/features1.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#Generated at Sat Nov 03 11:10:29 GMT 2018
-#Sat Nov 03 11:10:29 GMT 2018
-an.other\:feature\:123=global
-org.sling\:something\:1.2.3=internal,global
diff --git a/featuremodel/feature-apiregions/src/test/resources/idbsnver1.properties b/featuremodel/feature-apiregions/src/test/resources/idbsnver1.properties
deleted file mode 100644
index 00a740d..0000000
--- a/featuremodel/feature-apiregions/src/test/resources/idbsnver1.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Generated at Sat Nov 03 10:26:37 GMT 2018
-#Sat Nov 03 10:26:37 GMT 2018
-g\:b2\:1.2.3=b2~1.2.3
-g\:b1\:1=b1~1.0.0
-g2\:b2\:1.2.4=b2~1.2.3
-
diff --git a/featuremodel/feature-apiregions/src/test/resources/regions1.properties b/featuremodel/feature-apiregions/src/test/resources/regions1.properties
deleted file mode 100644
index a4982d7..0000000
--- a/featuremodel/feature-apiregions/src/test/resources/regions1.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#Generated at Sat Nov 03 11:10:29 GMT 2018
-#Sat Nov 03 11:10:29 GMT 2018
-internal=xyz
-global=d.e.f,test,a.b.c