You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/12/18 22:54:35 UTC

[1/2] incubator-tamaya-extensions git commit: Fixed OSGI support.

Repository: incubator-tamaya-extensions
Updated Branches:
  refs/heads/master 8b94067b6 -> 4a70f5309


Fixed OSGI support.


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/4a70f530
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/4a70f530
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/4a70f530

Branch: refs/heads/master
Commit: 4a70f5309b055646ed20f18ad6dcb47689655082
Parents: ad8dfd8
Author: anatole <an...@apache.org>
Authored: Sun Dec 18 23:51:55 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Sun Dec 18 23:54:31 2016 +0100

----------------------------------------------------------------------
 modules/injection/cdi-ee/pom.xml        | 30 +----------
 modules/injection/cdi-se/pom.xml        | 33 +-----------
 modules/injection/injection-api/pom.xml | 18 -------
 modules/pom.xml                         | 81 ----------------------------
 modules/spring/pom.xml                  | 28 ----------
 pom.xml                                 |  7 ++-
 6 files changed, 8 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/injection/cdi-ee/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection/cdi-ee/pom.xml b/modules/injection/cdi-ee/pom.xml
index 8e3e3d3..89f05f9 100644
--- a/modules/injection/cdi-ee/pom.xml
+++ b/modules/injection/cdi-ee/pom.xml
@@ -28,7 +28,7 @@ under the License.
 
     <artifactId>tamaya-cdi</artifactId>
     <name>Apache Tamaya Modules - Injection CDI</name>
-    <packaging>bundle</packaging>
+    <packaging>jar</packaging>
 
     <properties>
         <owb.version>1.6.2</owb.version>
@@ -43,34 +43,6 @@ under the License.
         <tomee.version>1.7.1</tomee.version>
     </properties>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>prepare-agent</id>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </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.cdi
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
     <dependencies>
         <dependency>
             <groupId>org.apache.tamaya.ext</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/injection/cdi-se/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection/cdi-se/pom.xml b/modules/injection/cdi-se/pom.xml
index 0f2e93a..712c57c 100644
--- a/modules/injection/cdi-se/pom.xml
+++ b/modules/injection/cdi-se/pom.xml
@@ -28,7 +28,7 @@ under the License.
 
     <artifactId>tamaya-cdi-se</artifactId>
     <name>Apache Tamaya Modules - Injection CDI (Direct)</name>
-    <packaging>bundle</packaging>
+    <packaging>jar</packaging>
 
     <properties>
         <owb.version>1.6.2</owb.version>
@@ -40,37 +40,6 @@ under the License.
         <ds.version>1.1.0</ds.version>
     </properties>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>prepare-agent</id>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </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.cdi.config
-                        </Export-Package>
-                        <Private-Package>
-                            org.apache.tamaya.integration.cdi.internal
-                        </Private-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
     <dependencies>
         <dependency>
             <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/injection/injection-api/pom.xml
----------------------------------------------------------------------
diff --git a/modules/injection/injection-api/pom.xml b/modules/injection/injection-api/pom.xml
index bb7624e..47aaeca 100644
--- a/modules/injection/injection-api/pom.xml
+++ b/modules/injection/injection-api/pom.xml
@@ -60,22 +60,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.inject.api,
-                            org.apache.tamaya.inject.spi
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/pom.xml
----------------------------------------------------------------------
diff --git a/modules/pom.xml b/modules/pom.xml
index b6301d0..a8b3bb3 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -46,85 +46,4 @@ under the License.
         <module>spring</module>
     </modules>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <logViolationsToConsole>true</logViolationsToConsole>
-                    <configLocation>checkstyle/style.xml</configLocation>
-                </configuration>
-
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.tamaya</groupId>
-                        <artifactId>buildconfigurations</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-enforcer-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>enforce-versions</id>
-                        <goals>
-                            <goal>enforce</goal>
-                        </goals>
-                        <configuration>
-                            <rules>
-                                <requireJavaVersion>
-                                    <version>[1.7,)</version>
-                                </requireJavaVersion>
-                            </rules>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>findbugs-maven-plugin</artifactId>
-                <configuration>
-                    <failOnError>false</failOnError>
-                    <excludeFilterFile>findbugs/findbugs-exclude.xml</excludeFilterFile>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>org.apache.tamaya</groupId>
-                        <artifactId>buildconfigurations</artifactId>
-                        <version>${project.version}</version>
-                    </dependency>
-                </dependencies>
-            </plugin>
-            <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>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.5</version>
-                <configuration>
-                    <archive>
-                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
-                    </archive>
-                </configuration>
-            </plugin>
-
-        </plugins>
-    </build>
-
-
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index 568a9b8..e3f4ed0 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -36,34 +36,6 @@ under the License.
         <spring.boot.version>1.2.6.RELEASE</spring.boot.version>
     </properties>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.jacoco</groupId>
-                <artifactId>jacoco-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>prepare-agent</id>
-                        <goals>
-                            <goal>prepare-agent</goal>
-                        </goals>
-                    </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.spring
-                        </Export-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
     <dependencies>
         <dependency>
             <groupId>junit</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4a70f530/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7258a77..55cccbb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -500,6 +500,7 @@ under the License.
                     <artifactId>maven-jar-plugin</artifactId>
                     <configuration>
                         <archive>
+                            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                             <addMavenDescriptor>false</addMavenDescriptor>
                             <manifestEntries>
                                 <Specification-Title>Apache ${project.name}</Specification-Title>
@@ -614,7 +615,6 @@ under the License.
             </plugins>
         </pluginManagement>
 
