Skip to content

Commit

Permalink
Fixed tests (#1399)
Browse files Browse the repository at this point in the history
  • Loading branch information
predic8 authored Dec 11, 2024
1 parent f30e1e7 commit c51b6ee
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
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

0 comments on commit c51b6ee

Please sign in to comment.