[15/45] incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed Boolean conversion to comply with MP TCK.
TAMAYA-260: Fixed Boolean conversion to comply with MP TCK. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/50927f43 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/50927f43 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/50927f43 Branch: refs/heads/master Commit: 50927f43815fb901bb3e4166f658493d3e335a3c Parents: 029a43c Author: anatoleAuthored: Mon Aug 14 00:03:30 2017 +0200 Committer: anatole Committed: Mon Aug 14 00:03:30 2017 +0200 -- .../converter/BooleanAsIntegerConverterFix.java | 60 + .../converter/ProviderConverter.java| 69 .../org.apache.tamaya.spi.PropertyConverter | 2 +- .../imported/CDIPlainInjectionTest.java | 3 +- .../microprofile/imported/ConverterTest.java| 2 +- 5 files changed, 64 insertions(+), 72 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/50927f43/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.java new file mode 100644 index 000..debf6c7 --- /dev/null +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/BooleanAsIntegerConverterFix.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.microprofile.converter; + +import org.apache.tamaya.spi.ConversionContext; +import org.apache.tamaya.spi.PropertyConverter; + +import java.util.Locale; +import java.util.Objects; +import java.util.logging.Logger; + +/** + * Converter, converting from String to Boolean for zerpo = false, otherwise true. + */ +public class BooleanAsIntegerConverterFix implements PropertyConverter { + +private final Logger LOG = Logger.getLogger(getClass().getName()); + +@Override +public Boolean convert(String value, ConversionContext context) { +context.addSupportedFormats(getClass(), "int != 0 (true)", "0 (false)"); +try{ +int val = Integer.parseInt(Objects.requireNonNull(value).trim()); +if(val!=0) { +return Boolean.TRUE; +}else { +return Boolean.FALSE; +} +}catch(Exception e){ +// OK +return null; +} +} + +@Override +public boolean equals(Object o){ +return getClass().equals(o.getClass()); +} + +@Override +public int hashCode(){ +return getClass().hashCode(); +} +} http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/50927f43/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java deleted file mode 100644 index de57465..000 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java +++ /dev/null @@ -1,69 +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
[17/45] incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed Boolean conversion to comply with MP TCK.
TAMAYA-260: Fixed Boolean conversion to comply with MP TCK. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/b2c69a1b Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/b2c69a1b Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/b2c69a1b Branch: refs/heads/master Commit: b2c69a1b71b73e8c0546bf46e5e290a583b38381 Parents: 4a63a4a Author: anatoleAuthored: Mon Aug 14 01:38:20 2017 +0200 Committer: anatole Committed: Mon Aug 14 01:38:20 2017 +0200 -- microprofile/pom.xml| 5 + .../tamaya/microprofile/MicroprofileConfig.java | 20 +++- .../microprofile/cdi/BridgingConfigBean.java| 10 -- .../converter/BooleanAsIntegerConverterFix.java | 13 +++-- .../tck/TamayaConfigArchiveProcessor.java | 5 +++-- 5 files changed, 34 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/pom.xml -- diff --git a/microprofile/pom.xml b/microprofile/pom.xml index ff893b8..37bbb2b 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -77,6 +77,11 @@ under the License. ${tamaya-version} +org.apache.tamaya.ext +tamaya-events +${tamaya-version} + + org.eclipse.microprofile.config microprofile-config-api 1.0 http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java index 3dc4b34..61c3cdc 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java @@ -20,16 +20,21 @@ package org.apache.tamaya.microprofile; import org.apache.tamaya.ConfigException; import org.apache.tamaya.Configuration; +import org.apache.tamaya.events.FrozenConfiguration; import org.apache.tamaya.spi.PropertySource; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.spi.ConfigSource; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; import java.util.*; /** * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance. */ -public class MicroprofileConfig implements Config { +public class MicroprofileConfig implements Config, Serializable { private Configuration delegate; @@ -79,4 +84,17 @@ public class MicroprofileConfig implements Config { "delegate=" + delegate + '}'; } + +private void writeObject(ObjectOutputStream out) throws IOException{ +if(!(this.delegate instanceof Serializable)){ +out.writeObject(FrozenConfiguration.of(this.delegate)); +}else { +out.writeObject(this.delegate); +} +} + +private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{ +this.delegate = (Configuration)in.readObject(); +} + } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java index deb2496..a08f76f 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java @@ -85,16 +85,6 @@ final class BridgingConfigBean implements Bean { @Override public Object create(CreationalContext creationalContext) { -//Set injectionPoints = delegate.getInjectionPoints(); -//for(InjectionPoint injectionPoint:injectionPoints){ -//final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class); -//String key = annotation.name(); -//ConversionContext context = -// MicroprofileConfigurationProducer.createConversionContext(key,
incubator-tamaya-sandbox git commit: TAMAYA-260: Fixed Boolean conversion to comply with MP TCK.
Repository: incubator-tamaya-sandbox Updated Branches: refs/heads/java8 4a63a4a4f -> b2c69a1b7 TAMAYA-260: Fixed Boolean conversion to comply with MP TCK. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/b2c69a1b Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/b2c69a1b Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/b2c69a1b Branch: refs/heads/java8 Commit: b2c69a1b71b73e8c0546bf46e5e290a583b38381 Parents: 4a63a4a Author: anatoleAuthored: Mon Aug 14 01:38:20 2017 +0200 Committer: anatole Committed: Mon Aug 14 01:38:20 2017 +0200 -- microprofile/pom.xml| 5 + .../tamaya/microprofile/MicroprofileConfig.java | 20 +++- .../microprofile/cdi/BridgingConfigBean.java| 10 -- .../converter/BooleanAsIntegerConverterFix.java | 13 +++-- .../tck/TamayaConfigArchiveProcessor.java | 5 +++-- 5 files changed, 34 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/pom.xml -- diff --git a/microprofile/pom.xml b/microprofile/pom.xml index ff893b8..37bbb2b 100644 --- a/microprofile/pom.xml +++ b/microprofile/pom.xml @@ -77,6 +77,11 @@ under the License. ${tamaya-version} +org.apache.tamaya.ext +tamaya-events +${tamaya-version} + + org.eclipse.microprofile.config microprofile-config-api 1.0 http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java index 3dc4b34..61c3cdc 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/MicroprofileConfig.java @@ -20,16 +20,21 @@ package org.apache.tamaya.microprofile; import org.apache.tamaya.ConfigException; import org.apache.tamaya.Configuration; +import org.apache.tamaya.events.FrozenConfiguration; import org.apache.tamaya.spi.PropertySource; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.spi.ConfigSource; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; import java.util.*; /** * Microprofile {@link ConfigSource} implementation that wraps a {@link PropertySource} instance. */ -public class MicroprofileConfig implements Config { +public class MicroprofileConfig implements Config, Serializable { private Configuration delegate; @@ -79,4 +84,17 @@ public class MicroprofileConfig implements Config { "delegate=" + delegate + '}'; } + +private void writeObject(ObjectOutputStream out) throws IOException{ +if(!(this.delegate instanceof Serializable)){ +out.writeObject(FrozenConfiguration.of(this.delegate)); +}else { +out.writeObject(this.delegate); +} +} + +private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{ +this.delegate = (Configuration)in.readObject(); +} + } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/b2c69a1b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java -- diff --git a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java index deb2496..a08f76f 100644 --- a/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java +++ b/microprofile/src/main/java/org/apache/tamaya/microprofile/cdi/BridgingConfigBean.java @@ -85,16 +85,6 @@ final class BridgingConfigBean implements Bean { @Override public Object create(CreationalContext creationalContext) { -//Set injectionPoints = delegate.getInjectionPoints(); -//for(InjectionPoint injectionPoint:injectionPoints){ -//final ConfigProperty annotation = injectionPoint.getAnnotated().getAnnotation(ConfigProperty.class); -//String key = annotation.name(); -//ConversionContext