|
|
@ -9,18 +9,30 @@ import exchange.ExchangeMock;
|
|
|
|
|
|
|
|
|
|
|
|
public class UserMock extends ActorRunnable {
|
|
|
|
public class UserMock extends ActorRunnable {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String longRequest;
|
|
|
|
|
|
|
|
|
|
|
|
int requestCount = 0;
|
|
|
|
int requestCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
public UserMock(MockSet mockSet){
|
|
|
|
public UserMock(MockSet mockSet){
|
|
|
|
super(mockSet);
|
|
|
|
super(mockSet);
|
|
|
|
mockSet.userMock = this;
|
|
|
|
mockSet.userMock = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
for (int i=0;i<100;i++){
|
|
|
|
|
|
|
|
sb.append("foo");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
longRequest = sb.toString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|
while (true){
|
|
|
|
while (true){
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Thread.sleep(Main.WAIT_SPEED);
|
|
|
|
|
|
|
|
sendGetRequest();
|
|
|
|
sendGetRequest();
|
|
|
|
} catch (IOException | InterruptedException e) {
|
|
|
|
} catch (IOException | InterruptedException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
e.printStackTrace();
|
|
|
@ -52,6 +64,8 @@ public class UserMock extends ActorRunnable {
|
|
|
|
|
|
|
|
|
|
|
|
exchange.request.setMethod("GET");
|
|
|
|
exchange.request.setMethod("GET");
|
|
|
|
//exchange.request.setContentType("application/json");
|
|
|
|
//exchange.request.setContentType("application/json");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//String requestBody = longRequest+"-"+(++requestCount);
|
|
|
|
String requestBody = "REQUEST-"+(++requestCount);
|
|
|
|
String requestBody = "REQUEST-"+(++requestCount);
|
|
|
|
String jsonString = "{\"request\":\""+requestBody+ "\"}";
|
|
|
|
String jsonString = "{\"request\":\""+requestBody+ "\"}";
|
|
|
|
exchange.request.setContent(jsonString.getBytes());
|
|
|
|
exchange.request.setContent(jsonString.getBytes());
|
|
|
@ -64,7 +78,7 @@ public class UserMock extends ActorRunnable {
|
|
|
|
|
|
|
|
|
|
|
|
// handle OK (Data)
|
|
|
|
// handle OK (Data)
|
|
|
|
String data = exchange.response.getContentAsString();
|
|
|
|
String data = exchange.response.getContentAsString();
|
|
|
|
System.out.println(data + " of REQUEST-"+requestCount);
|
|
|
|
System.out.println(data + " of "+requestBody);
|
|
|
|
exchange.notify();
|
|
|
|
exchange.notify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|