This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch SLING-9903 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-adapter-annotations.git
commit c3a13f04e4ff1686bd6e2c32ed641a0c6165c8c7 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Thu Nov 12 15:27:04 2020 +0100 SLING-9903 - check the OSGI-INF XML files instead of running Sling for integration tests --- pom.xml | 7 + src/it/annotations-it/pom.xml | 127 --- .../adapter/annotations/AdapterAnnotationsIT.java | 40 - .../adapter/annotations/AdapterRegistrationIT.java | 128 --- .../sling/adapter/annotations/AdapterStatusIT.java | 104 -- .../adapter/annotations/ServicePropertiesIT.java | 180 ---- .../adapter/annotations/util/AppConstants.java | 26 - .../adapter/annotations/util/AppSlingClient.java | 67 -- .../sling/adapter/annotations/util/Util.java | 68 -- .../src/test/provisioning/it-model.txt | 1038 -------------------- src/it/annotations-it/verify.groovy | 91 ++ 11 files changed, 98 insertions(+), 1778 deletions(-) diff --git a/pom.xml b/pom.xml index 758bb53..744b6d7 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,13 @@ <!-- this causes verbose output, probably good to have for CI builds? --> <streamLogs>true</streamLogs> </configuration> + <dependencies> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy</artifactId> + <version>3.0.6</version> + </dependency> + </dependencies> <executions> <execution> <id>integration-test</id> diff --git a/src/it/annotations-it/pom.xml b/src/it/annotations-it/pom.xml index c1fcc34..a26ad3f 100644 --- a/src/it/annotations-it/pom.xml +++ b/src/it/annotations-it/pom.xml @@ -48,113 +48,10 @@ <build> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>3.0.0-M5</version> - </plugin> - <plugin> <groupId>biz.aQute.bnd</groupId> <artifactId>bnd-maven-plugin</artifactId> <version>5.0.0</version> </plugin> - <plugin> - <!-- Find free ports to run our server --> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <id>reserve-server-port</id> - <goals> - <goal>reserve-network-port</goal> - </goals> - <phase>pre-integration-test</phase> - <configuration> - <portNames> - <!-- used port name must be stored in property because it must be used for the base url --> - <portName>http.port</portName> - </portNames> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <!-- the Sling instance is provisioned from the model in src/main/provisioning/it-model.txt --> - <groupId>org.apache.sling</groupId> - <artifactId>slingstart-maven-plugin</artifactId> - <!-- for https://issues.apache.org/jira/browse/SLING-7662 --> - <version>1.9.8</version> - <extensions>true</extensions> - <executions> - <execution> - <id>customise-starter</id> - <goals> - <goal>prepare-package</goal> - </goals> - <configuration> - <modelDirectory>${project.basedir}/src/test/provisioning</modelDirectory> - <usePomDependencies>false</usePomDependencies> - </configuration> - </execution> - <execution> - <id>package-starter</id> - <goals> - <goal>package</goal> - </goals> - <configuration> - <attachArtifact>false</attachArtifact> - <modelDirectory>${project.basedir}/src/test/provisioning</modelDirectory> - <usePomDependencies>true</usePomDependencies> - </configuration> - </execution> - <execution> - <id>start-container-before-IT</id> - <goals> - <goal>start</goal> - </goals> - </execution> - <execution> - <id>stop-container-after-IT</id> - <goals> - <goal>stop</goal> - </goals> - <configuration> - <shouldBlockUntilKeyIsPressed>${keepITServerRunning}</shouldBlockUntilKeyIsPressed> - </configuration> - </execution> - </executions> - <configuration> - <servers> - <!-- this configuration applies to both 'start' and 'stop' --> - <server> - <id>singleinstance</id> - <port>${http.port}</port> - <vmOpts>${sling.vm.options}</vmOpts> - <stdOutFile>sling/logs/stdout.log</stdOutFile> - </server> - </servers> - <!-- this configuration only applies to 'prepare-package' and 'package' --> - <disableExtendingMavenClasspath>true</disableExtendingMavenClasspath> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <baseUrl>http://${http.host}:${http.port}/</baseUrl> - <bundleFile>${project.build.directory}/${project.build.finalName}.jar</bundleFile> - <bundleSymbolicName>${project.artifactId}</bundleSymbolicName> - </systemPropertyVariables> - </configuration> - </plugin> </plugins> </build> @@ -190,29 +87,5 @@ <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> - - <!-- testing dependencies --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - <version>4.4.13</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.testing.clients</artifactId> - <version>2.0.6</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>osgi.core</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> \ No newline at end of file diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterAnnotationsIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterAnnotationsIT.java deleted file mode 100644 index a24da5b..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterAnnotationsIT.java +++ /dev/null @@ -1,40 +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.adapter.annotations; - -import org.apache.sling.testing.clients.ClientException; -import org.junit.Test; - -public interface AdapterAnnotationsIT { - @Test - void testLongToIntegerIfFitsAdapterFactory() throws ClientException; - - @Test - void testTextLengthIfFitsAdapterFactory() throws ClientException; - - @Test - void testShortToIntegerAndLongAdapterFactory() throws ClientException; - - @Test - void testIntegerAndShortToLongAdapterFactory() throws ClientException; - - @Test - void testDeprecatedAdapterFactory() throws ClientException; - - @Test - void testInvalidAdapterFactories() throws ClientException; -} diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterRegistrationIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterRegistrationIT.java deleted file mode 100644 index 1b60716..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterRegistrationIT.java +++ /dev/null @@ -1,128 +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.adapter.annotations; - -import com.google.common.collect.ImmutableMap; -import org.apache.sling.adapter.Adaption; -import org.apache.sling.adapter.annotations.util.AppSlingClient; -import org.apache.sling.adapter.annotations.util.Util; -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.adapter.AdapterFactory; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.testing.clients.ClientException; -import org.apache.sling.testing.clients.osgi.OsgiConsoleClient; -import org.apache.sling.testing.clients.osgi.ServiceInfo; -import org.apache.sling.testing.clients.osgi.ServicesInfo; -import org.apache.sling.testing.clients.util.JsonUtils; -import org.codehaus.jackson.JsonNode; -import org.junit.BeforeClass; -import org.junit.Test; -import org.osgi.framework.Constants; - -import java.io.IOException; -import java.math.BigInteger; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeoutException; -import java.util.function.UnaryOperator; - -import static org.hamcrest.CoreMatchers.hasItem; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; - -public class AdapterRegistrationIT implements AdapterAnnotationsIT { - private static Set<Map<String, Object>> registeredAdaptions; - - @BeforeClass - public static void setUpAdaptions() throws ClientException, InterruptedException, TimeoutException, URISyntaxException, IOException { - try (final OsgiConsoleClient client = AppSlingClient.newSlingClient().adaptTo(OsgiConsoleClient.class)) { - registeredAdaptions = new HashSet<>(); - final String servicesJsonString = client.doGet("/system/console/services.json").getContent(); - final ServicesInfo services = new ServicesInfo(JsonUtils.getJsonNodeFromString(servicesJsonString)); - for (final ServiceInfo serviceInfo : services.forType(Adaption.class.getName())) { - final String serviceJsonString = client.doGet("/system/console/services/" + serviceInfo.getId() + ".json").getContent(); - try { - final JsonNode serviceJson = JsonUtils.getJsonNodeFromString(serviceJsonString); - registeredAdaptions.add(Util.getNonDynamicPropertiesForService(serviceJson)); - } catch (final ClientException e) { - System.err.println("Unable to find proper JSON content for " + serviceJsonString + " - skipping."); - e.printStackTrace(System.err); - } - } - } - } - - @Override - @Test - public void testLongToIntegerIfFitsAdapterFactory() { - assertAdaption(properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Long.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Integer.class.getName()))); - } - - @Override - @Test - public void testTextLengthIfFitsAdapterFactory() { - assertAdaption(properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(CharSequence.class.getName(), String.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList( - Short.class.getName(), - Integer.class.getName(), - Long.class.getName(), - BigInteger.class.getName()))); - } - - @Override - @Test - public void testShortToIntegerAndLongAdapterFactory() { - assertAdaption(properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Short.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList(Integer.class.getName(), Long.class.getName()))); - } - - @Override - @Test - public void testIntegerAndShortToLongAdapterFactory() { - assertAdaption(properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(Integer.class.getName(), Short.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Long.class.getName()))); - } - - @Override - @Test - public void testDeprecatedAdapterFactory() { - assertAdaption(properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(SlingHttpServletRequest.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Resource.class.getName()))); - } - - @Override - @Test - public void testInvalidAdapterFactories() { - assertFalse(registeredAdaptions.stream().anyMatch(properties -> properties.containsValue(Collections.singletonList(Void.class.getName())))); - } - - private static void assertAdaption(final UnaryOperator<ImmutableMap.Builder<String, Object>> properties) { - assertThat(registeredAdaptions, hasItem(properties.apply(ImmutableMap.<String, Object>builder() - .put(Constants.SERVICE_SCOPE, Constants.SCOPE_SINGLETON) - ).build())); - } -} diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterStatusIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterStatusIT.java deleted file mode 100644 index 4760138..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/AdapterStatusIT.java +++ /dev/null @@ -1,104 +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.adapter.annotations; - -import org.apache.commons.lang3.StringUtils; -import org.apache.sling.adapter.annotations.testing.adapters.AbstractNoOpAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.LongToIntegerIfFitsAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.TextLengthIfFitsAdapterFactory; -import org.apache.sling.adapter.annotations.util.AppConstants; -import org.apache.sling.adapter.annotations.util.AppSlingClient; -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.testing.clients.ClientException; -import org.apache.sling.testing.clients.osgi.OsgiConsoleClient; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.IOException; -import java.math.BigInteger; -import java.net.URISyntaxException; -import java.util.concurrent.TimeoutException; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; - -public class AdapterStatusIT implements AdapterAnnotationsIT { - private static String adaptersStatus; - - @BeforeClass - public static void setUpAdaptersStatus() throws ClientException, InterruptedException, TimeoutException, URISyntaxException, IOException { - try (final OsgiConsoleClient client = AppSlingClient.newSlingClient().adaptTo(OsgiConsoleClient.class)) { - adaptersStatus = client.doGet("/system/console/status-adapters.txt").getContent(); - adaptersStatus = StringUtils.replace(adaptersStatus, "\r", StringUtils.EMPTY); // Prevent platform-specific issues - } - } - - @Override - @Test - public void testLongToIntegerIfFitsAdapterFactory() { - assertAdapterDescriptor(Long.class, LongToIntegerIfFitsAdapterFactory.CONDITION, Integer.class); - } - - @Override - @Test - public void testShortToIntegerAndLongAdapterFactory() { - assertAdapterDescriptor(Short.class, null, Integer.class, Long.class); - } - - @Override - @Test - public void testIntegerAndShortToLongAdapterFactory() { - assertAdapterDescriptor(Integer.class, null, Long.class); - assertAdapterDescriptor(Short.class, null, Long.class); - } - - @Override - @Test - public void testTextLengthIfFitsAdapterFactory() { - assertAdapterDescriptor(CharSequence.class, TextLengthIfFitsAdapterFactory.CONDITION, Short.class, Integer.class, Long.class, BigInteger.class); - assertAdapterDescriptor(String.class, TextLengthIfFitsAdapterFactory.CONDITION, Short.class, Integer.class, Long.class, BigInteger.class); - } - - @Override - @Test - public void testDeprecatedAdapterFactory() { - // Deprecated status is not dumped on the status page - assertAdapterDescriptor(SlingHttpServletRequest.class, null, Resource.class); - } - - @Override - @Test - public void testInvalidAdapterFactories() { - assertThat(adaptersStatus, not(containsString("\nCondition: " + AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE + "\n"))); - } - - private static void assertAdapterDescriptor(final Class<?> adaptable, final String condition, final Class<?>... adapters) { - final StringBuilder descriptor = new StringBuilder("\nAdaptable: ").append(adaptable.getName()).append("\n"); - if (condition != null) { - descriptor.append("Condition: ").append(condition).append("\n"); - } - descriptor.append("Providing Bundle: ").append(AppConstants.BUNDLE_SYMBOLIC_NAME).append("\n"); - descriptor.append("Available Adapters:\n"); - for (final Class<?> adapter : adapters) { - descriptor.append(" * ").append(adapter.getName()).append("\n"); - } - descriptor.append("\n"); - assertThat(adaptersStatus, containsString(descriptor.toString())); - } -} diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/ServicePropertiesIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/ServicePropertiesIT.java deleted file mode 100644 index 2d896d4..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/ServicePropertiesIT.java +++ /dev/null @@ -1,180 +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.adapter.annotations; - -import com.google.common.collect.ImmutableMap; -import org.apache.sling.adapter.annotations.testing.adapters.AbstractNoOpAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.DeprecatedAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.InvalidNoAdaptablesAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.InvalidEmptyAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.InvalidNoAdaptersAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.ShortToIntegerAndLongAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.LongToIntegerIfFitsAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.IntegerAndShortToLongAdapterFactory; -import org.apache.sling.adapter.annotations.testing.adapters.TextLengthIfFitsAdapterFactory; -import org.apache.sling.adapter.annotations.util.AppSlingClient; -import org.apache.sling.adapter.annotations.util.Util; -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.adapter.AdapterFactory; -import org.apache.sling.api.resource.Resource; -import org.apache.sling.testing.clients.ClientException; -import org.apache.sling.testing.clients.osgi.OsgiConsoleClient; -import org.apache.sling.testing.clients.util.JsonUtils; -import org.codehaus.jackson.JsonNode; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.osgi.framework.Constants; -import org.osgi.service.component.ComponentConstants; - -import java.io.IOException; -import java.math.BigInteger; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Map; -import java.util.concurrent.TimeoutException; -import java.util.function.UnaryOperator; - -import static org.junit.Assert.assertEquals; - -public class ServicePropertiesIT implements AdapterAnnotationsIT { - private static final String ADAPTER_CONDITION = "adapter.condition"; - private static final String ADAPTER_DEPRECATED = "adapter.deprecated"; - - private static OsgiConsoleClient client; - - @BeforeClass - public static void setUpOnce() throws InterruptedException, TimeoutException, ClientException, URISyntaxException { - client = AppSlingClient.newSlingClient().adaptTo(OsgiConsoleClient.class); - } - - @AfterClass - public static void tearDown() throws IOException { - if (client != null) { - client.close(); - } - } - - @Override - @Test - public void testLongToIntegerIfFitsAdapterFactory() throws ClientException { - assertProperties(LongToIntegerIfFitsAdapterFactory.class.getName(), properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Long.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Integer.class.getName())) - .put(ADAPTER_CONDITION, LongToIntegerIfFitsAdapterFactory.CONDITION)); - } - - @Override - @Test - public void testTextLengthIfFitsAdapterFactory() throws ClientException { - assertProperties(TextLengthIfFitsAdapterFactory.class.getName(), properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(CharSequence.class.getName(), String.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList( - Short.class.getName(), - Integer.class.getName(), - Long.class.getName(), - BigInteger.class.getName() - )) - .put(ADAPTER_CONDITION, TextLengthIfFitsAdapterFactory.CONDITION)); - } - - @Override - @Test - public void testShortToIntegerAndLongAdapterFactory() throws ClientException { - assertProperties(ShortToIntegerAndLongAdapterFactory.class.getName(), properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Short.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Arrays.asList(Integer.class.getName(), Long.class.getName()))); - } - - @Override - @Test - public void testIntegerAndShortToLongAdapterFactory() throws ClientException { - assertProperties(IntegerAndShortToLongAdapterFactory.class.getName(), properties -> properties - .put(AdapterFactory.ADAPTABLE_CLASSES, Arrays.asList(Integer.class.getName(), Short.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Long.class.getName()))); - } - - @Test - public void testInvalidMissingAdaptablesAndAdaptersAdapter() throws ClientException { - assertProperties(InvalidEmptyAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)); - } - - @Test - public void testInvalidMissingAdaptablesAdapter() throws ClientException { - assertProperties(InvalidNoAdaptablesAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Void.class.getName()))); - } - - @Test - public void testInvalidMissingAdaptersAdapter() throws ClientException { - assertProperties(InvalidNoAdaptersAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE) - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Void.class.getName()))); - } - - @Override - @Test - public void testDeprecatedAdapterFactory() throws ClientException { - assertProperties(DeprecatedAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_DEPRECATED, true) - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(SlingHttpServletRequest.class.getName())) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Resource.class.getName()))); - } - - @Override - @Test - public void testInvalidAdapterFactories() throws ClientException { - assertProperties(InvalidEmptyAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE)); - assertProperties(InvalidNoAdaptablesAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE) - .put(AdapterFactory.ADAPTER_CLASSES, Collections.singletonList(Void.class.getName()))); - assertProperties(InvalidNoAdaptersAdapterFactory.class.getName(), properties -> properties - .put(ADAPTER_CONDITION, AbstractNoOpAdapterFactory.INVALID_CONFIGURATION_MESSAGE) - .put(AdapterFactory.ADAPTABLE_CLASSES, Collections.singletonList(Void.class.getName()))); - } - - private static void assertProperties(final String componentName, - final UnaryOperator<ImmutableMap.Builder<String, Object>> properties) throws ClientException { - final Map<String, Object> expected = properties.apply(ImmutableMap.<String, Object>builder() - .put(ComponentConstants.COMPONENT_NAME, componentName) - .put(Constants.SERVICE_SCOPE, Constants.SCOPE_BUNDLE)) - .build(); - assertEquals(expected, getNonDynamicPropertiesOfComponentService(componentName)); - } - - private static Map<String, Object> getNonDynamicPropertiesOfComponentService(final String nameOrId) throws ClientException { - final JsonNode componentJson = JsonUtils.getJsonNodeFromString( - client.doGet("/system/console/components/" + nameOrId + ".json").getContent()); - final JsonNode serviceJson = JsonUtils.getJsonNodeFromString( - client.doGet("/system/console/services/" + getServiceIdFromComponentJson(componentJson) + ".json").getContent()); - return Util.getNonDynamicPropertiesForService(serviceJson); - } - - private static int getServiceIdFromComponentJson(final JsonNode componentJson) { - final JsonNode props = componentJson.get("data").get(0).get("props"); - for (final JsonNode prop : props) { - if ("serviceId".equals(prop.get("key").getValueAsText())) { - return Integer.parseInt(prop.get("value").getValueAsText()); - } - } - throw new AssertionError("No service ID found"); - } -} diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppConstants.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppConstants.java deleted file mode 100644 index 9e987f6..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppConstants.java +++ /dev/null @@ -1,26 +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.adapter.annotations.util; - -public class AppConstants { - public AppConstants() { - // Constants class - } - - public static final String BUNDLE_SYMBOLIC_NAME = System.getProperty("bundleSymbolicName"); - public static final String BUNDLE_FILE = System.getProperty("bundleFile"); -} diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppSlingClient.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppSlingClient.java deleted file mode 100644 index 0706f5d..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/AppSlingClient.java +++ /dev/null @@ -1,67 +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.adapter.annotations.util; - -import org.apache.sling.testing.clients.ClientException; -import org.apache.sling.testing.clients.SlingClient; -import org.apache.sling.testing.clients.osgi.OsgiConsoleClient; -import org.apache.sling.testing.clients.util.poller.Polling; - -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.concurrent.TimeoutException; - -public class AppSlingClient { - private static boolean bundleInstalledAndStarted; - - private static final String [] READINESS_PATHS = { - "/starter.html", - "/system/console/status-adapters.txt", - "/system/console/components", - "/system/console/services", - "/system/console/services.json" - }; - - @SuppressWarnings("squid:S2095") // Caller will close the client - public static SlingClient newSlingClient() throws URISyntaxException, ClientException, TimeoutException, InterruptedException { - final SlingClient client = new SlingClient(new URI(System.getProperty("baseUrl")), "admin", "admin"); - - // client.waitExists() adds ".json" to the path, which is not desired, since that requests the Sling Default GET Servlet instead of Sling Starter HTML - new Polling(() -> allPathsOk(client, READINESS_PATHS, 200)) - .poll(60_000, 500); - - if (!bundleInstalledAndStarted) { - final OsgiConsoleClient osgiConsoleClient = client.adaptTo(OsgiConsoleClient.class); - osgiConsoleClient.waitInstallBundle(new File(AppConstants.BUNDLE_FILE), true, -1, 10_000, 500); - osgiConsoleClient.waitBundleStarted(AppConstants.BUNDLE_SYMBOLIC_NAME, 10_000, 500); - bundleInstalledAndStarted = true; - } - return client; - } - - /** @return true if all paths return expected status */ - private static boolean allPathsOk(SlingClient client, String [] paths, int expectedStatus) throws ClientException, InterruptedException { - for(String path : paths) { - final int actualStatus = client.doGet(path).getStatusLine().getStatusCode(); - if(actualStatus != expectedStatus) { - throw new ClientException("Expected status " + expectedStatus + " but got " + actualStatus + " for " + path); - } - } - return true; - } -} diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/Util.java b/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/Util.java deleted file mode 100644 index 960a2af..0000000 --- a/src/it/annotations-it/src/test/java/org/apache/sling/adapter/annotations/util/Util.java +++ /dev/null @@ -1,68 +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.adapter.annotations.util; - -import org.codehaus.jackson.JsonNode; -import org.osgi.framework.Constants; -import org.osgi.service.component.ComponentConstants; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class Util { - private static final Set<String> DYNAMIC_PROPERTIES = new HashSet<>(Arrays.asList( - ComponentConstants.COMPONENT_ID, - Constants.SERVICE_BUNDLEID - )); - - public static Map<String, Object> getNonDynamicPropertiesForService(final JsonNode json) { - final JsonNode props = json.get("data").get(0).get("props"); - final Map<String, Object> properties = new LinkedHashMap<>(); - for (final JsonNode prop : props) { - final String name = prop.get("key").getTextValue(); - if (!DYNAMIC_PROPERTIES.contains(name)) { - properties.put(name, getPropertyValue(prop.get("value"))); - } - } - return properties; - } - - private static Object getPropertyValue(final JsonNode value) { - if (value.isBoolean()) { - return value.getBooleanValue(); - } - if (value.isNumber()) { - return value.getNumberValue(); - } - if (value.isTextual()) { - return value.getTextValue(); - } - if (value.isArray()) { - final List<String> items = new ArrayList<>(); - for (final JsonNode item : value) { - items.add(item.getTextValue()); - } - return items; - } - return null; - } -} diff --git a/src/it/annotations-it/src/test/provisioning/it-model.txt b/src/it/annotations-it/src/test/provisioning/it-model.txt deleted file mode 100644 index 12f5873..0000000 --- a/src/it/annotations-it/src/test/provisioning/it-model.txt +++ /dev/null @@ -1,1038 +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. -# -# The :boot feature contains all things to bootstrap the installation. -[feature name=:boot] - -[variables] - slf4j.version=1.7.25 - -# additional entries for sling.properties -# --------------------------------------- -# oak_tar and oak_mongo run modes are mutually exclusive, -# and cannot be changed after the first startup -[settings] - localIndexDir=${sling.home}/repository/index - repository.home=${sling.home}/repository - sling.run.mode.install.options=oak_tar,oak_mongo - -[artifacts] - org.apache.aries/org.apache.aries.util/1.1.3 - org.apache.commons/commons-lang3/3.9 - org.apache.felix/org.apache.felix.configadmin/1.9.16 - org.apache.felix/org.apache.felix.converter/1.0.14 - org.apache.felix/org.apache.felix.eventadmin/1.5.0 - org.apache.geronimo.specs/geronimo-annotation_1.3_spec/1.1 -# dependency with javax.inject - required for Sling Models (SLING-4710) - org.apache.geronimo.specs/geronimo-atinject_1.0_spec/1.1 - org.apache.geronimo.specs/geronimo-ws-metadata_2.0_spec/1.1.3 - org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-impl/2.2.11_1 - org.apache.servicemix.bundles/org.apache.servicemix.bundles.saaj-impl/1.3.23_2 - org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.2/2.9.0 - org.apache.servicemix.specs/org.apache.servicemix.specs.jaxws-api-2.2/2.9.0 - org.apache.servicemix.specs/org.apache.servicemix.specs.saaj-api-1.3/2.8.0 - org.apache.sling/org.apache.sling.commons.johnzon/1.2.2 - org.apache.sling/org.apache.sling.commons.log/5.1.10 - org.apache.sling/org.apache.sling.commons.logservice/1.1.0 - org.apache.sling/org.apache.sling.commons.osgi/2.4.0 - org.apache.sling/org.apache.sling.installer.core/3.11.2 - org.apache.sling/org.apache.sling.installer.factory.configuration/1.3.2 - org.apache.sling/org.apache.sling.installer.provider.file/1.2.2 - org.apache.sling/org.apache.sling.javax.activation/0.1.0 - org.apache.sling/org.apache.sling.launchpad.installer/1.2.2 - org.apache.sling/org.apache.sling.settings/1.3.10 - org.jvnet.staxex/stax-ex/1.7.6 - org.osgi/org.osgi.service.log/1.4.0 - org.osgi/org.osgi.util.function/1.1.0 - org.osgi/org.osgi.util.promise/1.1.1 - org.osgi/org.osgi.util.pushstream/1.0.1 - org.slf4j/jcl-over-slf4j/1.7.25 - org.slf4j/log4j-over-slf4j/1.7.25 - org.slf4j/slf4j-api/1.7.25 - -# -# 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. -# -# The :launchpad feature defines Sling's launchpad version -# Only a single artifact is allowed within this feature. -[feature name=:launchpad] - -[settings] - org.osgi.framework.system.packages=org.osgi.framework;version="1.9",org.osgi.framework.dto;version="1.8";uses:="org.osgi.dto",org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.resolver;version="1.0";uses:="org.osgi.framework.wiring",org.osgi.framework.hooks.service;version="1.1";uses:="org.osgi.framework",org.osgi.framework.hooks.weaving;version="1.1";uses:="org.osgi.framework.wiring",org.osgi.framework.launch;version="1.2";uses:="org.osg [...] - sling.jpms.java.xml={dollar}{sling.jre.java.xml},javax.xml.catalog;uses:="javax.xml.namespace";version="1.0.0" - sling.jre-1.8=,java.applet;version="{dollar}{felix.detect.java.version}",java.awt;version="{dollar}{felix.detect.java.version}",java.awt.color;version="{dollar}{felix.detect.java.version}",java.awt.datatransfer;version="{dollar}{felix.detect.java.version}",java.awt.dnd;version="{dollar}{felix.detect.java.version}",java.awt.event;version="{dollar}{felix.detect.java.version}",java.awt.font;version="{dollar}{felix.detect.java.version}",java.awt.geom;version="{dollar}{felix.detect.java.ver [...] - sling.jre-jpms={dollar}{felix.jpms.java.base}{dollar}{felix.jpms.java.compiler}{dollar}{felix.jpms.java.datatransfer}{dollar}{felix.jpms.java.desktop}{dollar}{felix.jpms.java.instrument}{dollar}{felix.jpms.java.logging}{dollar}{felix.jpms.java.management}{dollar}{felix.jpms.java.management.rmi}{dollar}{felix.jpms.java.naming}{dollar}{felix.jpms.java.net.http}{dollar}{felix.jpms.java.prefs}{dollar}{felix.jpms.java.rmi}{dollar}{felix.jpms.java.scripting}{dollar}{felix.jpms.java.se}{dolla [...] - sling.jre.java.xml=,javax.xml;version="2.1.0",javax.xml.datatype;uses:="javax.xml.namespace";version="2.1.0",javax.xml.namespace;version="2.1.0",javax.xml.parsers;uses:="javax.xml.validation,org.w3c.dom,org.xml.sax,org.xml.sax.helpers";version="2.1.0",javax.xml.stream;uses:="javax.xml.namespace,javax.xml.stream.events,javax.xml.stream.util,javax.xml.transform";version="1.0.0",javax.xml.stream.events;uses:="javax.xml.namespace,javax.xml.stream";version="1.0.0",javax.xml.stream.util;uses [...] - -[artifacts] - org.apache.sling/org.apache.sling.launchpad.base/6.0.2-2.6.36 - -# -# 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=composum-nodes] - -[variables] - composum.nodes.version=1.11.5 - -[artifacts startLevel=20] - com.composum.sling.core/composum-sling-core-commons/1.11.5 - com.composum.sling.core/composum-sling-core-console/1.11.5 - com.composum.sling.core/composum-sling-core-jslibs/1.11.5 - com.composum.sling.core/composum-sling-package-manager/1.11.5 - com.composum.sling.core/composum-sling-user-management/1.11.5 - -[configurations] -# the whitelisting of administrative login (to replace by service users in Nodes 2.0) - org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-composum - whitelist.bundles=[ \ - "com.composum.core.commons", \ - "com.composum.core.pckgmgr", \ - "com.composum.core.pckginstall", \ - ] - whitelist.name="composum" - -# -# 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=healthcheck] - -# startlevel 5 together with jetty (to allow use during startup) -[artifacts startLevel=5] - org.apache.felix/org.apache.felix.healthcheck.api/2.0.2 - org.apache.felix/org.apache.felix.healthcheck.core/2.0.6 - org.apache.felix/org.apache.felix.healthcheck.generalchecks/2.0.4 - org.apache.felix/org.apache.felix.healthcheck.webconsoleplugin/2.0.0 - -# sling health check bundles at startlevel 20 -[artifacts startLevel=20] - org.apache.sling/org.apache.sling.hc.api/1.0.4 - org.apache.sling/org.apache.sling.hc.support/1.0.6 - -[configurations] -# # bundles - org.apache.felix.hc.generalchecks.BundlesStartedCheck - hc.tags=[ \ - "bundles", \ - ] - - org.apache.felix.hc.generalchecks.CpuCheck - cpuPercentageThresholdWarn=L"95" - hc.tags=[ \ - "cpu", \ - "system-resources", \ - ] - - org.apache.felix.hc.generalchecks.DiskSpaceCheck - diskPaths=[ \ - ".", \ - ] - hc.tags=[ \ - "diskspace", \ - "system-resources", \ - ] - -# # systemalive checks - org.apache.felix.hc.generalchecks.FrameworkStartCheck - hc.tags=[ \ - "systemalive", \ - ] - targetStartLevel=I"30" - - org.apache.felix.hc.generalchecks.MemoryCheck - hc.tags=[ \ - "memory", \ - "system-resources", \ - ] - heapUsedPercentageThresholdCritical=L"100" - heapUsedPercentageThresholdWarn=L"95" - - org.apache.felix.hc.generalchecks.ServicesCheck - hc.tags=[ \ - "systemalive", \ - ] - services.list=[ \ - "org.apache.sling.jcr.api.SlingRepository", \ - "org.apache.sling.engine.auth.Authenticator", \ - "org.apache.sling.api.resource.ResourceResolverFactory", \ - "org.apache.sling.api.servlets.ServletResolver", \ - "javax.script.ScriptEngineManager", \ - ] - -# # system resources - org.apache.felix.hc.generalchecks.ThreadUsageCheck - hc.tags=[ \ - "threads", \ - "cpu", \ - "system-resources", \ - ] - -# # Service Unavailable Filter for startup-shutdown - org.apache.felix.hc.core.impl.filter.ServiceUnavailableFilter-startupandshutdown - autoDisableFilter=B"true" - avoid404DuringStartup=B"true" - includeExecutionResult=B"false" - osgi.http.whiteboard.context.select="(osgi.http.whiteboard.context.name\=*)" - osgi.http.whiteboard.filter.regex="(?!/system/).*" - responseTextFor503="classpath:org.apache.sling.starter.content:content/content/startup/index.html" - service.ranking=I"2147483647" - tags=[ \ - "systemalive", \ - ] - -# # servlet - org.apache.felix.hc.core.impl.servlet.HealthCheckExecutorServlet-default - servletPath="/system/health" - -# # service user for scripted health check (to make it easy to use jcr:/path/to/script urls) - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-hc-support - user.mapping=[ \ - "org.apache.sling.hc.support\=sling-readall", \ - ] - -# -# 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=models-jacksonexporter] - -[variables] - jackson.version=2.9.9 - -[artifacts] - com.fasterxml.jackson.core/jackson-annotations/2.9.9 - com.fasterxml.jackson.core/jackson-core/2.9.9 - com.fasterxml.jackson.core/jackson-databind/2.9.9 - org.apache.sling/org.apache.sling.models.jacksonexporter/1.0.8 - -# -# 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. -# -# This is the OAK feature. -[feature name=oak] - -[variables] - oak.version=1.26.0 - -# The segment node store is used via a configuration -[artifacts startLevel=10] - org.apache.felix/org.apache.felix.jaas/1.0.2 - -[artifacts startLevel=15] - org.apache.jackrabbit/oak-api/1.26.0 - org.apache.jackrabbit/oak-blob-plugins/1.26.0 - org.apache.jackrabbit/oak-blob/1.26.0 - org.apache.jackrabbit/oak-commons/1.26.0 - org.apache.jackrabbit/oak-core-spi/1.26.0 - org.apache.jackrabbit/oak-core/1.26.0 - org.apache.jackrabbit/oak-jackrabbit-api/1.26.0 - org.apache.jackrabbit/oak-jcr/1.26.0 - org.apache.jackrabbit/oak-lucene/1.26.0 - org.apache.jackrabbit/oak-query-spi/1.26.0 - org.apache.jackrabbit/oak-security-spi/1.26.0 -# TODO - Sling does not come up without oak-store-composite - org.apache.jackrabbit/oak-store-composite/1.26.0 -# OAK-7263 - oak-store-document should be in oak_mongo runmode - org.apache.jackrabbit/oak-store-document/1.26.0 - org.apache.jackrabbit/oak-store-spi/1.26.0 - -# start the Oak server instance after all components have been configured -# and started to avoid restarting that component ( see SLING-4556 ) -[artifacts startLevel=16] - org.apache.sling/org.apache.sling.jcr.oak.server/1.2.4 - -[configurations] - org.apache.felix.jaas.ConfigurationSpi - jaas.configProviderName="FelixJaasProvider" - jaas.defaultRealmName="jackrabbit.oak" - - org.apache.jackrabbit.oak.security.authentication.AuthenticationConfigurationImpl - org.apache.jackrabbit.oak.authentication.configSpiName="FelixJaasProvider" - - org.apache.jackrabbit.oak.security.user.RandomAuthorizableNodeName - length=I"21" - - org.apache.jackrabbit.oak.security.user.UserConfigurationImpl - defaultDepth="1" - groupsPath="/home/groups" - importBehavior="besteffort" - usersPath="/home/users" - - org.apache.jackrabbit.oak.spi.security.user.action.DefaultAuthorizableActionProvider - enabledActions=[ \ - "org.apache.jackrabbit.oak.spi.security.user.action.AccessControlAction", \ - ] - groupPrivilegeNames=[ \ - "jcr:read", \ - ] - userPrivilegeNames=[ \ - "jcr:all", \ - ] - - org.apache.felix.jaas.Configuration.factory-GuestLoginModule - jaas.classname="org.apache.jackrabbit.oak.spi.security.authentication.GuestLoginModule" - jaas.controlFlag="optional" - jaas.ranking=I"300" - - org.apache.felix.jaas.Configuration.factory-LoginModuleImpl - jaas.classname="org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl" - jaas.controlFlag="required" - - org.apache.felix.jaas.Configuration.factory-TokenLoginModule - jaas.classname="org.apache.jackrabbit.oak.security.authentication.token.TokenLoginModule" - jaas.controlFlag="sufficient" - jaas.ranking=I"200" - -[artifacts startLevel=15 runModes=oak_mongo] - com.h2database/h2-mvstore/1.4.194 - org.mongodb/mongo-java-driver/3.8.2 - -[configurations runModes=oak_mongo] - org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService - db="sling" - mongouri="mongodb://localhost:27017" - -[artifacts startLevel=15 runModes=oak_tar] - org.apache.jackrabbit/oak-segment-tar/1.26.0 - -[configurations runModes=oak_tar] - org.apache.jackrabbit.oak.segment.SegmentNodeStoreService - name="Default\ NodeStore" - -# -# 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=repoinit] - -[artifacts] - org.apache.sling/org.apache.sling.jcr.repoinit/1.1.20 - org.apache.sling/org.apache.sling.provisioning.model/1.8.4 - org.apache.sling/org.apache.sling.repoinit.parser/1.4.2 - -[configurations] - org.apache.sling.jcr.repoinit.impl.RepositoryInitializer - references="model@repoinit:context:/resources/provisioning/model.txt" - - [:repoinit] -# general -create path (sling:OrderedFolder) /content -set ACL for everyone -allow jcr:read on /content -end - -# sling-mapping -create service user sling-mapping - -set ACL for sling-mapping -allow jcr:read on / -end - -# sling-readall -create service user sling-readall - -set ACL for sling-readall -allow jcr:read on / -end - -# sling-xss -create service user sling-xss - -create path (sling:Folder) /apps/sling/xss - -set ACL for sling-xss -allow jcr:read on /apps/sling/xss -end - -# sling-i18n -create service user sling-i18n - -set ACL for sling-i18n -allow jcr:read on / -end - -# sling-jcr-install -create service user sling-jcr-install - -# used for config OSGi writeback -create path (sling:Folder) /apps/sling/install - -set ACL for sling-jcr-install -allow jcr:read on / -allow rep:write on /apps/sling/install -end - -# content-package installer -create service user sling-package-install - -set ACL for sling-package-install -allow jcr:all on / -allow jcr:namespaceManagement,jcr:nodeTypeDefinitionManagement on :repository -end - -# -# 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. -# -# -# -# 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. -# -# The feature for Apache Sling - -[feature name=sling] - -[variables] - jackrabbit.version=2.20.0 - -[artifacts] - commons-codec/commons-codec/1.14 - commons-collections/commons-collections/3.2.2 - javax.mail/mail/1.5.0-b01 - org.antlr/antlr4-runtime/4.7.2 - org.apache.commons/commons-collections4/4.4 - org.apache.commons/commons-math/2.2 - org.apache.geronimo.bundles/jstl/1.2_1 - org.apache.httpcomponents/httpclient-osgi/4.5.10 - org.apache.httpcomponents/httpcore-osgi/4.4.12 - org.apache.jackrabbit.vault/org.apache.jackrabbit.vault/3.4.4 - org.apache.servicemix.bundles/org.apache.servicemix.bundles.rhino/1.7.10_1 - org.apache.sling/org.apache.sling.adapter/2.1.10 - org.apache.sling/org.apache.sling.auth.form/1.0.20 - org.apache.sling/org.apache.sling.bundleresource.impl/2.3.2 - org.apache.sling/org.apache.sling.commons.classloader/1.4.4 - org.apache.sling/org.apache.sling.commons.compiler/2.3.6 - org.apache.sling/org.apache.sling.commons.fsclassloader/1.0.12 - org.apache.sling/org.apache.sling.commons.mime/2.2.2 - org.apache.sling/org.apache.sling.commons.scheduler/2.7.6 - org.apache.sling/org.apache.sling.commons.threads/3.2.20 - org.apache.sling/org.apache.sling.engine/2.7.2 - org.apache.sling/org.apache.sling.fsresource/2.1.16 - org.apache.sling/org.apache.sling.i18n/2.5.14 - org.apache.sling/org.apache.sling.installer.console/1.1.0 - org.apache.sling/org.apache.sling.installer.factory.packages/1.0.4 - org.apache.sling/org.apache.sling.installer.hc/2.0.2 - org.apache.sling/org.apache.sling.installer.provider.jcr/3.2.2 - org.apache.sling/org.apache.sling.jcr.contentloader/2.3.0 - org.apache.sling/org.apache.sling.jcr.resource/3.0.20 - org.apache.sling/org.apache.sling.models.api/1.3.8 - org.apache.sling/org.apache.sling.models.impl/1.4.12 - org.apache.sling/org.apache.sling.resourceresolver/1.6.16 - org.apache.sling/org.apache.sling.scripting.api/2.2.0 - org.apache.sling/org.apache.sling.scripting.core/2.2.0 - org.apache.sling/org.apache.sling.scripting.el-api/1.0.2 - org.apache.sling/org.apache.sling.scripting.javascript/3.1.2 - org.apache.sling/org.apache.sling.scripting.jsp-api/1.0.2 - org.apache.sling/org.apache.sling.scripting.jsp.taglib/2.4.0 - org.apache.sling/org.apache.sling.scripting.jsp/2.4.2 - org.apache.sling/org.apache.sling.scripting.sightly.compiler.java/1.1.4-1.4.0 - org.apache.sling/org.apache.sling.scripting.sightly.compiler/1.2.4-1.4.0 - org.apache.sling/org.apache.sling.scripting.sightly.js.provider/1.1.0 - org.apache.sling/org.apache.sling.scripting.sightly.models.provider/1.0.10 - org.apache.sling/org.apache.sling.scripting.sightly.repl/1.0.6 - org.apache.sling/org.apache.sling.scripting.sightly.runtime/1.2.0-1.4.0 - org.apache.sling/org.apache.sling.scripting.sightly/1.3.2-1.4.0 - org.apache.sling/org.apache.sling.serviceuser.webconsole/1.0.2 - org.apache.sling/org.apache.sling.serviceusermapper/1.4.4 - org.apache.sling/org.apache.sling.servlets.get/2.1.40 - org.apache.sling/org.apache.sling.servlets.post/2.3.36 - org.apache.sling/org.apache.sling.servlets.resolver/2.6.4 -# Default Starter content -# Adjust responseTextFor503 in healthcheck.txt to "classpath:org.apache.sling.starter.content:startup/index.html" when updating org.apache.sling.starter.content, see SLING-8721 - org.apache.sling/org.apache.sling.starter.content/1.0.8 - org.apache.sling/org.apache.sling.xss/2.2.2 - -[artifacts startLevel=4] - org.apache.felix/org.apache.felix.metatype/1.2.2 - org.apache.felix/org.apache.felix.scr/2.1.20 - -[artifacts startLevel=5] - commons-fileupload/commons-fileupload/1.4 - commons-io/commons-io/2.6 - org.apache.aries.jmx/org.apache.aries.jmx.api/1.1.5 - org.apache.aries.jmx/org.apache.aries.jmx.core/1.1.8 - org.apache.aries.jmx/org.apache.aries.jmx.whiteboard/1.2.0 - org.apache.felix/org.apache.felix.bundlerepository/2.0.10 - org.apache.felix/org.apache.felix.http.whiteboard/4.0.0 - org.apache.felix/org.apache.felix.inventory/1.0.6 - org.apache.felix/org.apache.felix.prefs/1.1.0 - org.apache.felix/org.apache.felix.webconsole.plugins.ds/2.1.0 - org.apache.felix/org.apache.felix.webconsole.plugins.event/1.1.8 - org.apache.felix/org.apache.felix.webconsole.plugins.memoryusage/1.0.10 - org.apache.felix/org.apache.felix.webconsole.plugins.obr/1.0.4 - org.apache.felix/org.apache.felix.webconsole.plugins.packageadmin/1.0.4 - org.apache.felix/org.apache.felix.webconsole/4.5.0 - org.apache.sling/org.apache.sling.api/2.22.0 - org.apache.sling/org.apache.sling.auth.core/1.4.6 - org.apache.sling/org.apache.sling.commons.log.webconsole/1.0.0 - org.apache.sling/org.apache.sling.extensions.threaddump/0.2.2 - org.apache.sling/org.apache.sling.extensions.webconsolebranding/1.0.2 - org.apache.sling/org.apache.sling.extensions.webconsolesecurityprovider/1.2.4 - -[artifacts startLevel=10] - org.apache.felix/org.apache.felix.http.sslfilter/1.2.6 - org.apache.pdfbox/fontbox/2.0.17 - org.apache.pdfbox/jempbox/1.8.16 - org.apache.pdfbox/pdfbox/2.0.17 - org.apache.tika/tika-core/1.24 - org.apache.tika/tika-parsers/1.24 - -[artifacts startLevel=15] - com.google.guava/guava/15.0 - io.dropwizard.metrics/metrics-core/3.2.6 - org.apache.jackrabbit/jackrabbit-data/2.20.0 - org.apache.jackrabbit/jackrabbit-jcr-commons/2.20.0 - org.apache.jackrabbit/jackrabbit-jcr-rmi/2.20.0 - org.apache.jackrabbit/jackrabbit-spi-commons/2.20.0 - org.apache.jackrabbit/jackrabbit-spi/2.20.0 - org.apache.jackrabbit/jackrabbit-webdav/2.20.0 - org.apache.sling/org.apache.sling.commons.metrics/1.2.8 - org.apache.sling/org.apache.sling.jcr.api/2.4.0 - org.apache.sling/org.apache.sling.jcr.base/3.1.0 - org.apache.sling/org.apache.sling.jcr.davex/1.3.10 - org.apache.sling/org.apache.sling.jcr.jackrabbit.accessmanager/3.0.4 - org.apache.sling/org.apache.sling.jcr.jackrabbit.usermanager/2.2.8 - org.apache.sling/org.apache.sling.jcr.jcr-wrapper/2.0.0 - org.apache.sling/org.apache.sling.jcr.registration/1.0.6 - org.apache.sling/org.apache.sling.jcr.webconsole/1.0.2 - org.apache.sling/org.apache.sling.jcr.webdav/2.3.8 - org.apache.sling/org.apache.sling.resource.filter/1.0.0 - -[configurations] - org.apache.sling.commons.log.LogManager - org.apache.sling.commons.log.file="logs/error.log" - org.apache.sling.commons.log.file.number=I"7" - org.apache.sling.commons.log.file.size="'.'yyyy-MM-dd" - org.apache.sling.commons.log.level="info" - org.apache.sling.commons.log.packagingDataEnabled=B"true" - org.apache.sling.commons.log.pattern="%d{dd.MM.yyyy\ HH:mm:ss.SSS}\ *%level*\ [%thread]\ %logger\ %msg%n" - - org.apache.sling.engine.impl.log.RequestLogger - access.log.enabled=B"true" - access.log.output="log.access" - access.log.outputtype=I"0" - request.log.enabled=B"true" - request.log.output="log.request" - request.log.outputtype=I"0" - -# DavEx servlet requires config now - org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet - alias="/server" - -# WebDAV servlet requires config now - org.apache.sling.jcr.webdav.impl.servlets.SimpleWebDavServlet - dav.root="/dav" - -# configure the ScriptCache for scripts used by org.apache.sling.scripting.sightly.js.provider - org.apache.sling.scripting.core.impl.ScriptCacheImpl - org.apache.sling.scripting.cache.additional_extensions=[ \ - "js", \ - ] - - org.apache.sling.commons.log.LogManager.factory.config-access.log - org.apache.sling.commons.log.file="logs/access.log" - org.apache.sling.commons.log.level="info" - org.apache.sling.commons.log.names=[ \ - "log.access", \ - ] - org.apache.sling.commons.log.pattern="%msg%n" - - org.apache.sling.commons.log.LogManager.factory.config-request.log - org.apache.sling.commons.log.file="logs/request.log" - org.apache.sling.commons.log.level="info" - org.apache.sling.commons.log.names=[ \ - "log.request", \ - ] - org.apache.sling.commons.log.pattern="%msg%n" - -# TODO: remove bundles as their dependency on admin login is fixed, see SLING-5355 for linked issues -# For these bundles, admin login is considered "ok": -# org.apache.sling.jcr.contentloader - org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-sling - whitelist.bundles=[ \ - "org.apache.sling.discovery.commons", \ - "org.apache.sling.discovery.base", \ - "org.apache.sling.discovery.oak", \ - "org.apache.sling.extensions.webconsolesecurityprovider", \ - "org.apache.sling.i18n", \ - "org.apache.sling.jcr.base", \ - "org.apache.sling.jcr.contentloader", \ - "org.apache.sling.jcr.jackrabbit.usermanager", \ - "org.apache.sling.jcr.oak.server", \ - "org.apache.sling.jcr.repoinit", \ - "org.apache.sling.jcr.webconsole", \ - "org.apache.sling.servlets.post", \ - "org.apache.sling.serviceuser.webconsole", \ - ] - whitelist.name="sling" - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-i18n - user.mapping=[ \ - "org.apache.sling.i18n\=sling-i18n", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-installer-factories - user.mapping=[ \ - "org.apache.sling.installer.factory.packages\=sling-package-install", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-jcr-install - user.mapping=[ \ - "org.apache.sling.installer.provider.jcr\=sling-jcr-install", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-jcr-resource - user.mapping=[ \ - "org.apache.sling.jcr.resource:validation\=sling-readall", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-observation - user.mapping=[ \ - "org.apache.sling.jcr.resource:observation\=sling-readall", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-resourceresolver - user.mapping=[ \ - "org.apache.sling.resourceresolver:mapping\=sling-mapping", \ - "org.apache.sling.resourceresolver:hierarchy\=sling-readall", \ - "org.apache.sling.resourceresolver:observation\=sling-readall", \ - "org.apache.sling.resourceresolver:console\=sling-readall", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting - user.mapping=[ \ - "org.apache.sling.scripting.core\=sling-scripting", \ - "org.apache.sling.scripting.sightly.js.provider\=sling-scripting", \ - ] - -# the user mapping for the servlet resolver, subservice "console" namely the user sling-scripting is created in scripting.txt - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-servletsresolver - user.mapping=[ \ - "org.apache.sling.servlets.resolver:console\=sling-readall", \ - "org.apache.sling.servlets.resolver:scripts\=sling-scripting", \ - ] - - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-xss - user.mapping=[ \ - "org.apache.sling.xss\=sling-xss", \ - ] - - [:repoinit] -#<<< SLING-5848 - Define service user and ACLs for Scripting -create service user sling-scripting - -create path (sling:Folder) /libs -create path (sling:Folder) /apps - -set ACL for sling-scripting -deny jcr:all on / -allow jcr:read on /libs,/apps -end -# SLING-5848 - Define service user and ACLs for Scripting >>> - - - -# -# 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=sling-caconfig] - -[artifacts] - org.apache.sling/org.apache.sling.caconfig.api/1.2.0 - org.apache.sling/org.apache.sling.caconfig.impl/1.5.0 - org.apache.sling/org.apache.sling.caconfig.spi/1.3.4 - -[configurations] - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-sling-caconfig - user.mapping=[ \ - "org.apache.sling.caconfig.impl\=sling-readall", \ - ] - - [:repoinit] -create path (sling:Folder) /conf - - -# -# 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=sling-discovery] - -[artifacts] - org.apache.sling/org.apache.sling.discovery.api/1.0.4 - org.apache.sling/org.apache.sling.discovery.base/2.0.8 - org.apache.sling/org.apache.sling.discovery.commons/1.0.20 - org.apache.sling/org.apache.sling.discovery.oak/1.2.28 - org.apache.sling/org.apache.sling.discovery.support/1.0.4 - -[configurations] - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-sling.discovery - user.mapping=[ \ - "org.apache.sling.discovery.commons\=sling-discovery", \ - "org.apache.sling.discovery.base\=sling-discovery", \ - "org.apache.sling.discovery.oak\=sling-discovery", \ - ] - - [:repoinit] -create service user sling-discovery - -create path (sling:Folder) /var/discovery -create path (sling:Folder) /var/discovery/oak - -set ACL for sling-discovery -allow jcr:read,rep:write on /var/discovery -end - - - -# -# 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=sling-event] - -[artifacts] - org.apache.sling/org.apache.sling.event.dea/1.1.4 - org.apache.sling/org.apache.sling.event/4.2.12 - -[configurations] - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-sling.event - user.mapping=[ \ - "org.apache.sling.event\=sling-event", \ - "org.apache.sling.event.dea\=sling-event", \ - ] - - [:repoinit] -create service user sling-event - -create path (sling:Folder) /var -create path (sling:Folder) /var/eventing - -set ACL for sling-event -allow jcr:read,rep:write on /var/eventing -end - - - -# -# 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=sling-validation] - -[artifacts] - org.apache.sling/org.apache.sling.validation.api/1.0.0 - org.apache.sling/org.apache.sling.validation.core/1.0.4 - -[configurations] - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-validation - user.mapping=[ \ - "org.apache.sling.validation.core\=sling-validation", \ - ] - - [:repoinit] -create service user sling-validation - -create path (sling:Folder) /apps -create path (sling:Folder) /libs - -set ACL for sling-validation -allow jcr:read on /apps -allow jcr:read on /libs -end - - -# -# 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. -# -# The feature for Apache Sling - Slingshot Sample App - -[feature name=slingshot version=0.9.0] - -[artifacts] - org.apache.sling/org.apache.sling.sample.slingshot/0.9.0 - -[configurations] - org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-sling.slingshot - user.mapping=[ \ - "org.apache.sling.sample.slingshot\=slingshot-service", \ - ] - - [:repoinit] -create service user slingshot-service -create user slingshot1 with password slingshot1 -create user slingshot2 with password slingshot2 - -create path (sling:Folder) /content/slingshot -create path (sling:Folder) /content/slingshot/users -create path (sling:Folder) /content/slingshot/users/slingshot1 -create path (sling:Folder) /content/slingshot/users/slingshot2 - -set ACL for slingshot-service -allow jcr:read,rep:write on /content/slingshot -end - -set ACL for slingshot1 -allow jcr:read,rep:write on /content/slingshot/users/slingshot1 -end - -set ACL for slingshot2 -allow jcr:read,rep:write on /content/slingshot/users/slingshot2 -end - -# -# 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. -# -# The :standalone feature contains artifacts for the standalone jar - -[feature name=standalone] - -# Add a servlet implementation for the standalone case -[artifacts startLevel=5 runModes=:standalone] - org.apache.felix/org.apache.felix.http.jetty/4.0.18 - org.apache.felix/org.apache.felix.http.servlet-api/1.1.2 - -# -# 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. -# -# The :standalone feature contains artifacts for the standalone jar -[feature name=webapp] - -# Add the felix servlet bridge for the webapp case -[artifacts runModes=:webapp] - org.apache.felix/org.apache.felix.http.bridge/4.0.12 diff --git a/src/it/annotations-it/verify.groovy b/src/it/annotations-it/verify.groovy new file mode 100644 index 0000000..db2f996 --- /dev/null +++ b/src/it/annotations-it/verify.groovy @@ -0,0 +1,91 @@ +/* + * 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. + */ + +// Verify the OSGI-INF xml files generated by the bnd plugin based +// on our annotations + +// Utility functions +def getXml(filename) { + return new XmlSlurper().parse(new File(basedir, "target/classes/OSGI-INF/" + filename)) +} + +def assertPropertyAttribute(xml, name, value) { + assert(xml.property.find{ it.@name == name && it.@value == value }) +} + +def assertProperty(xml, name, String [] expected) { + def linesFromXml = xml.property.find{ it.@name == name }.toString().split('\n') + expected.each { + assert(linesFromXml.contains(it)) + } + assert(linesFromXml.length == expected.length) +} + +def assertBoolean(xml, name, value) { + assert(xml.property.find{ it.@name == name && it.@type == 'Boolean' && it.@value == value }) +} + +// The actual tests +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.DeprecatedAdapterFactory.xml") + assertProperty(xml, 'adaptables', 'org.apache.sling.api.SlingHttpServletRequest') + assertProperty(xml, 'adapters', 'org.apache.sling.api.resource.Resource') + assertBoolean(xml, 'adapter.deprecated', 'true') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.IntegerAndShortToLongAdapterFactory.xml") + assertProperty(xml, 'adaptables', 'java.lang.Integer', 'java.lang.Short') + assertProperty(xml, 'adapters', 'java.lang.Long') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.InvalidEmptyAdapterFactory.xml") + assertPropertyAttribute(xml, 'adapter.condition', 'Configuration is invalid') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.InvalidNoAdaptablesAdapterFactory.xml") + assertProperty(xml, 'adapters', 'java.lang.Void') + assertPropertyAttribute(xml, 'adapter.condition', 'Configuration is invalid') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.InvalidNoAdaptersAdapterFactory.xml") + assertProperty(xml, 'adaptables', 'java.lang.Void') + assertPropertyAttribute(xml, 'adapter.condition', 'Configuration is invalid') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.LongToIntegerIfFitsAdapterFactory.xml") + assertProperty(xml, 'adaptables', 'java.lang.Long') + assertProperty(xml, 'adapters', 'java.lang.Integer') + assertPropertyAttribute(xml, 'adapter.condition', 'If the value is small enough to fit in an integer.') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.ShortToIntegerAndLongAdapterFactory.xml") + assertProperty(xml, 'adaptables', 'java.lang.Short') + assertProperty(xml, 'adapters', 'java.lang.Long', 'java.lang.Integer') +} + +{ + def xml = getXml("org.apache.sling.adapter.annotations.testing.adapters.TextLengthIfFitsAdapterFactory.xml") + assertProperty(xml, 'adaptables', 'java.lang.CharSequence', 'java.lang.String') + assertProperty(xml, 'adapters', 'java.lang.Short', 'java.lang.Integer', 'java.lang.Long', 'java.math.BigInteger') + assertPropertyAttribute(xml, 'adapter.condition', 'If the text length fits in the requested type.') +} \ No newline at end of file
