Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/master afc19d0e7 -> 6aa6bb751
Fixed OSGI support. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/6aa6bb75 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/6aa6bb75 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/6aa6bb75 Branch: refs/heads/master Commit: 6aa6bb751f6968f3d68f3994ffbfc324e20800b9 Parents: afc19d0 Author: anatole <anat...@apache.org> Authored: Sun Dec 18 23:52:33 2016 +0100 Committer: anatole <anat...@apache.org> Committed: Sun Dec 18 23:52:33 2016 +0100 ---------------------------------------------------------------------- apache-commons/pom.xml | 24 --- camel/pom.xml | 12 -- configured-sysprops/pom.xml | 26 --- consul/pom.xml | 16 -- etcd/pom.xml | 17 -- hazelcast/pom.xml | 17 -- jodatime/pom.xml | 26 --- management/bnd.bnd | 2 + management/pom.xml | 17 -- metamodel/pom.xml | 21 --- .../tamaya/metamodel/dsl/IntegrationTest.java | 57 +++++++ osgi/bnd.bnd | 4 - osgi/common/bnd.bnd | 4 + osgi/common/pom.xml | 67 -------- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 115 ------------- osgi/features/pom.xml | 65 ++++++- osgi/features/src/main/features/features.xml | 5 +- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 168 +++++++++++++++++++ .../META-INF/javaconfiguration.properties | 21 +++ .../test/resources/org.ops4j.pax.logging.cfg | 48 ++++++ osgi/pom.xml | 2 +- propertysources/pom.xml | 24 --- remote/pom.xml | 16 -- server/pom.xml | 24 --- tamaya-sandbox.iml | 9 +- ui/base/bnd.bnd | 5 + ui/events/bnd.bnd | 2 + ui/mutableconfig/bnd.bnd | 2 + usagetracker/pom.xml | 21 --- validation/pom.xml | 2 +- 30 files changed, 380 insertions(+), 459 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/apache-commons/pom.xml ---------------------------------------------------------------------- diff --git a/apache-commons/pom.xml b/apache-commons/pom.xml index 4486b29..4be8e5c 100644 --- a/apache-commons/pom.xml +++ b/apache-commons/pom.xml @@ -48,28 +48,4 @@ under the License. </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Import-Package> - org.apache.tamaya, - org.apache.tamaya.spi, - org.apache.tamaya.format, - org.apache.commons, - javax.annotation, - * - </Import-Package> - <Export-Package> - org.apache.tamaya.integration.commons - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/camel/pom.xml ---------------------------------------------------------------------- diff --git a/camel/pom.xml b/camel/pom.xml index 806508e..0e06bd7 100644 --- a/camel/pom.xml +++ b/camel/pom.xml @@ -48,18 +48,6 @@ under the License. </execution> </executions> </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.integration.camel - </Export-Package> - </instructions> - </configuration> - </plugin> </plugins> </build> <dependencies> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/configured-sysprops/pom.xml ---------------------------------------------------------------------- diff --git a/configured-sysprops/pom.xml b/configured-sysprops/pom.xml index 780e8d8..980821b 100644 --- a/configured-sysprops/pom.xml +++ b/configured-sysprops/pom.xml @@ -30,32 +30,6 @@ under the License. <name>Apache Tamaya Modules - Configured System Properties</name> <packaging>jar</packaging> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Import-Package> - org.apache.tamaya, - org.apache.tamaya.spi, - org.apache.tamaya.resources, - org.apache.tamaya.spisupport, - org.apache.tamaya.functions, - javax.annotation, - * - </Import-Package> - <Export-Package> - org.apache.tamaya.integration.se - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> <dependency> <groupId>junit</groupId> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/consul/pom.xml ---------------------------------------------------------------------- diff --git a/consul/pom.xml b/consul/pom.xml index bbcecc8..9e254d0 100644 --- a/consul/pom.xml +++ b/consul/pom.xml @@ -30,22 +30,6 @@ under the License. <name>Apache Tamaya Modules - Consul</name> <packaging>jar</packaging> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.consul - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> <dependencies> <dependency> <groupId>junit</groupId> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/etcd/pom.xml ---------------------------------------------------------------------- diff --git a/etcd/pom.xml b/etcd/pom.xml index 52da6a9..37f668b 100644 --- a/etcd/pom.xml +++ b/etcd/pom.xml @@ -30,23 +30,6 @@ under the License. <name>Apache Tamaya Modules - etcd PropertySource</name> <packaging>jar</packaging> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.etcd - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> <dependency> <groupId>junit</groupId> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/hazelcast/pom.xml ---------------------------------------------------------------------- diff --git a/hazelcast/pom.xml b/hazelcast/pom.xml index e9ce8a7..8b1babe 100644 --- a/hazelcast/pom.xml +++ b/hazelcast/pom.xml @@ -30,23 +30,6 @@ <name>Apache Tamaya Modules - Hazelcast PropertySource</name> <packaging>jar</packaging> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.etcd - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> <dependency> <groupId>junit</groupId> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/jodatime/pom.xml ---------------------------------------------------------------------- diff --git a/jodatime/pom.xml b/jodatime/pom.xml index 3a89fc7..7e69c00 100644 --- a/jodatime/pom.xml +++ b/jodatime/pom.xml @@ -84,30 +84,4 @@ under the License. </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Import-Package> - org.apache.tamaya, - org.apache.tamaya.spi, - org.jodatime, - javax.annotation, - * - </Import-Package> - <Export-Package> - org.apache.tamaya.jodatime - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - - - </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/management/bnd.bnd ---------------------------------------------------------------------- diff --git a/management/bnd.bnd b/management/bnd.bnd new file mode 100644 index 0000000..9a99750 --- /dev/null +++ b/management/bnd.bnd @@ -0,0 +1,2 @@ +Export-Package: \ + org.apache.tamaya.management \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/management/pom.xml ---------------------------------------------------------------------- diff --git a/management/pom.xml b/management/pom.xml index b5dcc0b..eea5c23 100644 --- a/management/pom.xml +++ b/management/pom.xml @@ -61,21 +61,4 @@ under the License. </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.management - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/metamodel/pom.xml ---------------------------------------------------------------------- diff --git a/metamodel/pom.xml b/metamodel/pom.xml index a103441..8dce016 100644 --- a/metamodel/pom.xml +++ b/metamodel/pom.xml @@ -106,25 +106,4 @@ </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.metamodel, - org.apache.tamaya.metamodel.spi - </Export-Package> - <Private-Package> - org.apache.tamaya.metamodel.internal - </Private-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java ---------------------------------------------------------------------- diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java b/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java new file mode 100644 index 0000000..00e9f35 --- /dev/null +++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/dsl/IntegrationTest.java @@ -0,0 +1,57 @@ +/* + * 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.tamaya.metamodel.dsl; + +import org.apache.tamaya.Configuration; +import org.apache.tamaya.ConfigurationProvider; +import org.apache.tamaya.metamodel.MetaConfiguration; +import org.junit.Test; + +import java.net.URL; + +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertTrue; + +/** + * Created by atsticks on 06.12.16. + */ +public class IntegrationTest { + + @Test + public void checkSystemLoads(){ + assertNotNull(ConfigurationProvider.getConfiguration()); + System.out.println(ConfigurationProvider.getConfiguration()); + } + + @Test + public void testEmptyConfig(){ + Configuration config = MetaConfiguration.createConfiguration(getConfig("IntegrationTests/empty-config.xml")); + assertNotNull(config); + assertTrue(config.getProperties().isEmpty()); + assertTrue(config.getContext().getPropertySources().isEmpty()); + assertTrue(config.getContext().getPropertyConverters().isEmpty()); + assertTrue(config.getContext().getPropertyFilters().isEmpty()); + } + + private URL getConfig(String resource) { + return getClass().getClassLoader().getResource(resource); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/bnd.bnd ---------------------------------------------------------------------- diff --git a/osgi/bnd.bnd b/osgi/bnd.bnd deleted file mode 100644 index 585492b..0000000 --- a/osgi/bnd.bnd +++ /dev/null @@ -1,4 +0,0 @@ -Export-Package: \ - org.apache.tamaya.osgi -Bundle-Activator: org.apache.tamaya.integration.osgi.Activator -Export-Service: org.osgi.service.cm.ConfigurationAdmin http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/common/bnd.bnd ---------------------------------------------------------------------- diff --git a/osgi/common/bnd.bnd b/osgi/common/bnd.bnd new file mode 100644 index 0000000..5115cdd --- /dev/null +++ b/osgi/common/bnd.bnd @@ -0,0 +1,4 @@ +Export-Package: \ + org.apache.tamaya.osgi +Bundle-Activator: org.apache.tamaya.osgi.Activator +Export-Service: org.osgi.service.cm.ConfigurationAdmin http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/common/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/common/pom.xml b/osgi/common/pom.xml index c10de13..cbfeae1 100644 --- a/osgi/common/pom.xml +++ b/osgi/common/pom.xml @@ -34,28 +34,9 @@ <description>Tamaya Based OSGI Implementation of ConfigAdmin and Config Injection</description> <properties> - <karaf.version>4.0.7</karaf.version> <osgi.version>6.0.0</osgi.version> - <pax.exam.version>4.5.0</pax.exam.version> </properties> - <build> - <plugins> - <plugin> - <groupId>biz.aQute.bnd</groupId> - <artifactId>bnd-maven-plugin</artifactId> - <version>3.3.0</version> - <executions> - <execution> - <goals> - <goal>bnd-process</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - <dependencies> <dependency> <groupId>org.osgi</groupId> @@ -64,29 +45,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.apache.karaf.features</groupId> - <artifactId>framework</artifactId> - <version>${karaf.version}</version> - <type>kar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.karaf.features</groupId> - <artifactId>standard</artifactId> - <version>${karaf.version}</version> - <classifier>features</classifier> - <type>xml</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.karaf.features</groupId> - <artifactId>enterprise</artifactId> - <version>${karaf.version}</version> - <classifier>features</classifier> - <type>xml</type> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.osgi</groupId> <artifactId>org.osgi.core</artifactId> <version>${osgi.version}</version> @@ -117,13 +75,6 @@ <artifactId>tamaya-spisupport</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.apache.tamaya.ext</groupId> - <artifactId>tamaya-osgi-features</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - </dependency> <!-- Testing --> @@ -140,24 +91,6 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-container-karaf</artifactId> - <version>${pax.exam.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-junit4</artifactId> - <version>${pax.exam.version}</version> - <scope>test</scope> - </dependency> - <!-- https://mvnrepository.com/artifact/org.ops4j.pax.url/pax-url-mvn --> - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-mvn</artifactId> - <version>1.3.7</version> - </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/common/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java ---------------------------------------------------------------------- diff --git a/osgi/common/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java b/osgi/common/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java deleted file mode 100644 index d1014ef..0000000 --- a/osgi/common/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java +++ /dev/null @@ -1,115 +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.tamaya.osgi; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; -import org.ops4j.pax.exam.options.BootClasspathLibraryOption; -import org.ops4j.pax.exam.options.MavenUrlReference; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.osgi.service.cm.ConfigurationAdmin; - -import javax.inject.Inject; -import java.io.File; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; -import static org.ops4j.pax.exam.CoreOptions.*; - -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerMethod.class) -public class OSGIKarafTest { - - @Inject - private ConfigurationAdmin configAdmin; - - @Configuration - public Option[] config() { - return options( - // distribution to test: Karaf 3.0.3 - KarafDistributionOption.karafDistributionConfiguration() - .frameworkUrl(CoreOptions.maven() - .groupId("org.apache.karaf") - .artifactId("apache-karaf") - .type("zip") - .version(getKarafVersion())) - .karafVersion(getKarafVersion()) - .name("ApacheKaraf") - .useDeployFolder(false) - .unpackDirectory(new File("target/karaf")), - // no local and remote consoles -// KarafDistributionOption.debugConfiguration("5005", true), - KarafDistributionOption.configureConsole().startLocalConsole(), - KarafDistributionOption.configureConsole().ignoreRemoteShell(), - // keep runtime folder allowing analysing results - KarafDistributionOption.keepRuntimeFolder(), - // use custom logging configuration file with a custom appender - KarafDistributionOption.replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", new File( - "src/test/resources/org.ops4j.pax.logging.cfg")), - - mavenBundle("org.apache.geronimo.specs", "geronimo-annotation_1.2_spec", "1.0-alpha-1"), - mavenBundle("org.apache.tamaya", "tamaya-api", "0.3-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya", "tamaya-core", "0.3-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-spisupport", "0.3-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-functions", "0.3-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-osgi", "0.3-incubating-SNAPSHOT"), - KarafDistributionOption.features( - maven().groupId("org.apache.karaf.features").artifactId("standard").type("xml") - .classifier("features").version(getKarafVersion()), "aries-blueprint"), -// KarafDistributionOption.features( -// "mvn:org.apache.karaf.features/standard/4.0.7/xml/features", -// "aries-blueprint"), -// bundle("reference:file:target/test-classes"), - junitBundles() - ); - } - - private String getKarafVersion() { - return "4.0.7"; - } - - - @Test - @Ignore - public void ensureEnvironmentIsWorkingAndTamayaIsActive() { - assertNotNull(configAdmin); - assertTrue(configAdmin instanceof TamayaConfigAdminImpl); - } - - @Test - @Ignore - public void getConfiguration() throws Exception { - org.osgi.service.cm.Configuration config = configAdmin.getConfiguration("tamaya"); - assertNotNull(config); - assertFalse(config.getProperties().isEmpty()); - assertEquals(config.getProperties().size(), 4); - assertEquals(config.getProperties().get("my.testProperty1"), "success1"); - assertEquals(config.getProperties().get("my.testProperty2"), "success2"); - assertEquals(config.getProperties().get("my.testProperty3"), "success3"); - assertEquals(config.getProperties().get("my.testProperty4"), "success4"); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/features/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/features/pom.xml b/osgi/features/pom.xml index e7ea3eb..7df4643 100644 --- a/osgi/features/pom.xml +++ b/osgi/features/pom.xml @@ -27,10 +27,15 @@ limitations under the License. <relativePath>..</relativePath> </parent> - <artifactId>tamaya-osgi-features</artifactId> - <packaging>pom</packaging> + <artifactId>tamaya-features</artifactId> + <packaging>bundle</packaging> <name>Apache Tamaya :: OSGI Integration :: Features</name> + <properties> + <karaf.version>4.0.7</karaf.version> + <pax.exam.version>4.5.0</pax.exam.version> + </properties> + <build> <plugins> @@ -81,4 +86,60 @@ limitations under the License. </plugin> </plugins> </build> + + <dependencies> + <dependency> + <groupId>org.apache.tamaya.ext</groupId> + <artifactId>tamaya-osgi</artifactId> + <version>${project.version}</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-junit4</artifactId> + <version>${pax.exam.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-container-karaf</artifactId> + <version>${pax.exam.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.karaf.features</groupId> + <artifactId>framework</artifactId> + <version>${karaf.version}</version> + <type>kar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.karaf.features</groupId> + <artifactId>standard</artifactId> + <version>${karaf.version}</version> + <classifier>features</classifier> + <type>xml</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.karaf.features</groupId> + <artifactId>enterprise</artifactId> + <version>${karaf.version}</version> + <classifier>features</classifier> + <type>xml</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.url</groupId> + <artifactId>pax-url-mvn</artifactId> + <version>1.3.7</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + <version>1.3</version> + <scope>test</scope> + </dependency> + </dependencies> </project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/features/src/main/features/features.xml ---------------------------------------------------------------------- diff --git a/osgi/features/src/main/features/features.xml b/osgi/features/src/main/features/features.xml index 0655d30..5a36bff 100644 --- a/osgi/features/src/main/features/features.xml +++ b/osgi/features/src/main/features/features.xml @@ -11,9 +11,8 @@ See the License for the specific language governing permissions and limitations under the License. --> -<features name="org-apache-tamaya-${project.version}"> - <feature name="org-apache-tamaya" version="${project.version}"> - <feature>org-apache-tamaya</feature> +<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="org-apache-tamaya"> + <feature name="configadmin" version="${project.version}"> <bundle>mvn:${project.groupId}/tamaya-osgi/${project.version}/jar</bundle> <bundle>mvn:${project.groupId}/tamaya-functions/${project.version}/jar</bundle> <bundle>mvn:${project.groupId}/tamaya-spi-support/${project.version}/jar</bundle> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java ---------------------------------------------------------------------- diff --git a/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java b/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java new file mode 100644 index 0000000..28936ea --- /dev/null +++ b/osgi/features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java @@ -0,0 +1,168 @@ +/* + * 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.tamaya.osgi; + +import org.apache.karaf.features.Feature; +import org.apache.karaf.features.FeaturesService; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.ConfigurationManager; +import org.ops4j.pax.exam.CoreOptions; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.karaf.options.KarafDistributionOption; +import org.ops4j.pax.exam.options.BootClasspathLibraryOption; +import org.ops4j.pax.exam.options.MavenUrlReference; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerMethod; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.cm.ConfigurationAdmin; +import org.slf4j.Logger; + +import javax.inject.Inject; +import javax.swing.*; +import java.awt.*; +import java.io.File; + +import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.ops4j.pax.exam.CoreOptions.*; + +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerMethod.class) +public class OSGIKarafTest { + + @Inject + private BundleContext bundleContext; + + @Inject + protected FeaturesService featuresService; + private ConfigurationAdmin configAdmin; + + @Configuration + public Option[] config() { + MavenUrlReference karafStandardRepo = maven() + .groupId("org.apache.karaf.features") + .artifactId("standard") + .classifier("features") + .type("xml") + .version(getKarafVersion()); + MavenUrlReference tamayaRepo = maven() + .groupId("org.apache.tamaya.ext") + .artifactId("tamaya-osgi-features") + .type("xml") + .classifier("features") + .version("0.3-incubating-SNAPSHOT"); + return options( + // distribution to test: Karaf 3.0.3 + KarafDistributionOption.karafDistributionConfiguration() + .frameworkUrl(CoreOptions.maven() + .groupId("org.apache.karaf") + .artifactId("apache-karaf") + .type("zip") + .version(getKarafVersion())) + .karafVersion(getKarafVersion()) + .name("ApacheKaraf") + .useDeployFolder(false) + .unpackDirectory(new File("target/karaf")), + // no local and remote consoles +// KarafDistributionOption.debugConfiguration("5005", true), + KarafDistributionOption.configureConsole().ignoreLocalConsole(), + KarafDistributionOption.configureConsole().ignoreRemoteShell(), + // keep runtime folder allowing analysing results + KarafDistributionOption.keepRuntimeFolder(), + // use custom logging configuration file with a custom appender + KarafDistributionOption.replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", new File( + "src/test/resources/org.ops4j.pax.logging.cfg")), + + mavenBundle("org.apache.geronimo.specs", "geronimo-annotation_1.2_spec", "1.0-alpha-1"), + mavenBundle("org.apache.tamaya", "tamaya-api", "0.3-incubating-SNAPSHOT"), + mavenBundle("org.apache.tamaya", "tamaya-core", "0.3-incubating-SNAPSHOT"), + mavenBundle("org.apache.tamaya.ext", "tamaya-spisupport", "0.3-incubating-SNAPSHOT"), + mavenBundle("org.apache.tamaya.ext", "tamaya-functions", "0.3-incubating-SNAPSHOT"), + mavenBundle("org.apache.tamaya.ext", "tamaya-osgi", "0.3-incubating-SNAPSHOT"), + KarafDistributionOption.features( + karafStandardRepo, "scr"), + KarafDistributionOption.features( + tamayaRepo, "tamaya-osgi-features/0.3.0.incubating-SNAPSHOT"), +// bundle("reference:file:target/test-classes"), + junitBundles() + ); + } + + public static String getKarafVersion() { + ConfigurationManager cm = new ConfigurationManager(); + String karafVersion = cm.getProperty("pax.exam.karaf.version", "4.0.7"); + return karafVersion; + } + + @Before + public void beforeTest()throws Exception { + featuresService.installFeature("config/4.0.7"); + featuresService.installFeature("tamaya-osgi-features/0.3.0.incubating-SNAPSHOT"); + } + + @Test + public void ensureFeatureIsInstalled() throws Exception { + Feature feature = featuresService.getFeature("tamaya-osgi-features/0.3.0.incubating-SNAPSHOT"); + assertNotNull(feature); + for (Feature feat : featuresService.listFeatures()){ + System.out.println(feat); + } + } + + @Test + public void ensureEnvironmentIsWorkingAndTamayaIsActive() { + ConfigurationAdmin configAdmin = getConfigAdmin(); + assertNotNull(configAdmin); + assertTrue(configAdmin instanceof TamayaConfigAdminImpl); + System.out.println("ConfigAdmin found in Karaf OSGI Container: " + configAdmin); + } + + @Test + @Ignore + public void getConfiguration() throws Exception { + ConfigurationAdmin configAdmin = getConfigAdmin(); + org.osgi.service.cm.Configuration config = configAdmin.getConfiguration("tamaya"); + assertNotNull(config); + assertNotNull(config.getProperties()); + assertFalse(config.getProperties().isEmpty()); + assertEquals(config.getProperties().size(), 4); + assertEquals(config.getProperties().get("my.testProperty1"), "success1"); + assertEquals(config.getProperties().get("my.testProperty2"), "success2"); + assertEquals(config.getProperties().get("my.testProperty3"), "success3"); + assertEquals(config.getProperties().get("my.testProperty4"), "success4"); + StringBuilder b = new StringBuilder(); + b.append("Print all configs....\n\n"); + org.osgi.service.cm.Configuration[] configs = configAdmin.listConfigurations("*"); + for (org.osgi.service.cm.Configuration cfg : configs) { + b.append("\nConfiguration found in Karaf OSGI Container: " + cfg); + b.append("\n-------------------------------------------------"); + } + System.out.println(b.toString()); + } + + public ConfigurationAdmin getConfigAdmin() { + return bundleContext.getService(bundleContext.getServiceReference(ConfigurationAdmin.class)); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/features/src/test/resources/META-INF/javaconfiguration.properties ---------------------------------------------------------------------- diff --git a/osgi/features/src/test/resources/META-INF/javaconfiguration.properties b/osgi/features/src/test/resources/META-INF/javaconfiguration.properties new file mode 100644 index 0000000..f2879a0 --- /dev/null +++ b/osgi/features/src/test/resources/META-INF/javaconfiguration.properties @@ -0,0 +1,21 @@ +# 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. +# +[tamaya]my.testProperty1=success1 +[tamaya]my.testProperty2=success2 +[tamaya]my.testProperty3=success3 +[tamaya]my.testProperty4=success4 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/features/src/test/resources/org.ops4j.pax.logging.cfg ---------------------------------------------------------------------- diff --git a/osgi/features/src/test/resources/org.ops4j.pax.logging.cfg b/osgi/features/src/test/resources/org.ops4j.pax.logging.cfg new file mode 100644 index 0000000..6683438 --- /dev/null +++ b/osgi/features/src/test/resources/org.ops4j.pax.logging.cfg @@ -0,0 +1,48 @@ +# 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. +# +#updated by pax-exam +#Sun Nov 27 20:55:11 CET 2016 +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.sift.appender.append=true +log4j.appender.out.maxFileSize=1MB +log4j.appender.audit.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n +log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log +log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout +log4j.appender.out.append=true +log4j.appender.sift.appender=org.apache.log4j.FileAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out=org.apache.log4j.RollingFileAppender +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n +log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer +log4j.appender.out.file=${karaf.data}/log/karaf.log +log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender +log4j.appender.audit.append=true +log4j.appender.audit.maxBackupIndex=10 +log4j.appender.audit.layout=org.apache.log4j.PatternLayout +log4j.appender.sift.key=bundle.name +log4j.appender.audit.maxFileSize=1MB +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.additivity.org.apache.karaf.jaas.modules.audit=false +log4j.logger.org.apache.karaf.jaas.modules.audit=INFO, audit +log4j.appender.audit.file=${karaf.data}/security/audit.log +log4j.appender.sift.default=karaf +log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n +log4j.appender.out.maxBackupIndex=10 +log4j.appender.audit=org.apache.log4j.RollingFileAppender +log4j.rootLogger=WARN, out, stdout, osgi\:* +log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/osgi/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/pom.xml b/osgi/pom.xml index 1578a16..0d3f859 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -68,8 +68,8 @@ </dependencies> <modules> - <module>features</module> <module>common</module> + <module>features</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/propertysources/pom.xml ---------------------------------------------------------------------- diff --git a/propertysources/pom.xml b/propertysources/pom.xml index 8271f61..18da028 100644 --- a/propertysources/pom.xml +++ b/propertysources/pom.xml @@ -63,28 +63,4 @@ under the License. </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Import-Package> - org.apache.tamaya, - org.apache.tamaya.spi, - org.apache.tamaya.format, - javax.annotation, - * - </Import-Package> - <Export-Package> - org.apache.tamaya.metamodel.simple - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/remote/pom.xml ---------------------------------------------------------------------- diff --git a/remote/pom.xml b/remote/pom.xml index a9cb1a4..3619bc5 100644 --- a/remote/pom.xml +++ b/remote/pom.xml @@ -57,20 +57,4 @@ under the License. </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.remote - </Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index baa2355..eead236 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -142,17 +142,6 @@ under the License. </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifest> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - </manifest> - </archive> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.3</version> <configuration> @@ -185,19 +174,6 @@ under the License. </execution> </executions> </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.server, - org.apache.tamaya.server.spi - </Export-Package> - </instructions> - </configuration> - </plugin> </plugins> </build> </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/tamaya-sandbox.iml ---------------------------------------------------------------------- diff --git a/tamaya-sandbox.iml b/tamaya-sandbox.iml index 1e73e41..75636dc 100644 --- a/tamaya-sandbox.iml +++ b/tamaya-sandbox.iml @@ -1,13 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/../tamaya/target/classes" /> - <output-test url="file://$MODULE_DIR$/../tamaya/target/test-classes" /> +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/target/classes" /> + <output-test url="file://$MODULE_DIR$/target/test-classes" /> <content url="file://$MODULE_DIR$"> <excludeFolder url="file://$MODULE_DIR$/target" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-annotation_1.2_spec:1.0-alpha-1" level="project" /> </component> </module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/ui/base/bnd.bnd ---------------------------------------------------------------------- diff --git a/ui/base/bnd.bnd b/ui/base/bnd.bnd new file mode 100644 index 0000000..ce176f3 --- /dev/null +++ b/ui/base/bnd.bnd @@ -0,0 +1,5 @@ +Export-Package: \ + org.apache.tamaya.ui,\ + org.apache.tamaya.ui.event,\ + org.apache.tamaya.ui.spi,\ + org.apache.tamaya.ui.views \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/ui/events/bnd.bnd ---------------------------------------------------------------------- diff --git a/ui/events/bnd.bnd b/ui/events/bnd.bnd new file mode 100644 index 0000000..4760ca4 --- /dev/null +++ b/ui/events/bnd.bnd @@ -0,0 +1,2 @@ +Export-Package: \ + org.apache.tamaya.ui.events \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/ui/mutableconfig/bnd.bnd ---------------------------------------------------------------------- diff --git a/ui/mutableconfig/bnd.bnd b/ui/mutableconfig/bnd.bnd new file mode 100644 index 0000000..9394567 --- /dev/null +++ b/ui/mutableconfig/bnd.bnd @@ -0,0 +1,2 @@ +Export-Package: \ + org.apache.tamaya.ui.mutableconfig \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/usagetracker/pom.xml ---------------------------------------------------------------------- diff --git a/usagetracker/pom.xml b/usagetracker/pom.xml index 226f280..38cb7e0 100644 --- a/usagetracker/pom.xml +++ b/usagetracker/pom.xml @@ -89,25 +89,4 @@ under the License. </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package> - org.apache.tamaya.model, - org.apache.tamaya.model.spi - </Export-Package> - <Private-Package> - org.apache.tamaya.model.internal - </Private-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/6aa6bb75/validation/pom.xml ---------------------------------------------------------------------- diff --git a/validation/pom.xml b/validation/pom.xml index 2f81395..e190257 100644 --- a/validation/pom.xml +++ b/validation/pom.xml @@ -30,7 +30,7 @@ <name>Apache Tamaya Modules - Validation</name> <description>This extension module provides functionality to validate configuration. </description> - <packaging>jar</packaging> + <packaging>bundle</packaging> <properties> <jdkVersion>1.7</jdkVersion>