TAMAYA-297: Readded/Simplified Karaf feature project.
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/58336629 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/58336629 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/58336629 Branch: refs/heads/master Commit: 58336629cbc7a5180a9f50653b2192155d85fefe Parents: 2281cb3 Author: anatole <[email protected]> Authored: Sun Sep 24 22:12:01 2017 +0200 Committer: anatole <[email protected]> Committed: Sun Sep 24 22:12:01 2017 +0200 ---------------------------------------------------------------------- osgi/karaf-features/pom.xml | 68 ------- .../src/main/features/features.xml | 101 ++++++++-- .../test/java/org/apache/tamaya/osgi/Hello.java | 10 - .../java/org/apache/tamaya/osgi/HelloImpl.java | 17 -- .../apache/tamaya/osgi/InjectionKarafTest.java | 149 --------------- .../org/apache/tamaya/osgi/OSGIKarafTest.java | 188 ------------------- .../src/test/resources/META-INF/OSGIResource | 17 -- .../META-INF/javaconfiguration.properties | 21 --- .../test/resources/org.ops4j.pax.logging.cfg | 48 ----- osgi/pom.xml | 2 +- 10 files changed, 82 insertions(+), 539 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/pom.xml b/osgi/karaf-features/pom.xml index f940767..8d8c2d4 100644 --- a/osgi/karaf-features/pom.xml +++ b/osgi/karaf-features/pom.xml @@ -44,72 +44,4 @@ limitations under the License. </plugins> </build> - <dependencies> - <dependency> - <groupId>org.apache.tamaya.ext</groupId> - <artifactId>tamaya-osgi_alpha</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-atinject_1.0_spec</artifactId> - </dependency> - - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-junit4</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-container-karaf</artifactId> - </dependency> - <dependency> - <groupId>org.apache.karaf.features</groupId> - <artifactId>framework</artifactId> - <version>${dependency.karaf.version}</version> - <type>kar</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.karaf.features</groupId> - <artifactId>standard</artifactId> - <version>${dependency.karaf.version}</version> - <classifier>features</classifier> - <type>xml</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.karaf.features</groupId> - <artifactId>enterprise</artifactId> - <version>${dependency.karaf.version}</version> - <classifier>features</classifier> - <type>xml</type> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-container-forked</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-mvn</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-reference</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-wrap</artifactId> - </dependency> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>java-hamcrest</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </dependency> - </dependencies> - </project> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/main/features/features.xml ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/main/features/features.xml b/osgi/karaf-features/src/main/features/features.xml index 691b93f..20c5ee3 100644 --- a/osgi/karaf-features/src/main/features/features.xml +++ b/osgi/karaf-features/src/main/features/features.xml @@ -1,23 +1,84 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2013 David Valeri. - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --> -<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="org-apache-tamaya"> - <feature name="configadmin" version="0.3-incubating"> - <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi_alpha/0.4-incubating-SNAPSHOT/jar</bundle> - <bundle>mvn:org.apache.tamaya.ext/tamaya-functions/0.3-incubating/jar</bundle> - <bundle>mvn:org.apache.tamaya.ext/tamaya-spisupport/0.3-incubating/jar</bundle> - <bundle>mvn:org.apache.tamaya/tamaya-api/0.3-incubating/jar</bundle> - <bundle>mvn:org.apache.tamaya/tamaya-core/0.3-incubating/jar</bundle> - <bundle>mvn:org.apache.geronimo.specs/geronimo-annotation_1.2_spec/1.0-alpha-1/jar</bundle> - </feature> +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. +--> +<features xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" name="org-apache-tamaya-all"> + <features name="org-apache-tamaya-config" version="0.4-incubating"> + <features name="org-apache-tamaya-configadmin" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi_alpha/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.tamaya.ext/tamaya-functions/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.tamaya.ext/tamaya-spisupport/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi-karaf_alpha/0.4-incubating/jar</bundle> + <features name="org-apache-tamaya-minimal" version="0.4-incubating"> + <feature name="org-apache-tamaya-api" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya/tamaya-api/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.geronimo.specs/geronimo-annotation_1.2_spec/1.0-alpha-1/jar</bundle> + </feature> + <feature name="org-apache-tamaya-core" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya/tamaya-core/0.4-incubating/jar</bundle> + </feature> + </features> + </features> + <features name="org-apache-tamaya-config-injection" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi-injection_alpha/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.tamaya.ext/tamaya-injection-api/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.tamaya.ext/tamaya-injection-se/0.4-incubating/jar</bundle> + </features> + <feature name="org-apache-tamaya-config-updater" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-events/0.4-incubating/jar</bundle> + <bundle>mvn:org.apache.tamaya.ext/tamaya-osgi-updater_alpha/0.4-incubating/jar</bundle> + </feature> + </features> + <features name="org-apache-tamaya-formats" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-formats/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-formats-json" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-formats-json/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-formats-yaml" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-formats-yaml/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-filter" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-filter/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-resources" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-resources/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-resolver" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-resolver/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-mutable-config" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-mutable-config/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-spring" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-spring/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-optional" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-optional/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-jndi" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-jndi/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-features" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-features/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-events" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-events/0.4-incubating/jar</bundle> + </features> + <features name="org-apache-tamaya-uom" version="0.4-incubating"> + <bundle>mvn:org.apache.tamaya.ext/tamaya-uom/0.4-incubating/jar</bundle> + </features> </features> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/Hello.java ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/Hello.java b/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/Hello.java deleted file mode 100644 index 0aef1ad..0000000 --- a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/Hello.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.apache.tamaya.osgi; - -/** - * Created by atsticks on 27.12.16. - */ -public interface Hello { - - String sayHello(); - -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/HelloImpl.java ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/HelloImpl.java b/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/HelloImpl.java deleted file mode 100644 index 98f5702..0000000 --- a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/HelloImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.apache.tamaya.osgi; - -import org.apache.tamaya.inject.api.Config; - -/** - * Created by atsticks on 27.12.16. - */ -public class HelloImpl implements Hello{ - - @Config("java.version") - private String javaVersion; - - @Override - public String sayHello() { - return "Hello: " + javaVersion; - } -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java b/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java deleted file mode 100644 index d8a2366..0000000 --- a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/InjectionKarafTest.java +++ /dev/null @@ -1,149 +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.apache.karaf.features.Feature; -import org.apache.karaf.features.FeaturesService; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -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.MavenUrlReference; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.osgi.framework.*; -import org.osgi.service.cm.ConfigurationAdmin; - -import javax.inject.Inject; - -import java.io.File; -import java.util.Dictionary; -import java.util.Hashtable; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertNotNull; -import static org.ops4j.pax.exam.CoreOptions.*; - -/** - * Created by atsticks on 10.12.16. - */ -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerMethod.class) -public class InjectionKarafTest { - - @Inject - private BundleContext bundleContext; - - @Inject - protected FeaturesService featuresService; - - @org.ops4j.pax.exam.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.4-incubating-SNAPSHOT"); - return options( - 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")), - // if activated, the remote karaf instance will stop and wait for - // debugger to connect to. -// KarafDistributionOption.debugConfiguration("5006", 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.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya", "tamaya-core", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-spisupport", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-functions", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-osgi", "0.4-incubating-SNAPSHOT"), - // injection libs - mavenBundle("org.apache.geronimo.specs", "geronimo-atinject_1.0_spec", "1.0"), - mavenBundle("org.apache.tamaya.ext", "tamaya-injection-api", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-injection", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-osgi-injection", "0.4-incubating-SNAPSHOT"), - KarafDistributionOption.features( - karafStandardRepo, "scr"), - KarafDistributionOption.features( - tamayaRepo, "tamaya-osgi-features/0.3.0.incubating-SNAPSHOT"), - 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"); - bundleContext.getService(bundleContext.getServiceReference(ConfigurationAdmin.class)); - } - - @Test - public void checkTamayaInjectionOnService() throws Exception { - Hashtable<String,String> config = new Hashtable<>(); - bundleContext.registerService(Hello.class, new ServiceFactory<Hello>() { - @Override - public Hello getService(Bundle bundle, ServiceRegistration<Hello> registration) { - return new HelloImpl(); - } - - @Override - public void ungetService(Bundle bundle, ServiceRegistration<Hello> registration, Hello service) { - } - }, - config); - ServiceReference<Hello> helloServiceRef = bundleContext.getServiceReference(Hello.class); - assertNotNull(helloServiceRef); - Hello hello = bundleContext.getService(helloServiceRef); - assertNotNull(hello); - assertEquals(hello.sayHello(), "Hello: "); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java b/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java deleted file mode 100644 index bbbf10c..0000000 --- a/osgi/karaf-features/src/test/java/org/apache/tamaya/osgi/OSGIKarafTest.java +++ /dev/null @@ -1,188 +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.apache.karaf.features.Feature; -import org.apache.karaf.features.FeaturesService; -import org.apache.tamaya.spi.ServiceContextManager; -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.PerClass; -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 java.io.IOException; -import java.net.URL; -import java.util.Enumeration; - -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; -import static org.ops4j.pax.exam.CoreOptions.*; - -@Ignore("20170123: deactivated temporarily in order to allow 0.3 release") -@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.4-incubating-SNAPSHOT"); - return options( -// 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")), -// // if activated, the remote karaf instance will stop and wait for -// // debugger to connect to. -//// KarafDistributionOption.debugConfiguration("5006", 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.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya", "tamaya-core", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-spisupport", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-functions", "0.4-incubating-SNAPSHOT"), - mavenBundle("org.apache.tamaya.ext", "tamaya-osgi", "0.4-incubating-SNAPSHOT"), -// KarafDistributionOption.features( -// karafStandardRepo, "scr"), -// KarafDistributionOption.features( -// tamayaRepo, "tamaya-osgi-features/0.3.0.incubating-SNAPSHOT"), - 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 - 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(null); - 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()); - } - - @Test - public void testResourceIsVisible(){ - assertNotNull(ServiceContextManager.getServiceContext() - .getResource("META-INF/javaconfiguration.properties", null)); - } - - @Test - public void testResourcesAreVisible() throws IOException { - Enumeration<URL> urls = ServiceContextManager.getServiceContext() - .getResources("META-INF/javaconfiguration.properties", null); - assertNotNull(urls); - assertTrue(urls.hasMoreElements()); - URL url = urls.nextElement(); - assertNotNull(url); - } - - public ConfigurationAdmin getConfigAdmin() { - return bundleContext.getService(bundleContext.getServiceReference(ConfigurationAdmin.class)); - } -} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/test/resources/META-INF/OSGIResource ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/resources/META-INF/OSGIResource b/osgi/karaf-features/src/test/resources/META-INF/OSGIResource deleted file mode 100644 index 20989a6..0000000 --- a/osgi/karaf-features/src/test/resources/META-INF/OSGIResource +++ /dev/null @@ -1,17 +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. -# \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/58336629/osgi/karaf-features/src/test/resources/META-INF/javaconfiguration.properties ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/resources/META-INF/javaconfiguration.properties b/osgi/karaf-features/src/test/resources/META-INF/javaconfiguration.properties deleted file mode 100644 index f2879a0..0000000 --- a/osgi/karaf-features/src/test/resources/META-INF/javaconfiguration.properties +++ /dev/null @@ -1,21 +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. -# -[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/58336629/osgi/karaf-features/src/test/resources/org.ops4j.pax.logging.cfg ---------------------------------------------------------------------- diff --git a/osgi/karaf-features/src/test/resources/org.ops4j.pax.logging.cfg b/osgi/karaf-features/src/test/resources/org.ops4j.pax.logging.cfg deleted file mode 100644 index 6683438..0000000 --- a/osgi/karaf-features/src/test/resources/org.ops4j.pax.logging.cfg +++ /dev/null @@ -1,48 +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. -# -#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/58336629/osgi/pom.xml ---------------------------------------------------------------------- diff --git a/osgi/pom.xml b/osgi/pom.xml index 838a9b8..ab3bf61 100644 --- a/osgi/pom.xml +++ b/osgi/pom.xml @@ -290,8 +290,8 @@ <module>common</module> <module>updater</module> <module>karaf-shell</module> + <module>karaf-features</module> <module>gogo-shell</module> - <!--<module>karaf-features</module>--> </modules> </project>
