You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2020/12/11 00:49:33 UTC
[cxf] 01/01: Update to MicroProfile 2.0.0-RC3
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch update.mp.2.0.0-RC3
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 48fc1e3225b3e54375e1f6fe2e841ae7a264b148
Author: reta <dr...@gmail.com>
AuthorDate: Thu Dec 10 16:38:15 2020 -0500
Update to MicroProfile 2.0.0-RC3
---
parent/pom.xml | 6 +-
.../cxf/microprofile/client/mock/MockConfig.java | 95 ++++++++++++++++++++++
.../client/mock/MockConfigProviderResolver.java | 48 +----------
.../microprofile/rest/client/MockConfig.java | 95 ++++++++++++++++++++++
.../rest/client/MockConfigProviderResolver.java | 46 +----------
5 files changed, 200 insertions(+), 90 deletions(-)
diff --git a/parent/pom.xml b/parent/pom.xml
index 366a4ff..8ea2187 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -164,9 +164,9 @@
<cxf.lucene.version>8.2.0</cxf.lucene.version>
<cxf.maven.core.version>3.6.3</cxf.maven.core.version>
<cxf.micrometer.version>1.6.1</cxf.micrometer.version>
- <cxf.microprofile.config.version>1.2</cxf.microprofile.config.version>
- <cxf.microprofile.rest.client.version>2.0-RC2</cxf.microprofile.rest.client.version>
- <cxf.microprofile.openapi.version>1.1.2</cxf.microprofile.openapi.version>
+ <cxf.microprofile.config.version>2.0</cxf.microprofile.config.version>
+ <cxf.microprofile.rest.client.version>2.0-RC3</cxf.microprofile.rest.client.version>
+ <cxf.microprofile.openapi.version>2.0-RC3</cxf.microprofile.openapi.version>
<cxf.mina.version>2.1.3</cxf.mina.version>
<cxf.mockito.version>3.4.6</cxf.mockito.version>
<cxf.msv.version>2013.6.1</cxf.msv.version>
diff --git a/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfig.java b/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfig.java
new file mode 100644
index 0000000..c34074a
--- /dev/null
+++ b/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfig.java
@@ -0,0 +1,95 @@
+/**
+ * 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.cxf.microprofile.client.mock;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigValue;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.Converter;
+
+public class MockConfig implements Config {
+ private final Map<String, String> configValues;
+
+ public MockConfig(Map<String, String> configValues) {
+ this.configValues = configValues;
+ }
+
+ @Override
+ public <T> T getValue(String propertyName, Class<T> propertyType) {
+ String value = configValues.get(propertyName);
+ if (value != null) {
+ if (propertyType == String.class) {
+ return propertyType.cast(value);
+ }
+ if (propertyType == Integer.class) {
+ return propertyType.cast(Integer.parseInt(value));
+ }
+ }
+ return null;
+ }
+ @Override
+ public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType) {
+ return Optional.ofNullable(getValue(propertyName, propertyType));
+ }
+ @Override
+ public Iterable<String> getPropertyNames() {
+ return configValues.keySet();
+ }
+ @Override
+ public Iterable<ConfigSource> getConfigSources() {
+ ConfigSource source = new ConfigSource() {
+ @Override
+ public Map<String, String> getProperties() {
+ return configValues;
+ }
+ @Override
+ public String getValue(String propertyName) {
+ return (String) configValues.get(propertyName);
+ }
+ @Override
+ public String getName() {
+ return "stub";
+ }
+
+ @Override
+ public Set<String> getPropertyNames() {
+ return configValues.keySet();
+ }
+ };
+ return Arrays.asList(source);
+ }
+ @Override
+ public ConfigValue getConfigValue(String propertyName) {
+ return null;
+ }
+ @Override
+ public <T> Optional<Converter<T>> getConverter(Class<T> forType) {
+ return Optional.empty();
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> type) {
+ throw new IllegalArgumentException("Unsupported type: " + type);
+ }
+}
diff --git a/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfigProviderResolver.java b/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfigProviderResolver.java
index 962d969..2444faf 100644
--- a/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfigProviderResolver.java
+++ b/rt/rs/microprofile-client/src/test/java/org/apache/cxf/microprofile/client/mock/MockConfigProviderResolver.java
@@ -18,66 +18,26 @@
*/
package org.apache.cxf.microprofile.client.mock;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigBuilder;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
-import org.eclipse.microprofile.config.spi.ConfigSource;
public class MockConfigProviderResolver extends ConfigProviderResolver {
private final Map<String, String> configValues;
-
- private final Config config = new Config() {
- @Override
- public <T> T getValue(String propertyName, Class<T> propertyType) {
- String value = configValues.get(propertyName);
- if (value != null) {
- if (propertyType == String.class) {
- return propertyType.cast(value);
- }
- if (propertyType == Integer.class) {
- return propertyType.cast(Integer.parseInt(value));
- }
- }
- return null;
- }
- @Override
- public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType) {
- return Optional.ofNullable(getValue(propertyName, propertyType));
- }
- @Override
- public Iterable<String> getPropertyNames() {
- return configValues.keySet();
- }
- @Override
- public Iterable<ConfigSource> getConfigSources() {
- ConfigSource source = new ConfigSource() {
- @Override
- public Map<String, String> getProperties() {
- return configValues;
- }
- @Override
- public String getValue(String propertyName) {
- return (String) configValues.get(propertyName);
- }
- @Override
- public String getName() {
- return "stub";
- } };
- return Arrays.asList(source);
- } };
-
+ private final Config config;
+
public MockConfigProviderResolver() {
configValues = new HashMap<>();
+ config = new MockConfig(configValues);
}
public MockConfigProviderResolver(Map<String, String> configValues) {
this.configValues = configValues;
+ this.config = new MockConfig(configValues);
}
public void setConfigValues(Map<String, String> configValues) {
diff --git a/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfig.java b/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfig.java
new file mode 100644
index 0000000..7e1d69b
--- /dev/null
+++ b/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfig.java
@@ -0,0 +1,95 @@
+/**
+ * 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.cxf.systest.microprofile.rest.client;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import org.eclipse.microprofile.config.Config;
+import org.eclipse.microprofile.config.ConfigValue;
+import org.eclipse.microprofile.config.spi.ConfigSource;
+import org.eclipse.microprofile.config.spi.Converter;
+
+public class MockConfig implements Config {
+ private final Map<String, String> configValues;
+
+ public MockConfig(Map<String, String> configValues) {
+ this.configValues = configValues;
+ }
+
+ @Override
+ public <T> T getValue(String propertyName, Class<T> propertyType) {
+ String value = configValues.get(propertyName);
+ if (value != null) {
+ if (propertyType == String.class) {
+ return propertyType.cast(value);
+ }
+ if (propertyType == Integer.class) {
+ return propertyType.cast(Integer.parseInt(value));
+ }
+ }
+ return null;
+ }
+ @Override
+ public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType) {
+ return Optional.ofNullable(getValue(propertyName, propertyType));
+ }
+ @Override
+ public Iterable<String> getPropertyNames() {
+ return configValues.keySet();
+ }
+ @Override
+ public Iterable<ConfigSource> getConfigSources() {
+ ConfigSource source = new ConfigSource() {
+ @Override
+ public Map<String, String> getProperties() {
+ return configValues;
+ }
+ @Override
+ public String getValue(String propertyName) {
+ return (String) configValues.get(propertyName);
+ }
+ @Override
+ public String getName() {
+ return "stub";
+ }
+
+ @Override
+ public Set<String> getPropertyNames() {
+ return configValues.keySet();
+ }
+ };
+ return Arrays.asList(source);
+ }
+ @Override
+ public ConfigValue getConfigValue(String propertyName) {
+ return null;
+ }
+ @Override
+ public <T> Optional<Converter<T>> getConverter(Class<T> forType) {
+ return Optional.empty();
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> type) {
+ throw new IllegalArgumentException("Unsupported type: " + type);
+ }
+}
diff --git a/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfigProviderResolver.java b/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfigProviderResolver.java
index e0bc64a..63cd466 100644
--- a/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfigProviderResolver.java
+++ b/systests/microprofile/client/jaxrs/src/test/java/org/apache/cxf/systest/microprofile/rest/client/MockConfigProviderResolver.java
@@ -18,67 +18,27 @@
*/
package org.apache.cxf.systest.microprofile.rest.client;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.spi.ConfigBuilder;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
-import org.eclipse.microprofile.config.spi.ConfigSource;
public class MockConfigProviderResolver extends ConfigProviderResolver {
private final Map<String, String> configValues;
- private final Config config = new Config() {
- @Override
- public <T> T getValue(String propertyName, Class<T> propertyType) {
- String value = configValues.get(propertyName);
- System.out.println("getValue(" + propertyName + ") = " + value);
- if (value != null) {
- if (propertyType == String.class) {
- return propertyType.cast(value);
- }
- if (propertyType == Integer.class) {
- return propertyType.cast(Integer.parseInt(value));
- }
- }
- return null;
- }
- @Override
- public <T> Optional<T> getOptionalValue(String propertyName, Class<T> propertyType) {
- return Optional.ofNullable(getValue(propertyName, propertyType));
- }
- @Override
- public Iterable<String> getPropertyNames() {
- return configValues.keySet();
- }
- @Override
- public Iterable<ConfigSource> getConfigSources() {
- ConfigSource source = new ConfigSource() {
- @Override
- public Map<String, String> getProperties() {
- return configValues;
- }
- @Override
- public String getValue(String propertyName) {
- return (String) configValues.get(propertyName);
- }
- @Override
- public String getName() {
- return "stub";
- } };
- return Arrays.asList(source);
- } };
+ private final Config config;
public MockConfigProviderResolver() {
configValues = new HashMap<>();
+ config = new MockConfig(configValues);
}
public MockConfigProviderResolver(Map<String, String> configValues) {
this.configValues = configValues;
+ this.config = new MockConfig(configValues);
}
public void setConfigValues(Map<String, String> configValues) {