Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:05
    jmini edited #663
  • 09:04
    jmini opened #663
  • Aug 19 08:22
    marcelmu commented #600
  • Aug 15 14:31
    gznglor commented #600
  • Aug 14 09:50
    sileht edited #662
  • Aug 14 09:50
    sileht synchronize #662
  • Aug 14 09:49
    sileht synchronize #662
  • Aug 14 09:48
    sileht opened #662
  • Aug 14 09:34
    sileht opened #661
  • Aug 12 18:04
    rcolombo commented #656
  • Aug 12 18:00
    rcolombo commented #656
  • Aug 08 01:05
    chomatdam commented #357
  • Aug 08 01:05
    chomatdam commented #357
  • Aug 07 22:01
    qinfchen edited #660
  • Aug 07 22:01
    qinfchen opened #660
  • Aug 07 16:11
    sankintoo opened #659
  • Aug 07 03:35
    AngleZhou commented #652
  • Aug 07 03:16
    AngleZhou commented #652
  • Aug 07 03:06
    AngleZhou commented #652
  • Aug 06 11:02
    webkhushboo opened #658
Björn Kautler
@Vampire
No
芝麻谷
@woshihoujinxin
Hello everybody
Fernando Cruz
@b0gg4rd
Hi
William Lightning
@fuel-wlightning
I have a MockServer that when I rapidly submit multiple (~20) REST calls containing small PDFs quickly balloons in memory to over 6GB of memory usage. Is there any advice that I can get on reducing that, maybe some way to turn off logging of specific request body parts
Narimm
@Narimm
Hi there having a bit of trouble getting started with MockServer..
public class TestSlackServer extends MockServerClient{
    public TestSlackServer(){
        super("127.0.0.1",1080,"/api/");
        this.addResponse(SlackConstants.AUTH_TEST,"{\"ok\":\"true\"}");
    }

    public MockServerClient addResponse(final SlackConstants constants,final String response) {
        this
                .when(HttpRequest
                        .request()
                        .withPath(constants.toString())
                        .withHeader("Authorization", "Bearer " + SlackAPITest.token)
                )
                .respond(
                        HttpResponse
                                .response()
                                .withStatusCode(200)
                                .withBody(response)
                );
        return this;
    }

}
Thats my setup class for creating a fake rest endpoint for a test to call .....but it throws an exception on the addresponse(String,String) method...
the exception is org.mockserver.client.SocketConnectionException: Channel closed before valid response has been received
<dependency> <groupId>org.eclipse.jetty.websocket</groupId> <artifactId>websocket-client</artifactId> <version>9.4.19.v20190610</version> <scope>compile</scope> </dependency> is my dependency
Narimm
@Narimm
oh sorry no <groupId>org.mock-server</groupId> <artifactId>mockserver-netty</artifactId> <version>5.6.0</version> <scope>test</scope>
is the correct one
haim
@haim
Hi!
i faced with "WebSocket connection to 'wss://localhost:1080/_mockserver_ui_websocket' failed: Error in connection establishment: net::ERR_CERT_AUTHORITY_INVALID" on page "http://localhost:1080/mockserver/dashboard". How i can solve this issue ?
William Lightning
@fuel-wlightning

@haim I use an nginx proxy with a valid SSL in front of it which is what I did in https://github.com/kassah/mockserver-pres

Relates to this Issue: jamesdbloom/mockserver#584

Alternatively, you can add trust of the mockserver CA in your local browser. Which I do not recommend. This SSL is available at: https://github.com/jamesdbloom/mockserver/tree/master/mockserver-core/src/main/resources/org/mockserver/socket I use this in my presentation to make the PHP trust MockServer. I wouldn't want my local browser to trust that though.

haim
@haim
second case success. Thanks!
bala
@Nithiyakrish_twitter
Hi, I am new to this group. trying to mock the multiple services for integration testing. I couldn't find the correct way to start my application. can anyone help me here??
Trying in Java script
Screen Shot 2019-07-09 at 11.26.32 AM.png
do we have any recorder facility to find the request??
bala
@Nithiyakrish_twitter
Can't connect to MockServer running on host: "localhost" and port: "1080"
Jonathan Vila
@jonathanvila
Hi, is there any option to make MockServer to respond with a file ? for the moment I'm doing : .withBody(IOUtils.toString(EndToEndIT.class.getClassLoader().getResourceAsStream("cloudforms-export-v1.tar.gz"), StandardCharsets.UTF_8)));
Jonathan Vila
@jonathanvila
Hi, I've trying with a ByteArray , but I still have the same issue
Jonathan Vila
@jonathanvila
tbh, I dont find the way to download a file
I have a simple expectation :
                                .withPath("/insights-upload-perm-test2"))
                        .respond(myrequest -> {
                            try {
                                return response()
                                        .withHeader("Content-Type", "application/zip")
                                        .withBody(new BinaryBody(IOUtils.resourceToByteArray("platform.upload.xavier.json.gz", EndToEndIT.class.getClassLoader())));
                            } catch (IOException e) {
                                return notFoundResponse();
                            }
                        });
