Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 30 09:18

    jamesdbloom on master

    called MatchDifference context … reduce log level of socket clos… stopped TRACE level events from… and 1 more (compare)

  • Oct 30 08:32
    jamesdbloom labeled #871
  • Oct 30 08:32
    jamesdbloom commented #871
  • Oct 30 08:19
    jamesdbloom labeled #871
  • Oct 30 08:19
    jamesdbloom assigned #871
  • Oct 30 05:50

    jamesdbloom on master

    added --create-namespace to hel… Merge branch 'master' into mast… Merge pull request #803 from su… (compare)

  • Oct 30 05:50
    jamesdbloom closed #803
  • Oct 29 19:31
    survivant commented #803
  • Oct 28 07:13

    dependabot[bot] on maven

    (compare)

  • Oct 28 07:13

    jamesdbloom on master

    Bump spring.version from 5.2.9.… (compare)

  • Oct 28 07:13
    jamesdbloom closed #905
  • Oct 28 07:01
    dependabot[bot] synchronize #905
  • Oct 28 07:01

    dependabot[bot] on maven

    Bump spring.version from 5.2.9.… (compare)

  • Oct 28 06:31

    dependabot[bot] on maven

    (compare)

  • Oct 28 06:31

    jamesdbloom on master

    Bump mockito.version from 3.5.1… (compare)

  • Oct 28 06:31
    jamesdbloom closed #902
  • Oct 28 05:26
    dependabot[bot] labeled #905
  • Oct 28 05:26
    dependabot[bot] labeled #905
  • Oct 28 05:26
    dependabot[bot] opened #905
  • Oct 28 05:26

    dependabot[bot] on maven

    Bump spring.version from 5.2.9.… (compare)

PetersonZhang
@PetersonZhang
anyone here?
Rajendra Prasad Reddy Penumalli
@rajendrapenumalli
How to add an expectation ( via REST interface) to match certain headers and and ignoring any other headers ? Is it possible? I don't find this example or capability for mock server for this feature.
James D Bloom
@jamesdbloom
@/all This chat group is migrating to Slack if you would like to join the new Slack group please use the following link https://join.slack.com/t/mock-server/shared_invite/enQtODM3NDY0NzA1NTQwLWM0NTFmOGJhN2ExNTViNDRmZjk0MDgyOGNmNDU0YjE3YzZhNjBjMmM5Y2FlYTI1ZmJhNzNkMWJkMTE5ZTRlZjM
There will in due course be an auto-join page but for now the two ways to join the new slack group is to either use this link https://join.slack.com/t/mock-server/shared_invite/enQtODM3NDY0NzA1NTQwLWM0NTFmOGJhN2ExNTViNDRmZjk0MDgyOGNmNDU0YjE3YzZhNjBjMmM5Y2FlYTI1ZmJhNzNkMWJkMTE5ZTRlZjM which expires in 30 days or send an email to join.mock.server@gmail.com
Parag Somani
@paragsomani

Hello @jamesdbloom

I was able to run the mock-server successfully using docker container. I was able to create expectation and access via REST interface successfully.

Can you assist, how can i persist created expectation, so that even after restart, i should be able to access them.

P.S. I have tried mounting volume to docker container, but did not have luck. Looks like i am missing something.

