This is an automated email from the ASF dual-hosted git repository.
pottlinger pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-tamaya-extensions.git
The following commit(s) were added to refs/heads/master by this push:
new 52ea1d6 TAMAYA-291: Increase code coverage for etcd module
new 2c11fb7 Merge pull request #33 from acoburn/etcd_code_coverage
52ea1d6 is described below
commit 52ea1d60716e7d225892bb4e959dadc86771dbfa
Author: Aaron Coburn <[email protected]>
AuthorDate: Thu Feb 28 10:04:51 2019 -0500
TAMAYA-291: Increase code coverage for etcd module
---
modules/etcd/pom.xml | 13 -----
.../apache/tamaya/etcd/EtcdBackendConfigTest.java | 60 ++++++++++++++++++++++
.../apache/tamaya/etcd/EtcdPropertySourceTest.java | 13 +++++
3 files changed, 73 insertions(+), 13 deletions(-)
diff --git a/modules/etcd/pom.xml b/modules/etcd/pom.xml
index c3fb234..28c805e 100644
--- a/modules/etcd/pom.xml
+++ b/modules/etcd/pom.xml
@@ -76,17 +76,4 @@ under the License.
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.pitest</groupId>
- <artifactId>pitest-maven</artifactId>
- <configuration>
- <mutationThreshold>7</mutationThreshold>
- <verbose>true</verbose>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</project>
diff --git
a/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdBackendConfigTest.java
b/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdBackendConfigTest.java
new file mode 100644
index 0000000..f28aee6
--- /dev/null
+++
b/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdBackendConfigTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.etcd;
+
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class EtcdBackendConfigTest {
+
+ @Test
+ public void testEtcdDirectoryProperty() throws Exception {
+ final String directory = "./target/etcd-data";
+ try {
+ System.setProperty("tamaya.etcd.directory", directory);
+
assertThat(EtcdBackendConfig.getEtcdDirectory()).isEqualTo(directory);
+ } finally {
+ System.clearProperty("tamaya.etcd.directory");
+ }
+ }
+
+ @Test
+ public void testEtcdTimeoutProperty() throws Exception {
+ try {
+ assertThat(EtcdBackendConfig.getEtcdTimeout()).isEqualTo(2000L);
+ System.setProperty("tamaya.etcd.timeout", "5");
+ assertThat(EtcdBackendConfig.getEtcdTimeout()).isEqualTo(5000L);
+ } finally {
+ System.clearProperty("tamaya.etcd.timeout");
+ }
+ }
+
+ @Test
+ public void testEtcdServerProperty() throws Exception {
+ final String server = "http://localhost:4001";
+ try {
+
assertThat(EtcdBackendConfig.getServers()).contains("http://127.0.0.1:4001");
+ System.setProperty("tamaya.etcd.server", server);
+ assertThat(EtcdBackendConfig.getServers()).contains(server);
+ } finally {
+ System.clearProperty("tamaya.etcd.server");
+ }
+ }
+}
diff --git
a/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdPropertySourceTest.java
b/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdPropertySourceTest.java
index c219f7e..1ec1ce7 100644
---
a/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdPropertySourceTest.java
+++
b/modules/etcd/src/test/java/org/apache/tamaya/etcd/EtcdPropertySourceTest.java
@@ -24,6 +24,7 @@ import org.junit.Test;
import java.util.Map;
+import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
/**
@@ -71,4 +72,16 @@ public class EtcdPropertySourceTest {
public void testIsScannable() throws Exception {
assertThat(propertySource.isScannable()).isTrue();
}
+
+ @Test
+ public void testPropertySourceConstructorParams() throws Exception {
+ EtcdPropertySource propertySource = new
EtcdPropertySource("http://8.8.8.8:4001", "http://192.168.99.105:4001");
+ assertThat(propertySource.getProperties()).isNotNull();
+ }
+
+ @Test
+ public void testPropertySourceConstructorList() throws Exception {
+ EtcdPropertySource propertySource = new
EtcdPropertySource(asList("http://8.8.8.8:4001", "http://192.168.99.105:4001"));
+ assertThat(propertySource.getProperties()).isNotNull();
+ }
}