Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make most archives not testable #545

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import io.restassured.response.ValidatableResponse;

public class FilterTest extends AppTestBase {
@Deployment(name = "airlinesFiltered")
@Deployment(name = "airlinesFiltered", testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "airlinesFiltered.war")
.addPackages(true, "org.eclipse.microprofile.openapi.apps.airlines")
Expand All @@ -42,7 +41,6 @@ public static WebArchive createDeployment() {
.addAsManifestResource("microprofile-config-filter.properties", "microprofile-config.properties");
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterServer(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand Down Expand Up @@ -70,7 +68,6 @@ public void testFilterServer(String type) {
vr.body(serverPath + ".variables.protocol.enum", containsInAnyOrder("http", "https"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterPathItemEnsureOrder(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -82,7 +79,6 @@ public void testFilterPathItemEnsureOrder(String type) {
equalTo("parent - Retrieve all bookings for current user"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterPathItemAddOperation(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -91,7 +87,6 @@ public void testFilterPathItemAddOperation(String type) {
equalTo("filterPathItem - successfully put airlines"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterOperation(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -101,15 +96,13 @@ public void testFilterOperation(String type) {
vr.body("paths.'/bookings/{id}'.get.tags", containsInAnyOrder("Reservations", "parent - Bookings"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterOpenAPI(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/bookings/{id}'.put.summary", equalTo("filterOpenAPI - Update a booking with ID"));
vr.body("paths.'/bookings/{id}'.put.operationId", equalTo("updateBookingId"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterParameter(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -125,7 +118,6 @@ public void testFilterParameter(String type) {
vr.body(reviewParameters, hasSize(1));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterRequestBody(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -135,7 +127,6 @@ public void testFilterRequestBody(String type) {
vr.body(endpoint + ".content", notNullValue());
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterSecurityScheme(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -145,7 +136,6 @@ public void testFilterSecurityScheme(String type) {
vr.body(booking + "openIdConnectUrl", equalTo("http://openidconnect.com/testurl"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterLink(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -154,7 +144,6 @@ public void testFilterLink(String type) {
vr.body(s + "description", equalTo("filterLink - The username corresponding to provided user id"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterTag(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -163,7 +152,6 @@ public void testFilterTag(String type) {
vr.body(tagsPath + "user" + desc, equalTo("filterTag - Operations about user"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterHeader(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -176,7 +164,6 @@ public void testFilterHeader(String type) {
vr.body(maxRate + ".schema.type", equalTo("integer"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterAPIResponse(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -186,7 +173,6 @@ public void testFilterAPIResponse(String type) {
vr.body(parentChild, equalTo("parent - id of the new review"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterSchema(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -196,7 +182,6 @@ public void testFilterSchema(String type) {

}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testFilterCallback(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,27 @@
import java.util.List;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import io.restassured.response.ValidatableResponse;

public class ModelReaderAppTest extends AppTestBase {
@Deployment(name = "airlinesModelReader")
@Deployment(name = "airlinesModelReader", testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "airlinesReader.war")
.addPackages(true, "org.eclipse.microprofile.openapi.apps.airlines")
.addPackages(true, "org.eclipse.microprofile.openapi.reader")
.addAsManifestResource("microprofile-reader.properties", "microprofile-config.properties");
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testVersion(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("openapi", startsWith("3.0."));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testInfo(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -64,7 +61,6 @@ public void testInfo(String type) {
vr.body("info.termsOfService", equalTo("http://airlinesratingapp.com/terms"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testContact(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -73,23 +69,20 @@ public void testContact(String type) {
vr.body("info.contact.email", equalTo("techsupport@airlinesratingapp.com"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testLicense(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("info.license.name", equalTo("Apache 2.0"));
vr.body("info.license.url", equalTo("http://www.apache.org/licenses/LICENSE-2.0.html"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testExternalDocumentation(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("externalDocs.description", equalTo("instructions for how to deploy this app"));
vr.body("externalDocs.url", containsString("README.md"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testServer(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -115,23 +108,20 @@ public void testServer(String type) {

}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testOperationAirlinesResource(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/modelReader/airlines'.get.summary", equalTo("Retrieve all available airlines"));
vr.body("paths.'/modelReader/airlines'.get.operationId", equalTo("getAirlines"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testOperationAvailabilityResource(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/availability'.get.summary", equalTo("Retrieve all available flights"));
vr.body("paths.'/availability'.get.operationId", equalTo("getFlights"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testOperationBookingResource(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -144,7 +134,6 @@ public void testOperationBookingResource(String type) {
vr.body("paths.'/modelReader/bookings'.post.operationId", equalTo("createBooking"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testAPIResponse(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -154,7 +143,6 @@ public void testAPIResponse(String type) {
vr.body("paths.'/availability'.get.responses.'404'.description", equalTo("No available flights found"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testAvailabilityGetParameter(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand Down Expand Up @@ -190,7 +178,6 @@ public void testAvailabilityGetParameter(String type) {
both(hasSize(1)).and(contains(0)));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSecurityRequirement(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -201,15 +188,13 @@ public void testSecurityRequirement(String type) {
vr.body("paths.'/bookings'.post.security.bookingSecurityScheme[0]", hasSize(2));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSecuritySchemes(String type) {
ValidatableResponse vr = callEndpoint(type);
String s = "components.securitySchemes";
vr.body(s, hasKey("httpTestScheme"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSecurityScheme(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -219,7 +204,6 @@ public void testSecurityScheme(String type) {
vr.body(http + "scheme", equalTo("testScheme"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSchema(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -233,7 +217,6 @@ public void testSchema(String type) {
equalTo("id of the new booking"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testExampleObject(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -243,7 +226,6 @@ public void testExampleObject(String type) {
vr.body("components.examples.review.externalValue", equalTo("http://foo.bar/examples/review-example.json"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testTagDeclarations(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -262,15 +244,13 @@ public void testTagDeclarations(String type) {
vr.body(tagsPath + "Retrieve Airlines" + desc, equalTo("method to retrieve all airlines"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testTagsInOperations(String type) {
ValidatableResponse vr = callEndpoint(type);
vr.body("paths.'/availability'.get.tags", containsInAnyOrder("Get Flights", "Availability"));
vr.body("paths.'/modelReader/bookings'.get.tags", containsInAnyOrder("bookings"));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testComponents(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -295,7 +275,6 @@ public void testComponents(String type) {
vr.body("components.links.UserName", notNullValue());
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testHeaderInComponents(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand All @@ -306,7 +285,6 @@ public void testHeaderInComponents(String type) {
vr.body(maxRate + ".allowEmptyValue", equalTo(true));
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testContentInAPIResponse(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.hamcrest.Matchers.startsWith;
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;

import org.jboss.arquillian.container.test.api.RunAsClient;
import org.testng.annotations.Test;

import io.restassured.response.ValidatableResponse;
Expand All @@ -31,7 +30,6 @@
public abstract class OASConfigScanClassBase extends AppTestBase {
private ValidatableResponse vr;

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testScanClass(String type) throws InterruptedException {
vr = callEndpoint(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.hamcrest.collection.IsMapWithSize.aMapWithSize;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;
Expand All @@ -31,14 +30,13 @@
public class OASConfigScanDisableTest extends AppTestBase {
private ValidatableResponse vr;

@Deployment(name = "airlines")
@Deployment(name = "airlines", testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "airlines.war")
.addPackages(true, "org.eclipse.microprofile.openapi.apps.airlines")
.addAsManifestResource("scan-disable-microprofile-config.properties", "microprofile-config.properties");
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testScanDisable(String type) throws InterruptedException {
vr = callEndpoint(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import org.hamcrest.Matcher;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;
Expand All @@ -34,15 +33,14 @@

public class OASConfigSchemaTest extends AppTestBase {

@Deployment(name = "petstore")
@Deployment(name = "petstore", testable = false)
public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "petstore.war")
.addPackages(true, "org.eclipse.microprofile.openapi.apps.petstore")
.addAsWebInfResource("schema-microprofile-config.properties",
"classes/META-INF/microprofile-config.properties");
}

@RunAsClient
@Test(dataProvider = "formatProvider")
public void testSchemaConfigApplied(String type) {
ValidatableResponse vr = callEndpoint(type);
Expand Down
Loading