and this is the client
InputStream outputStream = new RestTemplate().postForObject("http://localhost:8000/insights-upload-perm-test2", "", ByteArrayInputStream.class);
        GZIPInputStream gzipInputStream = new GZIPInputStream(outputStream);
        System.out.println(" Descarga : " + IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8));
it complains with : org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class java.io.ByteArrayInputStream] and content type [application/zip]
Jonathan Vila
@jonathanvila
        List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
        messageConverters.add(new ByteArrayHttpMessageConverter());
        HttpHeaders headers = new HttpHeaders();
        headers.setAccept(Arrays.asList(MediaType.APPLICATION_OCTET_STREAM));
        HttpEntity<String> entity = new HttpEntity<String>(headers);
        ResponseEntity<byte[]> outputStream = new RestTemplate(messageConverters).exchange("http://localhost:8000/insights-upload-perm-test2", HttpMethod.GET, entity, byte[].class, "1");
        GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(outputStream.getBody()));
        System.out.println(" Descarga : " + IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8));
Lasse Benn Nørregaard
@lassebn
@jonathanvila I don’t know how you’re running WireMock, but have you looked at this: http://wiremock.org/docs/stubbing/#file-serving?
Jonathan Vila
@jonathanvila
Hi @lassebn , I gave up on WireMock because the issues with Spring Boot.... now I'm using mock-server that works perfectly well..... but, I'm having an issue in the way of serving a file
@jamesdbloom I've tried today and if I point my Camel application to download a zip file from internet ( random web page serving a zip file https://file-examples.com/wp-content/uploads/2017/02/zip_2MB.zip ) it works fine with current code, but doing the above approach with mock-server creates some kind of issues on the type conversion
Lasse Benn Nørregaard
@lassebn
@jonathanvila Sorry, I confused myself thinking this channel was for WireMock.
Jonathan Vila
@jonathanvila
:)
Jonathan Vila
@jonathanvila
@jamesdbloom Fixed..... I have added (and calculated) the Content-length header and everything worked fine. :)
browerjs
@browerjs
Do i need to do anything special to get the UI to work? I go to http://localhost:1080/mockserver/dashboard and don't see any of the logs/active expectations/etc.
Tim Dolgov
@tdolgov
I have a problem help. I do not understand how to make it work! If there are no mocks, so that there is a redirection to normal integration. And if there are mocks to respond to them.
William Lightning
@fuel-wlightning
@browerjs The UI only works on https:// and your browser trusts the MockServer CA
browerjs
@browerjs
@jamesdbloom Is it possible to use org.mockserver.client.initialize.ExpectationInitializer when running the server from the docker container?
browerjs
@browerjs
nevermind, i was able to get it to work with the server package
Maciej Gunia
@maciejgunia
hey guys, trying to use mockserver-node alongside mockserver-client on my dev environment it works fine but in docker i get Error: spawn java ENOENT. Do I really need to install java inside the container? I had the impression that the node package should do that for me?
Marko Sertic
@Mark0Sertic
Hi, could anyone help me with my question ? I have noticed that when I set mockserver in my test, and uses lets say Future .get() to block execution until i get response from mockserver(because i am using async-http client but i need this part of code to be synchronous ). Test hangs until async-client timeouts. I have also use isDone() method to check if i will ever get response back, but it seems that for some reason mockserver doesn't return anything. Question is why is this happening and if there is a way to avoid such behaviour ? Also when i tried to lets say call real endpoint i Future .get() returns result perfectly fine, but i need wiremock for testing and this kinds of test just hangs until timeout on Future .get() call.
Alex Skrypnyk
@alexdesignworks
Hi, is there a /version or other endpoint that can be used as a probe that the Mockserver is up and running?
Rahul-Bhargav
@Rahul-Bhargav
@alexdesignworks You can just create an expectation for that, but I do realize the use case for that.
Alex Skrypnyk
@alexdesignworks

yeah, this is what I do - create a GET expectation /selftest and call it. But this means that all helping functions that create such expectations in my framework should work correctly. Having /mockserver/version and CURL'ing it would be a much easier way to make sure that the server is running.

Thank you @Rahul-Bhargav

gkrananth
@gkrananth
Hi everyone
i don't know how to run the examples which is available in examples
i ran the jar file using java -jar mockserver-netty-5.6.2-SNAPSHOT-jar-with-dependencies.jar --serverPort 1080 --debugLevel DEBUG
lamikam100
@lamikam100
I am having an issue with responses. If my response text has a linefeed between elements, the program will not run:
"httpResponse" : {
"body" : '<test>
</test>'
}
If the response is on one line it works. Why?
"httpResponse" : {
"body" : '<test></test>'
}
gkrananth
@gkrananth
i need to response as a json file when trigger http://localhost:1800/api/v1/offlinedata
how to do anyone can help me out?