Skip to content

Commit

Permalink
Merge pull request #1725 from tevans78/1551-runConfig12TCK
Browse files Browse the repository at this point in the history
1551 run config12 tck
  • Loading branch information
tevans78 authored Jan 25, 2018
2 parents 8efc5b3 + 7e07175 commit 6762bd3
Show file tree
Hide file tree
Showing 49 changed files with 1,982 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,39 @@
package com.ibm.ws.microprofile.config12.converters;

import com.ibm.ws.microprofile.config.converters.BuiltInConverter;
import com.ibm.ws.microprofile.config.converters.ExtendedGenericConverter;
import com.ibm.ws.microprofile.config.impl.ConversionManager;

/**
* Convert from the String name of a class to an actual Class, as loaded by Class.forName
*/
public class ClassConverter extends BuiltInConverter {
public class ClassConverter extends BuiltInConverter implements ExtendedGenericConverter {

public ClassConverter() {
super(Class.class);
}

/** {@inheritDoc} */
@Override
public Class<?> convert(String value) {
public Class<?> convert(String rawString) {
Class<?> converted = null;
if (value != null) {
if (rawString != null) {
try {
converted = Class.forName(value);
converted = Class.forName(rawString);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
}
return converted;
}

/** {@inheritDoc} */
@Override
public <T> Object convert(String rawString, Class<T> genericType, ConversionManager conversionManager, ClassLoader classLoader) {
Class<?> converted = null;
if (rawString != null) {
try {
converted = classLoader.loadClass(rawString);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public List<String> convert(String value) {

/** {@inheritDoc} */
@Override
public <T> List<T> convert(String rawString, Class<T> genericType, ConversionManager conversionManager) {
public <T> List<T> convert(String rawString, Class<T> genericType, ConversionManager conversionManager, ClassLoader classLoader) {
T[] array = conversionManager.convertArray(rawString, genericType);
List<T> list = Arrays.asList(array);
return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public Set<String> convert(String value) {

/** {@inheritDoc} */
@Override
public <T> Set<T> convert(String rawString, Class<T> genericType, ConversionManager conversionManager) {
public <T> Set<T> convert(String rawString, Class<T> genericType, ConversionManager conversionManager, ClassLoader classLoader) {
T[] array = conversionManager.convertArray(rawString, genericType);
Set<T> set = new HashSet<T>(Arrays.asList(array));
return set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected PriorityConverterMap getDefaultConverters() {
}

@Override
protected ConversionDecoder getConversionDecoder(PriorityConverterMap converters) {
return new Config12ConversionManager(converters);
protected ConversionDecoder getConversionDecoder(PriorityConverterMap converters, ClassLoader classLoader) {
return new Config12ConversionManager(converters, classLoader);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class Config12ConversionManager extends ConversionDecoder {
/**
* @param converters all the converters to use
*/
public Config12ConversionManager(PriorityConverterMap converters) {
super(converters);
public Config12ConversionManager(PriorityConverterMap converters, ClassLoader classLoader) {
super(converters, classLoader);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions dev/com.ibm.ws.microprofile.config.1.2_fat_tck/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<!-- The directory below is not compiled in the main build.
Only importing this project into Eclipse as an existing
maven project would add the correct dependencies to
get rid of eclipse markers for unresolved project dependencies.
If you do that, you can uncomment the line below.
<classpathentry kind="src" path="publish/tckRunner/tck/src"/>
-->
<classpathentry kind="src" path="fat/src"/>
<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
23 changes: 23 additions & 0 deletions dev/com.ibm.ws.microprofile.config.1.2_fat_tck/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.ws.microprofile.config.1.2_fat_tck</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>bndtools.core.bndbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>bndtools.core.bndnature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
compileErrorAction=build
eclipse.preferences.version=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Wed Aug 17 16:19:12 BST 2011
eclipse.preferences.version=1
encoding/<project>=UTF-8
Loading

0 comments on commit 6762bd3

Please sign in to comment.