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

Fixed tests #1399

Merged
merged 2 commits into from
Dec 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,50 @@
package com.predic8.membrane.examples.tests.validation;

import com.predic8.membrane.examples.util.*;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.*;

import java.io.IOException;
import java.io.*;

import static com.predic8.membrane.core.http.Header.CONTENT_TYPE;
import static com.predic8.membrane.core.http.MimeType.APPLICATION_SOAP;
import static com.predic8.membrane.test.AssertUtils.*;
import static io.restassured.RestAssured.config;
import static io.restassured.RestAssured.given;
import static io.restassured.config.EncoderConfig.encoderConfig;
import static com.predic8.membrane.core.http.MimeType.*;
import static io.restassured.RestAssured.*;
import static java.io.File.*;

public class SOAPProxyValidationTest extends DistributionExtractingTestcase {

@Override
protected String getExampleDirName() {
return "validation" + separator + "soap-Proxy";
}
@Override
protected String getExampleDirName() {
return "validation" + separator + "soap-Proxy";
}

@Test
public void testValidCitySoapRequest() throws IOException {
given().contentType(APPLICATION_SOAP)
@Test
public void testValidCitySoapRequest() throws IOException, InterruptedException {
try (Process2 ignored = startServiceProxyScript()) {
// @formatter:off
given()
.contentType(APPLICATION_SOAP)
.body(readFile("city-soap.xml"))
.when()
.when()
.post("http://localhost:2000/")
.then()
.then()
.statusCode(200)
.extract().asString();
}
// @formatter:on
}
}

@Test
public void testInvalidCitySoapRequest() throws IOException {
given().contentType(APPLICATION_SOAP)
@Test
public void testInvalidCitySoapRequest() throws IOException, InterruptedException {
try (Process2 ignored = startServiceProxyScript()) {
// @formatter:off
given()
.contentType(APPLICATION_SOAP)
.body(readFile("invalid-city-soap.xml"))
.when()
.when()
.post("http://localhost:2000/")
.then()
.then()
.statusCode(400)
.extract().asString();
}
// @formatter:on
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ public abstract class DistributionExtractingTestcase {

public static final String MEMBRANE_LOG_LEVEL = "info";

public static final String BLZ_SERVICE = "http://localhost:2000/bank/services/BLZService";
public static final String BLZ_SERVICE_WSDL = BLZ_SERVICE + "?wsdl";

public static final String LOCALHOST_2000 = "http://localhost:2000";

public static final String[] CONTENT_TYPE_APP_XML_HEADER = {"Content-Type", APPLICATION_XML};
public static final String[] CONTENT_TYPE_TEXT_XML_HEADER = {"Content-Type", TEXT_XML};
public static final String[] CONTENT_TYPE_APP_JSON_HEADER = {"Content-Type", APPLICATION_JSON};

public static final String[] CONTENT_TYPE_SOAP_HEADER = {"Content-Type", APPLICATION_SOAP};

private File unzipDir;
private File membraneHome;
protected File baseDir = new File(getExampleDirName());
Expand Down
Loading