-
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -653,6 +653,7 @@ under the License.
                     </execution>
                 </executions>
             </plugin>
+
             <plugin>
                 <artifactId>maven-resources-plugin</artifactId>
                 <executions>
@@ -691,6 +692,9 @@ under the License.
                                 <requireMavenVersion>
                                     <version>3.0.5</version>
                                 </requireMavenVersion>
+                                <requireJavaVersion>
+                                    <version>[1.7,)</version>
+                                </requireJavaVersion>
                             </rules>
                         </configuration>
                     </execution>
@@ -942,6 +946,7 @@ under the License.
             <plugin>
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
+                <version>${rat.version}</version>
             </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>


[2/2] incubator-tamaya-extensions git commit: Added tests for mutable config.

Posted by an...@apache.org.
Added tests for mutable config.


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/ad8dfd8a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/ad8dfd8a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/ad8dfd8a

Branch: refs/heads/master
Commit: ad8dfd8aaa9e502dc4d8efd2fd5229bf4f7b9562
Parents: 8b94067
Author: anatole <an...@apache.org>
Authored: Sun Dec 18 14:12:05 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Sun Dec 18 23:54:31 2016 +0100

----------------------------------------------------------------------
 .../LazyRefreshablePropertySourceTest.java      | 162 +++++++++++++++++++
 .../src/test/resources/test.properties          |  21 +++
 .../src/test/resources/test2.properties         |  21 +++
 3 files changed, 204 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/ad8dfd8a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/propertysources/LazyRefreshablePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/propertysources/LazyRefreshablePropertySourceTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/propertysources/LazyRefreshablePropertySourceTest.java
new file mode 100644
index 0000000..e67ca59
--- /dev/null
+++ b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/propertysources/LazyRefreshablePropertySourceTest.java
@@ -0,0 +1,162 @@
+/*
+ * 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.mutableconfig.propertysources;
+
+import org.apache.tamaya.functions.Supplier;
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spisupport.SimplePropertySource;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link LazyRefreshablePropertySource}. Created by atsticks on 11.11.16.
+ */
+public class LazyRefreshablePropertySourceTest {
+
+    private SimplePropertySource simplePropertySource = new SimplePropertySource(
+        getClass().getClassLoader().getResource("test.properties")
+    );
+    private SimplePropertySource simplePropertySource2 = new SimplePropertySource(
+            getClass().getClassLoader().getResource("test2.properties")
+    );
+    private volatile boolean selectFirst;
+
+    @Test
+    public void of() throws Exception {
+        assertNotNull(LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }
+        ));
+    }
+
+    @Test
+    public void of_WithDefaultOrdinal() throws Exception {
+        assertNotNull(LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }, 100
+        ));
+    }
+
+    @Test
+    public void get() throws Exception {
+        LazyRefreshablePropertySource ps = LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }
+        );
+        assertEquals(ps.get("test1").getValue(), "test1");
+        assertEquals(ps.get("test2").getValue(), "test2");
+        assertNull(ps.get("test3"));
+    }
+
+    @Test
+    public void getName() throws Exception {
+        LazyRefreshablePropertySource ps = LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }
+        );
+        assertEquals(ps.getName(), simplePropertySource.getName());
+    }
+
+    @Test
+    public void getProperties() throws Exception {
+        LazyRefreshablePropertySource ps = LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }
+        );
+        assertEquals(ps.getProperties(), simplePropertySource.getProperties());
+    }
+
+    @Test
+    public void refresh() throws Exception {
+        LazyRefreshablePropertySource ps1 = LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        try {
+                            if (selectFirst) {
+                                return simplePropertySource;
+                            } else {
+                                return simplePropertySource2;
+                            }
+                        }finally{
+                            selectFirst = !selectFirst;
+                        }
+                    }
+                }
+        );
+        // Simulate a refresh with the switching provider created above...
+        ps1.setUpdateInterval(1L);
+        if(ps1.get("test3")!=null){
+            Thread.sleep(5L); //  NOSONAR
+            assertEquals("test4", ps1.get("test4").getValue());
+        }else{
+            Thread.sleep(5L); //  NOSONAR
+            assertNull("test3", ps1.get("test3"));
+        }
+    }
+
+    @Test
+    public void testEqualsAndHashCode() throws Exception {
+        LazyRefreshablePropertySource ps1 = LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }
+        );
+        LazyRefreshablePropertySource ps2 = LazyRefreshablePropertySource.of(
+                new Supplier<PropertySource>() {
+                    @Override
+                    public PropertySource get() {
+                        return simplePropertySource;
+                    }
+                }
+        );
+        assertEquals(ps1, ps2);
+        assertEquals(ps1.hashCode(), ps2.hashCode());
+    }
+
+    @Test
+    public void testToString() throws Exception {
+
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/ad8dfd8a/modules/mutable-config/src/test/resources/test.properties
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/resources/test.properties b/modules/mutable-config/src/test/resources/test.properties
new file mode 100644
index 0000000..da1cb4a
--- /dev/null
+++ b/modules/mutable-config/src/test/resources/test.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.
+#
+test1=test1
+test2=test2
+test4=test4
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/ad8dfd8a/modules/mutable-config/src/test/resources/test2.properties
----------------------------------------------------------------------
diff --git a/modules/mutable-config/src/test/resources/test2.properties b/modules/mutable-config/src/test/resources/test2.properties
new file mode 100644
index 0000000..d08e4e2
--- /dev/null
+++ b/modules/mutable-config/src/test/resources/test2.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.
+#
+test1=test1
+test2=test2
+test5=test3
\ No newline at end of file