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 15:07:15 UTC

[cxf] branch master updated: Update to MicroProfile 2.0.0-RC3 (#736)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a77819  Update to MicroProfile 2.0.0-RC3 (#736)
6a77819 is described below

commit 6a77819f4bc141fcddd53a36b178972f1f68fe97
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Fri Dec 11 10:07:03 2020 -0500

    Update to MicroProfile 2.0.0-RC3 (#736)
---
 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 +----------
 systests/microprofile/client/weld/testng.xml       |  6 +-
 6 files changed, 203 insertions(+), 93 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) {
diff --git a/systests/microprofile/client/weld/testng.xml b/systests/microprofile/client/weld/testng.xml
index 39df90d..e4c67d9 100644
--- a/systests/microprofile/client/weld/testng.xml
+++ b/systests/microprofile/client/weld/testng.xml
@@ -4,11 +4,11 @@
     <test name="All TCK Tests">
         <packages>
             <package name="org.eclipse.microprofile.rest.client.tck" />
-            <package name="org.eclipse.microprofile.rest.client.tck.asynctests" />
             <package name="org.eclipse.microprofile.rest.client.tck.cditests" />
-            <package name="org.eclipse.microprofile.rest.client.tck.sse" />
+            <package name="org.eclipse.microprofile.rest.client.tck.asynctests" />
+            <package name="org.eclipse.microprofile.rest.client.tck.sse" /> 
             <package name="org.eclipse.microprofile.rest.client.tck.ssl" />
-            <package name="org.eclipse.microprofile.rest.client.tck.timeout" />
+            <package name="org.eclipse.microprofile.rest.client.tck.timeout" /> 
         </packages>
     </test>
 </suite>