James D Bloom
@jamesdbloom
@/all @paragsomani This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join.slack.com/t/mock-server/shared_invite/enQtODM3NDY0NzA1NTQwLWM0NTFmOGJhN2ExNTViNDRmZjk0MDgyOGNmNDU0YjE3YzZhNjBjMmM5Y2FlYTI1ZmJhNzNkMWJkMTE5ZTRlZjM
James D Bloom
@jamesdbloom
@paragsomani there is no current support for persisting expectations because typically MockServer expectations are created inside the test using them, long-running expectations is an anti-pattern for tests because this introduces coupling and break encapsulation making those tests more complex and harder to debug, there, however, other use cases where persisted expectations could help, such as when a service is not yet available but integration development can't wait, so this item is on the backlog: https://trello.com/c/qOgJgBee/26-persistence-expectations to persistence expectations
Parag Somani
@paragsomani
thank you @jamesdbloom
Chr3is
@Chr3is
Hey, I'm using the mockserver to return an xml response with a custom mediatype. The xml has the encoding flag utf8. Everything is working fine if the contenttype is declared as application/xml. However if you use application/my.type+xml I'm receiving a RuntimeException (java.lang.RuntimeException: [was class java.io.CharConversionException] Invalid UTF-8 middle byte 0x4c (at char #961, byte #54)). The mockserver does not return the xml utf8 encoded. If you add the charset=utf8 to the custom mediatype it is working again. I think the mockserver should support the mediatye application/*+xml.
James D Bloom
@jamesdbloom
@Chr3is This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join.slack.com/t/mock-server/shared_invite/enQtODM3NDY0NzA1NTQwLWM0NTFmOGJhN2ExNTViNDRmZjk0MDgyOGNmNDU0YjE3YzZhNjBjMmM5Y2FlYTI1ZmJhNzNkMWJkMTE5ZTRlZjM
@Chr3is which version of MockServer are you using? I have just improved the handling of content-type header formats, but it would be good to ensure there is a test covering your exact format. Can you please tell the exact string your using for content-type?
James D Bloom
@jamesdbloom
@Chr3is the new parsing logic can happily handle application/my.type+xml, application/my.type+xml;charset=utf-8 or application/my.type+xml; Charset="utf-8" without any issue
this logic is available in version 5.8.0 (the latest version)
Chr3is
@Chr3is
And the response is utf8 encoded? The spring web client who handled the response had the problem if the xml string I wanted to return contained chars like the german Ö or Ä. The media type was something like application/my.company.userdata+xml
@jamesdbloom I will take a look at the version tomorrow
James D Bloom
@jamesdbloom
@Chr3is If you still having any issue please respond on Slack and also provide the MockServer log output so I can see what is happening.
Chr3is
@Chr3is
Will do this tomorrow at work. We compared the response in an hex editor and the Ö wasnt utf8 encoded which leaded to the CharConversionException
Evan Brodie
@ecbrodie

Hello Mockserver community.

I would like to know if it is possible to build a Mockserver Expectation where a value of the HTTP Response can be dynamically created based on a value from the HTTP Request. I'm thinking something like capturing a regex match from the request and putting that captured value into the response.

My use case is that I want to match all requests to a particular route, but I want to capture the query parameters. I then want to be able to have these query parameters stored in an HTTP header in my response (in my specific case, the Location header).

Is this currently possible in Mockserver? I am using the API client right now. Thank you.

James D Bloom
@jamesdbloom
@ecbrodie This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join.slack.com/t/mock-server/shared_invite/enQtODM3NDY0NzA1NTQwLWM0NTFmOGJhN2ExNTViNDRmZjk0MDgyOGNmNDU0YjE3YzZhNjBjMmM5Y2FlYTI1ZmJhNzNkMWJkMTE5ZTRlZjM
June
@JuneWangC
Hello Mockserver community, I am new to MockServer and new to java. I have been trying to initialize expectations using the initializationClass configuration property 'java -Dmockserver.initializationClass="org.mockserver.server.initialize.ExpectationInitializerExample" -jar ~/Downloads/mockserver-netty-5.9.0-jar-with-dependencies.jar -serverPort 1080 -logLevel INFO', I have changed the path to jar to my local path, but did not change the initializationClass, I got an error 'java.lang.RuntimeException: java.lang.ClassNotFoundException: ExpectationInitializerIntegrationExample'. What should I do to fix this? Thanks!
James D Bloom
@jamesdbloom
@JuneWangC This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join.slack.com/t/mock-server/shared_invite/enQtODM3NDY0NzA1NTQwLWM0NTFmOGJhN2ExNTViNDRmZjk0MDgyOGNmNDU0YjE3YzZhNjBjMmM5Y2FlYTI1ZmJhNzNkMWJkMTE5ZTRlZjM
@JuneWangC you can only use an initializationClass if it is in the classpath of the JVM otherwise it won't be visible to MockServer, if you run MockServer in embedded mode using the org.mockserver.integration.ClientAndServer class from within the same project containing the initialiser then you should find that easier, see: https://mock-server.com/mock_server/running_mock_server.html#client_api
June
@JuneWangC
@jamesdbloom Thanks for answering, I have joined the Slack group, thank you
haripri-vt
@haripri-vt

Hello I am getting closed web socket connection the very first time the tests are run on a linux machine,
ed-api_1 | 2020-03-20 16:27:17 org.mockserver.log.MockServerEventLog WARNING Client 26f5fe02-ef57-488f-bc8f-74b6c8d118df not found for request ed-api_1 | ed-api_1 | { ed-api_1 | "method" : "GET", ed-api_1 | "path" : "/ws/v1/persons", ed-api_1 | "queryStringParameters" : { ed-api_1 | "uupid" : [ "alice" ] ed-api_1 | }, ed-api_1 | "headers" : { ed-api_1 | "accept-encoding" : [ "gzip" ], ed-api_1 | "user-agent" : [ "ReactorNetty/0.8.12.RELEASE" ], ed-api_1 | "host" : [ "ed-api:1080" ], ed-api_1 | "accept" : [ "*/*" ], ed-api_1 | "content-length" : [ "0" ], ed-api_1 | "WebSocketCorrelationId" : [ "bcf16e0e-035a-426f-8629-e1c35a9125ac" ] ed-api_1 | }, ed-api_1 | "keepAlive" : true, ed-api_1 | "secure" : false ed-api_1 | } ed-api_1 | ed-api_1 | client registry only contains ed-api_1 | ed-api_1 | {26f5fe02-ef57-488f-bc8f-74b6c8d118df=ChannelHandlerContext(CallbackWebSocketServerHandler#0, [id: 0x61d82abe, L:ed-api/192.168.32.4:1080 - R:/192.168.32.6:48448]), 1ae4ae2c-d978-4cb1-9697-167016647d96=ChannelHandlerContext(CallbackWebSocketServerHandler#0, [id: 0xca1b173c, L:ed-api/192.168.32.4:1080 - R:/192.168.32.6:48446]), 8f41ac93-f5f0-4033-8e27-4bd927bae4f0=ChannelHandlerContext(CallbackWebSocketServerHandler#0, [id: 0xb391485f, L:ed-api/192.168.32.4:1080 - R:/192.168.32.6:48444])} ed-api_1 | ed-api_1 | 2020-03-20 16:27:17 org.mockserver.log.MockServerEventLog WARNING Returning ed-api_1 | ed-api_1 | { ed-api_1 | "statusCode" : 404, ed-api_1 | "reasonPhrase" : "Not Found" ed-api_1 | } ed-api_1 | ed-api_1 | because client 26f5fe02-ef57-488f-bc8f-74b6c8d118df has closed web socket connection ed-api_1 | 2020-03-20 16:27:17 org.mockserver.log.MockServerEventLog INFO returning response:

So even though the match was found, im getting a 404, because of this, happens only the first time, and runs fine the second time. Any idea why this might happen?

James D Bloom
@jamesdbloom
@haripri-vt This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
HarryHoudini
@HarryHoudini
Hi everyone. I get a timeout error trying to get requests on the following code from the examples. I increased the timeout to 60 sec set through ConfigurationProperties.maxSocketTimeout, but it did not help
Code:
HttpRequest[] recordedRequests = new MockServerClient("serverIp", 1080) .retrieveRecordedRequests( request() );
error:
[ERROR] Time elapsed: 42.308 s <<< FAILURE!
org.mockserver.client.SocketCommunicationException: Response was not received from MockServer after 35000 milliseconds, to wait longer please use "mockserver.maxSocketTimeout" system property or ConfigurationProperties.maxSocketTimeout(long milliseconds)
But getting the same information through api works - checked in postman. http://serverIp:1080/mockserver/retrieve?type=REQUESTS
What could be the problem?
James D Bloom
@jamesdbloom
@HarryHoudini This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
Robertino Aniello
@raniello
Hi, what's the difference on docker hub between mockserver/mockserver repository and jamesbloom/mockserver repository? Which one should I use? Both refers to the same documentation but the documentation refers to mockserver/mockserver even if the latter has 1M+ pulls agains 100K+ of the official one
Julian B.
@jubui
Hi everyone, I'm using MockServer to mock 50MB json responses. After a fixed number of responses (iirc ~25 responses), MockServer responds with 404 and then a short while later I get "Exception in thread "MockServer-EventLog0" java.lang.OutOfMemoryError: Java heap space". My mock is using a callback with a fixed static buffer, so I'm not creating it at every invocation of the callback. Is there something simple I can do to avoid this? MockServer is in a separate process, right? So how can I, from my junit rule, configure the heap size of the other process? Or is there something I can do to optimize the memory usage?
vivekmalhotragithub
@vivekmalhotragithub
hi I created an expectation that mock-server gets a POST request with a gzipped body but when i actually send it a gzipped body the expectation fails. I also dont see my content-type : gzip header in mock-server logs. Is it because mock-server automatically unzips the body ?
Hem Chand
@versatile-hem

0

I am facing an issue in apache http configuration.

Requirement :

A request has land on apache with some header.

for example :

Header myToken

Url https://localhost/fetch-r

Response new Url https://localhost/fetch-r?id=myToken

How can i achieve this in Apache Http 2.4 ?

can any one help me here ?
James D Bloom
@jamesdbloom
@raniello This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@jubui This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@vivekmalhotragithub This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@versatile-hem This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@/all This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
kapokmi
@kapokmi

@here, For an integration test, I am running 5 services, mocked using mockserver by spinning them up with docker compose. Here is my docker compose file:

version: "3.7"
services:
  order-management-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    command: -logLevel DEBUG -serverPort 1080
    ports:
      - ${ORDER_MGMT_PORT}:1080
    networks:
      - default
  location-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${LOCATION_PORT}:1080
    networks:
      - default
  availability-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${AVAILABILITY_PORT}:1080
    networks:
      - default
  supplier-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${SUPPLIER_PORT}:1080
    networks:
      - default
  content-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${CONTENT_PORT}:1080
    networks:
      - default

networks:
  default:
    name: integration-test-network

I would like to get the logs of order-management-webapp for which I have increased the log level. How can I do that please?
The mockserver doc does not provide any details on getting logs when using docker-compose and I am very new to Mockserver. Thanks in advance for your answers!

James D Bloom
@jamesdbloom
@kapokmi This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@kapokmi the logs get printed out on the console so your’l need to look at the console logs for that container using docker-compose
sarut0bi
@sarut0bi
hi, i am using mockServer.mockServerClient javascript client, my instance of mockserver is running behind an api proxy which needs extra authentification header, any way to use the javascript client in this case?
James D Bloom
@jamesdbloom
@sarut0bi This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@sarut0bi I think the setDefaultHeaders() function on the client should allow you to do what you need to set some default headers for proxy authentication
Java Auto QA Tools
@jaqat
изображение.png
Hi all. There is a problem with cast RequestDefinition to HttpRequest in latest Java Client lib
James D Bloom
@jamesdbloom
@jaqat This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@jaqat you can't cast an array in java, you need to do something like the following Arrays.stream(requests).map(HttpRequest.class::cast).toArray(HttpRequest[]::new)
Paul Fortin
@pfortin-urbn
I need to take the input request parse it and use some of that data in the response. I have not seen any examples of how to do that I was wondering if there is one or oen could be provided please?
Paul Fortin
@pfortin-urbn
BTW I am using python/tavern to test my APIs with mock server and the API creates some data and passes it to mockserver which will use it to create a response...