Skip to content

Commit

Permalink
Merge pull request #4 from EricWittmann/master
Browse files Browse the repository at this point in the history
Simplified TCK tests
  • Loading branch information
Andy Gumbrecht authored Jun 15, 2018
2 parents b8c59c6 + 95ec6d6 commit 6e02826
Show file tree
Hide file tree
Showing 20 changed files with 75 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
<artifactId>smallrye-open-api-tck</artifactId>
<name>SmallRye: MicroProfile OpenAPI TCK</name>


<dependencies>
<!-- Project Dependencies -->
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-open-api</artifactId>
</dependency>

<!-- SmallRye Config -->
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-config</artifactId>
<version>1.3.0</version>
</dependency>

<!-- Test Only -->
Expand Down
20 changes: 2 additions & 18 deletions tck/src/test/java/io/smallrye/openapi/tck/AirlinesAppTckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<AirlinesAppTest> {

}
20 changes: 2 additions & 18 deletions tck/src/test/java/io/smallrye/openapi/tck/FilterTckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<FilterTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModelConstructionTest> {

/**
* @see test.io.smallrye.openapi.tck.BaseTckTest#getTestArguments()
*/
@Override
public Object[] getTestArguments() {
return new Object[] {};
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModelReaderAppTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<OASConfigExcludeClassTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<OASConfigExcludeClassesTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<OASConfigExcludePackageTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<OASConfigScanClassTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<OASConfigScanClassesTest> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<OASConfigScanDisableTest> {

}
Loading

0 comments on commit 6e02826

Please sign in to comment.