Skip to content

Commit

Permalink
initial functional test of wilma-mock API (#46)
Browse files Browse the repository at this point in the history
+ tuning on localhost blocking func test
  • Loading branch information
tkohegyi committed Jul 18, 2015
1 parent 918096a commit e8ca160
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wilma-functionaltest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
compile "com.epam.gepard:gepard-core:4.0.35"
compile 'commons-httpclient:commons-httpclient:3.1'
compile 'org.custommonkey.xmlunit:com.springsource.org.custommonkey.xmlunit:1.2.0'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'commons-io:commons-io:2.4'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.sun.xml.fastinfoset:FastInfoset:1.2.13'
compile "com.epam.wilma:wilma-mock:$version"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
localhost blocking on && proxy mode and localhost request%http://127.0.0.1:1234/config/public/version%on%proxy%404
localhost blocking on && proxy mode and non-localhost request%http://192.168.1.22:1234/config/public/version%on%proxy%200
localhost blocking on && proxy mode and non-localhost request%http://127.0.1.1:1234/config/public/version%on%proxy%200
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ public void prepareWilmaMockInstance() {
}

@Test
public void getWilmaVersionViaMock() {
public void getWilmaVersionViaAPI() {
JSONObject o = wilmaMock.getVersionInformation();
Assert.assertNotNull(o);
String version = o.getString("wilmaVersion");
logComment("Wilma version detected: " + version);
}

@Test
public void getWilmaLoadInformationViaMock() {
public void getWilmaLoadInformationViaAPI() {
JSONObject o = wilmaMock.getActualLoadInformation();
Assert.assertNotNull(o);
String loggerQueueSize = o.getString("loggerQueueSize");
Integer loggerQueueSize = (Integer) o.get("loggerQueueSize");
logComment("Wilma Logger Queue size is: " + loggerQueueSize);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
Expand All @@ -30,6 +31,7 @@
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -62,7 +64,8 @@ public Optional<String> sendGetterRequest(String url) {
try {
int statusCode = httpclient.executeMethod(method);
if (HttpStatus.SC_OK == statusCode) {
response = method.getResponseBodyAsString();
InputStream inputResponse = method.getResponseBodyAsStream();
response = IOUtils.toString(inputResponse, "UTF-8");
}
} catch (HttpException e) {
LOG.error("Protocol exception occurred when called: " + url, e);
Expand Down

0 comments on commit e8ca160

Please sign in to comment.