You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/16 22:03:16 UTC
[06/50] [abbrv] incubator-tamaya-extensions git commit: TAMAYA-148
Removed existing tests,
to be replaced by pax-exam. Added a karaf integration layer to generate an
aggregate features.xml
TAMAYA-148 Removed existing tests, to be replaced by pax-exam. Added a karaf integration layer to generate an aggregate features.xml
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/f1ea1580
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/f1ea1580
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/f1ea1580
Branch: refs/heads/master
Commit: f1ea15806458083d5802306706a198e9aa78f7ac
Parents: 5e1733c
Author: John D. Ament <jo...@apache.org>
Authored: Sat Apr 30 07:30:14 2016 -0400
Committer: John D. Ament <jo...@apache.org>
Committed: Sat Apr 30 07:30:14 2016 -0400
----------------------------------------------------------------------
classloader-support/pom.xml | 2 +-
injection-api/pom.xml | 1 +
integration/camel/pom.xml | 2 +-
integration/karaf/pom.xml | 274 +++++++++++++++++++
integration/osgi/pom.xml | 69 +----
.../integration/osgi/OSGIConfigRootMapper.java | 1 -
.../osgi/OSGIEnhancedConfiguration.java | 3 -
.../integration/osgi/TamayaConfigAdminImpl.java | 64 +++--
.../osgi/TamayaConfigurationImpl.java | 4 +-
.../integration/osgi/test/HelloService.java | 35 ---
.../osgi/test/TestConfigIntegration.java | 257 -----------------
integration/pom.xml | 1 +
12 files changed, 317 insertions(+), 396 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/classloader-support/pom.xml
----------------------------------------------------------------------
diff --git a/classloader-support/pom.xml b/classloader-support/pom.xml
index 1d27df4..adea1d3 100644
--- a/classloader-support/pom.xml
+++ b/classloader-support/pom.xml
@@ -1,4 +1,4 @@
-<!--
+<!--
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
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/injection-api/pom.xml
----------------------------------------------------------------------
diff --git a/injection-api/pom.xml b/injection-api/pom.xml
index a2122ad..1eb11b8 100644
--- a/injection-api/pom.xml
+++ b/injection-api/pom.xml
@@ -54,6 +54,7 @@ under the License.
<artifactId>geronimo-jcdi_1.1_spec</artifactId>
<version>${geronimo-jcdi-1.1-spec.version}</version>
<scope>provided</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/camel/pom.xml
----------------------------------------------------------------------
diff --git a/integration/camel/pom.xml b/integration/camel/pom.xml
index 07adc0b..b91ba8d 100644
--- a/integration/camel/pom.xml
+++ b/integration/camel/pom.xml
@@ -30,7 +30,7 @@ under the License.
<packaging>bundle</packaging>
<properties>
- <camel.version>2.16.0</camel.version>
+ <camel.version>2.17.0</camel.version>
</properties>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/integration/karaf/pom.xml b/integration/karaf/pom.xml
new file mode 100644
index 0000000..b03f687
--- /dev/null
+++ b/integration/karaf/pom.xml
@@ -0,0 +1,274 @@
+<!--
+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 current the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>tamaya-integration</artifactId>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <name>Apache Tamaya Integration - Karaf Features</name>
+ <artifactId>tamaya-karaf</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-api</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-core</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-builder</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-classloader-support</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-collections</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-events</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-filter</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-formats</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-functions</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-injection</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-injection-api</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-json</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-management</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-model</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-mutable-config</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-optional</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-resolver</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-resources</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spisupport</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-camel</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spisupport</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-yaml</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-cdi</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-cdi-se</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-consul</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-etcd</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-osgi</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spring</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tamaya.ext</groupId>
+ <artifactId>tamaya-spring</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <configuration>
+ <aggregateFeatures>true</aggregateFeatures>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/pom.xml
----------------------------------------------------------------------
diff --git a/integration/osgi/pom.xml b/integration/osgi/pom.xml
index 3fa6516..e57f395 100644
--- a/integration/osgi/pom.xml
+++ b/integration/osgi/pom.xml
@@ -33,7 +33,6 @@
<description>Tamaya Based OSGI Implementation of ConfigAdmin and Config Injection</description>
<properties>
- <osgi.compendium.version>5.0.0</osgi.compendium.version>
<felix.plugin.version>2.5.4</felix.plugin.version>
</properties>
@@ -66,13 +65,13 @@
<version>1.8.8</version>
</dependency>
<dependency>
- <groupId>org.apache.tamaya</groupId>
- <artifactId>tamaya-api</artifactId>
- <version>${project.version}</version>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>6.0.0</version>
</dependency>
<dependency>
- <groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-spisupport</artifactId>
+ <groupId>org.apache.tamaya</groupId>
+ <artifactId>tamaya-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -82,75 +81,19 @@
</dependency>
<dependency>
<groupId>org.apache.tamaya.ext</groupId>
- <artifactId>tamaya-injection-api</artifactId>
+ <artifactId>tamaya-spisupport</artifactId>
<version>${project.version}</version>
</dependency>
- <!-- transitive deps of 'tamaya-injection-api', here so maven can load them before tests try to resolve them
- from local repo. -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.2_spec</artifactId>
- <version>1.0-alpha-1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <version>1.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.1_spec</artifactId>
- <version>1.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-el_2.2_spec</artifactId>
- <version>1.0.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.1_spec</artifactId>
- <version>1.0</version>
- <scope>test</scope>
- </dependency>
- <!-- end of transitive deps of 'tamaya-injection-api' -->
<dependency>
<groupId>org.apache.tamaya.ext</groupId>
<artifactId>tamaya-injection</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.framework</artifactId>
- <version>5.4.0</version>
- </dependency>
- <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>java-hamcrest</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-bom</artifactId>
- <version>1.1.10.Final</version>
- <type>pom</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-container-felix-embedded</artifactId>
- <version>2.1.0.CR18</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIConfigRootMapper.java
----------------------------------------------------------------------
diff --git a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIConfigRootMapper.java b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIConfigRootMapper.java
index 912eeae..836df8b 100644
--- a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIConfigRootMapper.java
+++ b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIConfigRootMapper.java
@@ -21,7 +21,6 @@ package org.apache.tamaya.integration.osgi;
/**
* Mapping function for mapping Tamaya configuration sections to OSGI pids.
*/
-// @FunctionalInterface
public interface OSGIConfigRootMapper {
/**
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIEnhancedConfiguration.java
----------------------------------------------------------------------
diff --git a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIEnhancedConfiguration.java b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIEnhancedConfiguration.java
index c94f1f7..5e813af 100644
--- a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIEnhancedConfiguration.java
+++ b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/OSGIEnhancedConfiguration.java
@@ -18,8 +18,6 @@
*/
package org.apache.tamaya.integration.osgi;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.ConfigurationContext;
import org.apache.tamaya.spi.PropertySource;
import org.apache.tamaya.spisupport.BasePropertySource;
import org.apache.tamaya.spisupport.DefaultConfiguration;
@@ -60,7 +58,6 @@ public class OSGIEnhancedConfiguration extends DefaultConfiguration{
* Configuration wrapped into a Tamaya PropertySource.
*/
private static final class OSGIConfigurationContext extends DefaultConfigurationContext{
- private ConfigurationContext tamayaContext = ConfigurationProvider.getConfiguration().getContext();
private OSGIPropertySource osgiPropertySource;
public OSGIConfigurationContext(org.osgi.service.cm.Configuration osgiConfiguration){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigAdminImpl.java
----------------------------------------------------------------------
diff --git a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigAdminImpl.java b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigAdminImpl.java
index a48d3af..7bf4da7 100644
--- a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigAdminImpl.java
+++ b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigAdminImpl.java
@@ -55,40 +55,10 @@ public class TamayaConfigAdminImpl implements ConfigurationAdmin {
private OSGIConfigRootMapper configRootMapper;
/**
- * Loads the configuration toor mapper using the OSGIConfigRootMapper OSGI service resolving mechanism. If no
- * such service is available it loads the default mapper.
- * @return the mapper to be used, bever null.
- */
- protected OSGIConfigRootMapper loadConfigRootMapper() {
- OSGIConfigRootMapper mapper = null;
- ServiceReference<OSGIConfigRootMapper> ref = context.getServiceReference(OSGIConfigRootMapper.class);
- if(ref!=null){
- mapper = context.getService(ref);
- }
- if(mapper==null){
- mapper = new OSGIConfigRootMapper() {
- @Override
- public String getTamayaConfigRoot(String pid, String factoryPid) {
- if(pid!=null) {
- return "[bundle:" + pid +']';
- } else{
- return "[bundle:" + factoryPid +']';
- }
- }
- @Override
- public String toString(){
- return "Default OSGIConfigRootMapper(pid -> [bundle:pid], factoryPid -> [bundle:factoryPid]";
- }
- };
- }
- return mapper;
- }
-
- /**
* Create a new config.
* @param context the OSGI context
*/
- public TamayaConfigAdminImpl(BundleContext context) {
+ TamayaConfigAdminImpl(BundleContext context) {
this.context = context;
this.configRootMapper = loadConfigRootMapper();
ServiceReference<ConfigurationAdmin> ref = context.getServiceReference(ConfigurationAdmin.class);
@@ -154,8 +124,6 @@ public class TamayaConfigAdminImpl implements ConfigurationAdmin {
}
};
factoryTracker.open();
-
-
}
@Override
@@ -195,4 +163,34 @@ public class TamayaConfigAdminImpl implements ConfigurationAdmin {
return result.isEmpty() ? null : result.toArray(new Configuration[configs.size()]);
}
+ /**
+ * Loads the configuration toor mapper using the OSGIConfigRootMapper OSGI service resolving mechanism. If no
+ * such service is available it loads the default mapper.
+ * @return the mapper to be used, bever null.
+ */
+ private OSGIConfigRootMapper loadConfigRootMapper() {
+ OSGIConfigRootMapper mapper = null;
+ ServiceReference<OSGIConfigRootMapper> ref = context.getServiceReference(OSGIConfigRootMapper.class);
+ if(ref!=null){
+ mapper = context.getService(ref);
+ }
+ if(mapper==null){
+ mapper = new OSGIConfigRootMapper() {
+ @Override
+ public String getTamayaConfigRoot(String pid, String factoryPid) {
+ if(pid!=null) {
+ return "[bundle:" + pid +']';
+ } else{
+ return "[bundle:" + factoryPid +']';
+ }
+ }
+ @Override
+ public String toString(){
+ return "Default OSGIConfigRootMapper(pid -> [bundle:pid], factoryPid -> [bundle:factoryPid]";
+ }
+ };
+ }
+ return mapper;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigurationImpl.java b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigurationImpl.java
index 57c1258..c7b0864 100644
--- a/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigurationImpl.java
+++ b/integration/osgi/src/main/java/org/apache/tamaya/integration/osgi/TamayaConfigurationImpl.java
@@ -46,8 +46,8 @@ public class TamayaConfigurationImpl implements Configuration {
* @param configRootMapper the mapper that maps the pids to a tamaya root section.
* @param parent the (optional delegating parent, used as default).
*/
- public TamayaConfigurationImpl(String confPid, String factoryPid, OSGIConfigRootMapper configRootMapper,
- ConfigurationAdmin parent) {
+ TamayaConfigurationImpl(String confPid, String factoryPid, OSGIConfigRootMapper configRootMapper,
+ ConfigurationAdmin parent) {
this.pid = confPid;
this.factoryPid = factoryPid;
if(parent!=null){
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/HelloService.java
----------------------------------------------------------------------
diff --git a/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/HelloService.java b/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/HelloService.java
deleted file mode 100644
index 06a420f..0000000
--- a/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/HelloService.java
+++ /dev/null
@@ -1,35 +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.integration.osgi.test;
-
-import org.apache.tamaya.inject.api.Config;
-
-/**
- * Simple service to test injection in OSGI.
- */
-public class HelloService {
-
- @Config(value = "example.message", defaultValue = "A Tamaya default.")
- private String message;
-
- public String sayHello() {
- System.err.println("HELLO: " + message);
- return message;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/TestConfigIntegration.java
----------------------------------------------------------------------
diff --git a/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/TestConfigIntegration.java b/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/TestConfigIntegration.java
deleted file mode 100644
index 931d0ee..0000000
--- a/integration/osgi/src/test/java/org/apache/tamaya/integration/osgi/test/TestConfigIntegration.java
+++ /dev/null
@@ -1,257 +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.integration.osgi.test;
-
-import org.apache.log4j.Priority;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.integration.osgi.Activator;
-import org.apache.tamaya.integration.osgi.OSGIConfigRootMapper;
-import org.apache.tamaya.integration.osgi.TamayaConfigAdminImpl;
-import org.apache.tamaya.integration.osgi.TamayaConfigurationImpl;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.container.test.api.OperateOnDeployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.arquillian.test.api.ArquillianResource;
-import org.jboss.osgi.metadata.OSGiManifestBuilder;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.Asset;
-import org.jboss.shrinkwrap.api.importer.ZipImporter;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.resolver.api.maven.Maven;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-@RunWith(Arquillian.class)
-@Ignore
-public class TestConfigIntegration {
-
- private static final String TAMAYA_VERSION = "0.3-incubating-SNAPSHOT";
- private static final String DEFAULT = "default";
-
- static {
- System.setProperty("[bundle:tamaya]systemTestKey", "foo");
- System.setProperty("org.osgi.framework.bootdelegation",
- "org.apache.tamaya,org.apache.tamaya.integration.osgi,org.apache.tamaya.integration.osgi.test");
- }
-
- @ArquillianResource
- BundleContext context;
-
- //////////////////////////////////////////////////////// Test setup //////////////////////////////////
-
- @Deployment(name = "felix.main", order = 1)
- public static JavaArchive deployMain() {
- return ShrinkWrap.create(ZipImporter.class, "felix.main-5.4.0.jar")
- .importFrom(getBundleFile("org.apache.felix:org.apache.felix.main:5.4.0"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "osgi.config", order = 1)
- public static JavaArchive deployOSGIConfig() {
- return ShrinkWrap.create(ZipImporter.class, "felix.configadmin-1.8.8.jar")
- .importFrom(getBundleFile("org.apache.felix:org.apache.felix.configadmin:1.8.8"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "javax.annotation", order = 4)
- public static JavaArchive deployJavaxAnnotation() {
- return ShrinkWrap.create(ZipImporter.class, "javax.annotation.jar")
- .importFrom(getBundleFile("org.apache.geronimo.specs:geronimo-annotation_1.2_spec:1.0-alpha-1"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "tamaya-api", order = 5)
- public static JavaArchive deployTamayaAPI() {
- return ShrinkWrap.create(ZipImporter.class, "tamaya-api.jar")
- .importFrom(getBundleFile("org.apache.tamaya:tamaya-api:" + TAMAYA_VERSION))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "tamaya-core", order = 6)
- public static JavaArchive deployTamayaCore() {
- return ShrinkWrap.create(ZipImporter.class, "tamaya-core.jar")
- .importFrom(getBundleFile("org.apache.tamaya:tamaya-core:" + TAMAYA_VERSION))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "tamaya-functions", order = 7)
- public static JavaArchive deployTamayaFunctions() {
- return ShrinkWrap.create(ZipImporter.class, "tamaya-functions.jar")
- .importFrom(getBundleFile("org.apache.tamaya.ext:tamaya-functions:" + TAMAYA_VERSION))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "java.atInject", order = 8)
- public static JavaArchive deployAtInject() {
- return ShrinkWrap.create(ZipImporter.class, "java.atinject.jar")
- .importFrom(getBundleFile("org.apache.geronimo.specs:geronimo-atinject_1.0_spec:1.0"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "javax.el", order = 9)
- public static JavaArchive deployEL() {
- return ShrinkWrap.create(ZipImporter.class, "javax.el.jar")
- .importFrom(getBundleFile("org.apache.geronimo.specs:geronimo-el_2.2_spec:1.0.4"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "javax.interceptor", order = 9)
- public static JavaArchive deployInterceptor() {
- return ShrinkWrap.create(ZipImporter.class, "javax.interceptor.jar")
- .importFrom(getBundleFile("org.apache.geronimo.specs:geronimo-interceptor_1.1_spec:1.0"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "javax.inject", order = 10)
- public static JavaArchive deployCDISpec() {
- return ShrinkWrap.create(ZipImporter.class, "javax.inject.jar")
- .importFrom(getBundleFile("org.apache.geronimo.specs:geronimo-jcdi_1.1_spec:1.0"))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "tamaya-injection-api", order = 11)
- public static JavaArchive deployTamayaInjectionAPI() {
- return ShrinkWrap.create(ZipImporter.class, "tamaya-injection-api.jar")
- .importFrom(getBundleFile("org.apache.tamaya.ext:tamaya-injection-api:" + TAMAYA_VERSION))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "tamaya-events", order = 14)
- public static JavaArchive deployTamayaEvents() {
- return ShrinkWrap.create(ZipImporter.class, "tamaya-events.jar")
- .importFrom(getBundleFile("org.apache.tamaya.ext:tamaya-events:" + TAMAYA_VERSION))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = "tamaya-injection", order = 6)
- public static JavaArchive deployTamayaInjectionSE() {
- return ShrinkWrap.create(ZipImporter.class, "tamaya-injection.jar")
- .importFrom(getBundleFile("org.apache.tamaya.ext:tamaya-injection:" + TAMAYA_VERSION))
- .as(JavaArchive.class);
- }
-
- @Deployment(name = DEFAULT, order = 100)
- public static JavaArchive createdeployment() {
- final String archiveName = "tamaya-osgi-general.jar";
- URL config = ClassLoader.getSystemClassLoader().getResource("META-INF/javaconfiguration.properties");
- return ShrinkWrap.create(JavaArchive.class, archiveName)
- .setManifest(new Asset() {
- public InputStream openStream() {
- return OSGiManifestBuilder.newInstance()
- .addBundleSymbolicName(archiveName)
- .addBundleManifestVersion(2)
- .addExportPackages("org.apache.tamaya.integration.osgi",
- "org.apache.tamaya.integration.osgi.test")
- .addImportPackages("org.junit", "org.osgi.service.cm",
- "org.apache.tamaya", "org.apache.tamaya.functions","org.apache.tamaya.inject",
- "org.apache.tamaya.spi","org.apache.tamaya.spi", "org.osgi.framework",
- "org.osgi.util.tracker")
- .addBundleActivator(Activator.class)
- .openStream();
- }
- })
- .addClasses(Test.class, TestConfigIntegration.class, Priority.class, Activator.class,
- TamayaConfigAdminImpl.class, TamayaConfigurationImpl.class, OSGIConfigRootMapper.class,
- HelloService.class)
- .addAsResource(config, "META-INF/javaconfiguration.properties");
- }
-
- @Before
- public void startBundles() {
- for (Bundle bundle : context.getBundles()) {
- try {
- bundle.start();
- } catch (BundleException e) {
- e.printStackTrace();
- }
- }
- }
-
-
- @Test
- @OperateOnDeployment(DEFAULT)
- public void testTamayaAvailable() throws Exception {
- assertNotNull(ConfigurationProvider.getConfiguration());
- }
-
- @Test
- @OperateOnDeployment(DEFAULT)
- public void testTamayaConfigAdminAvailable() throws Exception {
- ServiceReference<ConfigurationAdmin> ref = context.getServiceReference(ConfigurationAdmin.class);
- assertNotNull("OSGI ConfigAdmin not loaded.", ref);
- ConfigurationAdmin osgiConfig = context.getService(ref);
- assertNotNull("No config available from Tamaya through OSGI ConfigAdmin.", osgiConfig);
- assertEquals("Override of OSGI ConfigAdmin with Tamaya did not work.", osgiConfig.getClass().getName(), TamayaConfigAdminImpl.class.getName());
- }
-
- @Test
- @OperateOnDeployment(DEFAULT)
- public void testLoadTamayaConfigFromConfigAdmin() throws Exception {
- ServiceReference<ConfigurationAdmin> ref = context.getServiceReference(ConfigurationAdmin.class);
- assertNotNull("OSGI ConfigAdmin not loaded.", ref);
- ConfigurationAdmin admin = context.getService(ref);
- Configuration osgiConfig = admin.getConfiguration("tamaya");
- assertNotNull("No config available from Tamaya through OSGI ConfigAdmin.", osgiConfig);
- Dictionary<String, Object> config = osgiConfig.getProperties();
- assertNotNull("No config entries loaded from Tamaya.", config);
- assertEquals("Property 'testKey' not loaded from Tamaya.", "foo", config.get("systemTestKey"));
- // TODO: Think on Resource loading in OSGI:
- // this should work with normal resource loading but does not work with OSGI, since this resource is not
- // visible by default, when we have added resource loading as abstraction to the ServiceContext, too.
- // Reason: Resource Loading in OSGI works differently!
-// assertEquals("Property 'testKey' not loaded from Tamaya.", "success!", config.get("my.testProperty"));
- }
-
- @Test
- @OperateOnDeployment(DEFAULT)
- public void testInjection() throws Exception {
- Dictionary<String, Object> config = new Hashtable<>();
- ServiceRegistration<HelloService> reg = context.registerService(HelloService.class, new HelloService(), config);
- ServiceReference<HelloService> serviceReference = reg.getReference();
- assertNotNull(serviceReference);
- HelloService helloServ = context.getService(serviceReference);
- assertNotNull("HelloService not referenceable.", helloServ);
- assertEquals("A Tamaya default.", helloServ.sayHello());
- }
-
- private static File getBundleFile(String artifactId) {
- return Maven.configureResolver()
- .withMavenCentralRepo(true)
- .withClassPathResolution(true)
- .resolve(artifactId).withoutTransitivity().asSingleFile();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/f1ea1580/integration/pom.xml
----------------------------------------------------------------------
diff --git a/integration/pom.xml b/integration/pom.xml
index df4775d..edfa709 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -38,6 +38,7 @@ under the License.
<module>camel</module>
<module>etcd</module>
<module>consul</module>
+ <module>karaf</module>
</modules>
</project>
\ No newline at end of file