Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 20 12:25
    rcolombo commented #656
  • Sep 20 08:42

    jamesdbloom on master

    upgraded version of source plug… updated maven wrapper and maven… (compare)

  • Sep 20 06:01
    jamesdbloom labeled #658
  • Sep 20 06:00
    jamesdbloom assigned #658
  • Sep 20 06:00
    jamesdbloom closed #658
  • Sep 20 06:00
    jamesdbloom commented #658
  • Sep 20 05:52
    jamesdbloom edited #658
  • Sep 20 05:51
    jamesdbloom labeled #656
  • Sep 20 05:51
    jamesdbloom assigned #656
  • Sep 20 05:50
    jamesdbloom closed #656
  • Sep 20 05:50
    jamesdbloom commented #656
  • Sep 20 05:48

    jamesdbloom on master

    #656 increased request log and … (compare)

  • Sep 19 08:46
    wangenxian commented #272
  • Sep 19 08:45
    wangenxian commented #272
  • Sep 19 08:44
    wangenxian commented #272
  • Sep 16 20:33
    yutu3 commented #649
  • Sep 16 20:32
    yutu3 commented #649
  • Sep 16 19:19
    rebelinkedin closed #670
  • Sep 16 19:19
    rebelinkedin commented #670
  • Sep 16 18:59
    rebelinkedin edited #670
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?
shwetha
@shwethakamath_gitlab
I used mockserver with maven and it worked fine.
Now I am trying to use mockserver with the testing tool - Cypress
Installed mockserver and mockserver-client through node,npm
But when i try to start the server, it throws TypeError: fs.readdirSync is not a function
But there is no place where i have worked with fileSystem(fs).
code -
it('try with npm node', ()=>{
var mockserver = require('mockserver-node');
mockserver.start_mockserver({
serverPort:1080,
verbose: true,
trace: true
})
.then(
function(){
console.log("started MockServer");
},
function(error){
console.log(JSON.stringify(error));
}
);
})
Can someone help me out with this please
Khushboo Agrawal
@webkhushboo
Hi I am new to this mock-server . I am trying to implement one request with it . I am able to start the server but when I am trying to HIT the request
Its returning 404
Can someone please help ?
I have raised an issue on github jamesdbloom/mockserver#658 20 days back. I still didn't get any response on it.
Yuriy Olkhovyy
@yolkhovyy
Hi everyone, what's the right way of configuring multiple identical expectations when there are multiple instances of the same test run against a single instance of the MockServer? I am thinking about adding a header with a UUID value, so that the identical expectations do not collide, not sure though if it is the right way of making the identical expectations unique.
Second question - is there a common approach of cleaning up expectations? When a test is finished I'd like to clean all expectations created by that specific test.
Björn Kautler
@Vampire
@kiakimov when you create an expectation, you can say how often it should match, or also to always match.
eagletalon139
@eagletalon139
Hello All, question around mockserver and FIPs. Has anyone gotten this working before? I'm seeing ssl is broken when you try to use FIPs version of bouncycastle with mockserver. Everything else seems fine, but I do not know enough about how all the backend is working to debug this well enough. So any help would be appreciated! Thanks in advance!
yenli1
@yenli1
I use MVN to start the mock service, then how can I write the expected results of the hot interface if I make java? At present, I see the examples you give here all need to restart a mockserver service. It's very urgent. Please see the reply as soon as possible. Thank you very much!!!
eagletalon139
@eagletalon139
Hello again All, I figured out FIPs on mockserver. I will be making a PR to go to the normal repo to try to alleviate this for anyone who might need to have FIPs working with mockserver. Will take me a few days to get it out there, reach out if anyone needs assistance in the mean time.
Uri Berman
@Urik
Hi everyone. I'm configuring MockServer as a standalone process through Docker, using the latest version as of today.
I'm configuring a callback based response using the Node MockServer client.
Afterwards, I call the "reset" function of the client. However, it seems like the WebSocket connection created through "mockWithCallback" keeps existing, because my tests runner (Jest) does not exit, complaining about a persistent connection still existing
Has anyone ran into this issue in the past? I found a GitHub issue complaining about the same thing in the Java client, which was solved, but it seems like the same hasn't happened in the Javascript client
gerry97
@gerry97
Hi Does MockServer support http2.0
lamikam100
@lamikam100
Hi newbie here. Trying to get the examples war file to work. I have it deployed on jboss eap without error, but cannot seem to browse to URL. jboss is running on port 8080. Seeing messages like this on deployment: 2019-09-18 12:45:32,035 WARN [org.springframework.web.servlet.PageNotFound] (default task-1) No mapping found for HTTP request with URI [/mockserver-examples-5.6.2-SNAPSHOT] in DispatcherServlet with name 'dispatcherServlet'
Another newbie question. I need to have a response handler that reads in a template file, replaces some parameters, and return as the html result (in java). I am assuming you have to implement a callback class to do that? thanks!
BruceDMcLeod
@BruceDMcLeod
Good day. Noob question. I'm trying to to run MockServer to record https api calls for later playback. I run java -jar mockserver-netty-5.6.1-jar-with-dependencies.jar -serverPort 4002 -proxyRemoteHost my.dev.server.com -proxyRemotePort 443 but I get a bunch of errors, most of them topped with javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown. I have run scripts/install_ca_certificate.sh. I suspect the hint I need is here: jamesdbloom/mockserver#504, that I should create an expectation that references the host, but I'm not clear how to do that. Is that something like curl -X PUT "http://localhost:4002/mockserver/expectation" -d '{ "httpRequest": { "path": "/" }, "httpForward": { "host": "my.dev.server.com", "port": 443, "scheme": "HTTPS" } }'. Any guidance appreciated
Asif Ameer
@Asif-Ameer-Bose
Hello, I am running mock-server in a performance test where I send in 10000 requests to my AUT. I want to use the mock-server to confirm that 10K downstream calls were made. But I only get a max of 2000 requests reported by mock-server when I query it with verify or when I do a retrieve of requests after the test. Is this 2000 request log limit a hard limit in the mock-server?