diff --git a/implementation/src/main/java/io/smallrye/openapi/runtime/OpenApiProcessor.java b/implementation/src/main/java/io/smallrye/openapi/runtime/OpenApiProcessor.java index 2f11a2bfd..6461cf548 100644 --- a/implementation/src/main/java/io/smallrye/openapi/runtime/OpenApiProcessor.java +++ b/implementation/src/main/java/io/smallrye/openapi/runtime/OpenApiProcessor.java @@ -19,11 +19,13 @@ import java.io.IOException; import java.io.InputStream; +import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.openapi.OASFilter; import org.eclipse.microprofile.openapi.OASModelReader; import org.eclipse.microprofile.openapi.models.OpenAPI; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.Node; +import org.jboss.shrinkwrap.api.classloader.ShrinkWrapClassLoader; import io.smallrye.openapi.api.OpenApiConfig; import io.smallrye.openapi.api.models.OpenAPIImpl; @@ -37,7 +39,19 @@ */ @SuppressWarnings("rawtypes") public class OpenApiProcessor { - + + /** + * Creates a MP Config instance from the given ShrinkWrap archive. + * @param archive + */ + public static OpenApiConfig configFromArchive(Archive archive) { + try (ShrinkWrapClassLoader cl = new ShrinkWrapClassLoader(archive)) { + return new OpenApiConfig(ConfigProvider.getConfig(cl)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + /** * Find a static file located in the deployment and, if it exists, parse it and * return the resulting model. If no static file is found, returns null. If an diff --git a/tck/pom.xml b/tck/pom.xml index eef31844e..8f5b59193 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -9,19 +9,17 @@ smallrye-open-api-tck SmallRye: MicroProfile OpenAPI TCK - io.smallrye smallrye-open-api - + io.smallrye smallrye-config - 1.3.0 diff --git a/tck/src/test/java/io/smallrye/openapi/tck/AirlinesAppTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/AirlinesAppTckTest.java index 8177360ea..b8d170311 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/AirlinesAppTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/AirlinesAppTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.AirlinesAppTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=AirlinesAppTest.class, configProperties="") -public class AirlinesAppTckTest extends BaseTckTest { - - @Override - public AirlinesAppTest getDelegate() { - return new AirlinesAppTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class AirlinesAppTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/FilterTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/FilterTckTest.java index 2e0802e21..236a990d8 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/FilterTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/FilterTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.FilterTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=FilterTest.class, configProperties="microprofile-config-filter.properties") -public class FilterTckTest extends BaseTckTest { - - @Override - public FilterTest getDelegate() { - return new FilterTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class FilterTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/ModelConstructionTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/ModelConstructionTckTest.java index 6616131b5..4e78123f6 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/ModelConstructionTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/ModelConstructionTckTest.java @@ -24,17 +24,15 @@ /** * @author eric.wittmann@gmail.com */ -@TckTest(test=ModelConstructionTest.class, configProperties="") -public class ModelConstructionTckTest extends BaseTckTest { - - @Override - public ModelConstructionTest getDelegate() { - return new ModelConstructionTest(); - } - +@TckTest +public class ModelConstructionTckTest extends BaseTckTest { + + /** + * @see test.io.smallrye.openapi.tck.BaseTckTest#getTestArguments() + */ @Override public Object[] getTestArguments() { - return new Object[] {}; + return null; } } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/ModelReaderAppTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/ModelReaderAppTckTest.java index a12d652c8..d9ce989a8 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/ModelReaderAppTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/ModelReaderAppTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.ModelReaderAppTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=ModelReaderAppTest.class, configProperties="microprofile-reader.properties") -public class ModelReaderAppTckTest extends BaseTckTest { - - @Override - public ModelReaderAppTest getDelegate() { - return new ModelReaderAppTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class ModelReaderAppTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassTckTest.java index 59a9cfbf7..ab640cb92 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigExcludeClassTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigExcludeClassTest.class, configProperties="exclude-class-microprofile-config.properties") -public class OASConfigExcludeClassTckTest extends BaseTckTest { - - @Override - public OASConfigExcludeClassTest getDelegate() { - return new OASConfigExcludeClassTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigExcludeClassTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassesTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassesTckTest.java index 1dcc5c44f..71a217258 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassesTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludeClassesTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigExcludeClassesTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigExcludeClassesTest.class, configProperties="exclude-classes-microprofile-config.properties") -public class OASConfigExcludeClassesTckTest extends BaseTckTest { - - @Override - public OASConfigExcludeClassesTest getDelegate() { - return new OASConfigExcludeClassesTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigExcludeClassesTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludePackageTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludePackageTckTest.java index ec6931755..eac6c1272 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludePackageTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigExcludePackageTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigExcludePackageTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigExcludePackageTest.class, configProperties="exclude-package-microprofile-config.properties") -public class OASConfigExcludePackageTckTest extends BaseTckTest { - - @Override - public OASConfigExcludePackageTest getDelegate() { - return new OASConfigExcludePackageTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigExcludePackageTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassTckTest.java index 1c75cee4b..58d17724e 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigScanClassTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigScanClassTest.class, configProperties="class-microprofile-config.properties") -public class OASConfigScanClassTckTest extends BaseTckTest { - - @Override - public OASConfigScanClassTest getDelegate() { - return new OASConfigScanClassTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigScanClassTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassesTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassesTckTest.java index 12b4a0415..33d5e34d7 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassesTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanClassesTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigScanClassesTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigScanClassesTest.class, configProperties="classes-microprofile-config.properties") -public class OASConfigScanClassesTckTest extends BaseTckTest { - - @Override - public OASConfigScanClassesTest getDelegate() { - return new OASConfigScanClassesTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigScanClassesTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanDisableTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanDisableTckTest.java index d61aebf55..6f99a18b4 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanDisableTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanDisableTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigScanDisableTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigScanDisableTest.class, configProperties="scan-disable-microprofile-config.properties") -public class OASConfigScanDisableTckTest extends BaseTckTest { - - @Override - public OASConfigScanDisableTest getDelegate() { - return new OASConfigScanDisableTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigScanDisableTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanPackageTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanPackageTckTest.java index 41246bce7..a69c203e1 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanPackageTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigScanPackageTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigScanPackageTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigScanPackageTest.class, configProperties="package-microprofile-config.properties") -public class OASConfigScanPackageTckTest extends BaseTckTest { - - @Override - public OASConfigScanPackageTest getDelegate() { - return new OASConfigScanPackageTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigScanPackageTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigServersTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigServersTckTest.java index d1586863d..74140a19c 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASConfigServersTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASConfigServersTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.OASConfigServersTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASConfigServersTest.class, configProperties="server-microprofile-config.properties") -public class OASConfigServersTckTest extends BaseTckTest { - - @Override - public OASConfigServersTest getDelegate() { - return new OASConfigServersTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class OASConfigServersTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/OASFactoryErrorTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/OASFactoryErrorTckTest.java index bbe107e8f..f929d1275 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/OASFactoryErrorTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/OASFactoryErrorTckTest.java @@ -24,17 +24,15 @@ /** * @author eric.wittmann@gmail.com */ -@TckTest(test=OASFactoryErrorTest.class, configProperties="") -public class OASFactoryErrorTckTest extends BaseTckTest { - - @Override - public OASFactoryErrorTest getDelegate() { - return new OASFactoryErrorTest(); - } - +@TckTest +public class OASFactoryErrorTckTest extends BaseTckTest { + + /** + * @see test.io.smallrye.openapi.tck.BaseTckTest#getTestArguments() + */ @Override public Object[] getTestArguments() { - return new Object[] {}; + return null; } } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/PetStoreAppTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/PetStoreAppTckTest.java index 5f0dbd684..1ffa1d90e 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/PetStoreAppTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/PetStoreAppTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.PetStoreAppTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=PetStoreAppTest.class, configProperties="") -public class PetStoreAppTckTest extends BaseTckTest { - - @Override - public PetStoreAppTest getDelegate() { - return new PetStoreAppTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class PetStoreAppTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/io/smallrye/openapi/tck/StaticDocumentTckTest.java b/tck/src/test/java/io/smallrye/openapi/tck/StaticDocumentTckTest.java index 060d3e4c8..8b1c5a908 100644 --- a/tck/src/test/java/io/smallrye/openapi/tck/StaticDocumentTckTest.java +++ b/tck/src/test/java/io/smallrye/openapi/tck/StaticDocumentTckTest.java @@ -18,29 +18,13 @@ import org.eclipse.microprofile.openapi.tck.StaticDocumentTest; -import io.restassured.response.ValidatableResponse; import test.io.smallrye.openapi.tck.BaseTckTest; import test.io.smallrye.openapi.tck.TckTest; /** * @author eric.wittmann@gmail.com */ -@TckTest(test=StaticDocumentTest.class, configProperties="") -public class StaticDocumentTckTest extends BaseTckTest { - - @Override - public StaticDocumentTest getDelegate() { - return new StaticDocumentTest() { - @Override - public ValidatableResponse callEndpoint(String format) { - return doCallEndpoint(format); - } - }; - } - - @Override - public Object[] getTestArguments() { - return new String[] { "JSON" }; - } +@TckTest +public class StaticDocumentTckTest extends BaseTckTest { } diff --git a/tck/src/test/java/test/io/smallrye/openapi/tck/BaseTckTest.java b/tck/src/test/java/test/io/smallrye/openapi/tck/BaseTckTest.java index c70ff46b5..47ffa8573 100644 --- a/tck/src/test/java/test/io/smallrye/openapi/tck/BaseTckTest.java +++ b/tck/src/test/java/test/io/smallrye/openapi/tck/BaseTckTest.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.io.OutputStream; +import java.lang.reflect.ParameterizedType; import java.net.InetSocketAddress; import org.eclipse.microprofile.openapi.tck.FilterTest; @@ -43,7 +44,7 @@ */ @SuppressWarnings("restriction") @RunWith(TckTestRunner.class) -public abstract class BaseTckTest { +public abstract class BaseTckTest { protected static final String APPLICATION_JSON = "application/json"; protected static final String TEXT_PLAIN = "text/plain"; @@ -104,7 +105,16 @@ protected ValidatableResponse doCallEndpoint(String format) { * this so that the correct test delegate is created *and* its callEndpoint() * method can be properly overridden. */ - public abstract Arquillian getDelegate(); + @SuppressWarnings({ "rawtypes", "unchecked" }) + public T getDelegate() { + try { + ParameterizedType ptype = (ParameterizedType) this.getClass().getGenericSuperclass(); + Class cc = (Class)ptype.getActualTypeArguments()[0]; + return (T) cc.newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } /** * Arguments to pass to each of the test methods in the TCK test. This is @@ -112,7 +122,7 @@ protected ValidatableResponse doCallEndpoint(String format) { * has arguments to its methods. */ public Object[] getTestArguments() { - return null; + return new String[] { "JSON" }; } } diff --git a/tck/src/test/java/test/io/smallrye/openapi/tck/TckTest.java b/tck/src/test/java/test/io/smallrye/openapi/tck/TckTest.java index 1845165c0..bc6348381 100644 --- a/tck/src/test/java/test/io/smallrye/openapi/tck/TckTest.java +++ b/tck/src/test/java/test/io/smallrye/openapi/tck/TckTest.java @@ -22,8 +22,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import org.jboss.arquillian.testng.Arquillian; - /** * Use this annotation along with @TckTestRunner to indicate the specific Tck that is * under test. @@ -34,8 +32,4 @@ @Inherited public @interface TckTest { - Class test(); - - String configProperties(); - } diff --git a/tck/src/test/java/test/io/smallrye/openapi/tck/TckTestRunner.java b/tck/src/test/java/test/io/smallrye/openapi/tck/TckTestRunner.java index bbd15c3cb..b7a74358f 100644 --- a/tck/src/test/java/test/io/smallrye/openapi/tck/TckTestRunner.java +++ b/tck/src/test/java/test/io/smallrye/openapi/tck/TckTestRunner.java @@ -20,6 +20,7 @@ import java.io.FileWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; @@ -29,8 +30,6 @@ import java.util.Map; import org.apache.commons.io.IOUtils; -import org.eclipse.microprofile.config.Config; -import org.eclipse.microprofile.config.spi.ConfigSource; import org.eclipse.microprofile.openapi.models.OpenAPI; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.testng.Arquillian; @@ -43,8 +42,6 @@ import org.junit.runners.model.InitializationError; import org.junit.runners.model.Statement; -import io.smallrye.config.PropertiesConfigSourceProvider; -import io.smallrye.config.SmallRyeConfigBuilder; import io.smallrye.openapi.api.OpenApiConfig; import io.smallrye.openapi.api.OpenApiDocument; import io.smallrye.openapi.runtime.OpenApiProcessor; @@ -80,18 +77,8 @@ public TckTestRunner(Class testClass) throws InitializationError { // The Archive (shrinkwrap deployment) Archive archive = archive(); // MPConfig - SmallRyeConfigBuilder cfgBuilder = new SmallRyeConfigBuilder(); - cfgBuilder.addDefaultSources(); - TckTest anno = testClass.getAnnotation(TckTest.class); - if (anno.configProperties() != null && anno.configProperties().trim().length() > 0) { - List configSources = new PropertiesConfigSourceProvider(anno.configProperties(), true, tckTestClass.getClassLoader()).getConfigSources(tckTestClass.getClassLoader()); - configSources.forEach(source -> { - cfgBuilder.withSources(source); - }); - } + OpenApiConfig config = OpenApiProcessor.configFromArchive(archive); - Config mpConfig = cfgBuilder.build(); - OpenApiConfig config = new OpenApiConfig(mpConfig); try { // Reset and then initialize the OpenApiDocument for this test. OpenApiDocument.INSTANCE.reset(); @@ -143,12 +130,11 @@ private Archive archive() throws InitializationError { * Figures out what TCK test is being run. * @throws InitializationError */ + @SuppressWarnings("unchecked") private Class determineTckTestClass(Class testClass) throws InitializationError { - TckTest anno = testClass.getAnnotation(TckTest.class); - if (anno == null) { - throw new InitializationError("Missing annotation @TckTest"); - } - return anno.test(); + ParameterizedType ptype = (ParameterizedType) testClass.getGenericSuperclass(); + Class cc = (Class)ptype.getActualTypeArguments()[0]; + return cc; } /**