Coder Social home page Coder Social logo

mock-server / mockserver-client-node Goto Github PK

View Code? Open in Web Editor NEW
72.0 4.0 33.0 3.22 MB

MockServer javascript client for browsers, Node.js or any grunt build

Home Page: http://mock-server.com

License: Apache License 2.0

JavaScript 98.40% HTML 0.10% Shell 0.87% TypeScript 0.63%
mock-server proxy java-client javascript-client node-module node-client ruby-client grunt-plugin

mockserver-client-node's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mockserver-client-node's Issues

Breaking backwards compatibility on v1.0.13

The changes related to v1.0.13 made a breaking change to the public API. Refer to here and here.

The function mockAnyResponse was changed to mockAnyExpectation, breaking any old client code that isn't locked in to v1.0.12 or lower. It is not appropriate to make a breaking change to the public API on a patch per semantic versioning rules. The mockAnyResponse function could be added back to the API and can simply alias mockAnyExpectation.

Cannot read properties of undefined (reading 'startsWith')

Version: 5.13.2
Setup: Running the mockserver client in cypress against a mockserver docker container

Logs

cypress_1     |        "after each" hook for "gets location information by latitude and longitude: unauthorised":
cypress_1     |      TypeError: Cannot read properties of undefined (reading 'startsWith')
cypress_1     |
cypress_1     | Because this error occurred during a `after each` hook we are skipping the remaining tests in the current suite: `A reverse geocode`
cypress_1     |       at makeRequest (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:9335:91)
cypress_1     |       at Object.reset (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:9959:20)
cypress_1     |       at eval (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:8836:53)
cypress_1     |       at step (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:8820:23)
cypress_1     |       at Object.eval [as next] (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:8801:53)
cypress_1     |       at eval (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:8795:71)
cypress_1     |       at new Promise (<anonymous>)
cypress_1     |       at ./cypress/integration/reverse-geocode.spec.ts.__awaiter (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:8791:12)
cypress_1     |       at Context.eval (http://app:9014/__cypress/tests?p=cypress/integration/reverse-geocode.spec.ts:8833:36)
cypress_1     |

It looks like there is a fix for this in master, but no release has been done for several months.

Would it be possible to publish a new version?

Cannot install this version 5.11.2

Describe the issue
Cannot install, get ncp error

What you are trying to do
npm install mockserver-client
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm ERR! code E404
npm ERR! 404 Not Found - GET ******* /ncp/-/ncp-0.5.1.tgz
npm ERR! 404
npm ERR! 404 '[email protected]' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'grunt-ts'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

MockServer version
5.11.2

Any method of mockserverclient returns 404 when mockserver is deployed as war

Describe the issue
Deployed a mockserver as a war. Create a instance of mockserver client like a

mockServerClient('myhost', 443, '/myContextPath',true,'mypem.pem')

When execute any method of the client, it returns a 404 status code.

That is because the "contextParam"

mockServerClient = function (host, port, contextPath, tls, caCertPemFilePath) {
is not being used when the URL is made for any method. It doesn't append the contextParam

What you are trying to do
I'm trying to execute any method of the client when the mockserver is deployed as a war

MockServer version
5.11.1

To Reproduce
Steps to reproduce the issue:

  1. Deployed mockserver as war
  2. Create a instance of mockserverclient. Exampple:
    mockServerClient =mockServerClient('myhost', 443, '/myContextPath',true,'mypem.pem')
  3. Execute any method of this client. Example:
    mockServerClient.reset();

Is there any documentation for creating an expectation with complex api request?

Describe the issue
I am an Android developer and I don't have all the services ready yet, so I thought to use any mock-server. Someone suggested me this. So my plan is like recording a demo by just mocking some APIs with mocked data.
Is mock-server the right choice for this? I have spent much time and I am still struggling to understand this. Anyway, I have created a mock-server with a simple API but in my actual case, I have some complex APIs with parameters, file attachments, OAuth2.0 login, etc.

  • How to create an expectation for a complex API for example-

GET /mysite/api/public/v1/pets/{petId}/categories/users/{userId}

  • How to mock OAuth2.0 with our mock-server? I didn't find any documentation.

What you are trying to do
I want to set some expectations/ mock apis so that I can post/ get/ petch some data using my android app for the demo purpose.

MockServer version
I am trying with latest version - 5.11.0

To Reproduce
I tried with node js code -
mockServerClient("localhost", 1080) .mockSimpleResponse('/somePath', { name: 'value' }, 203) .then( function(result) { // do something next console.log("Sample success ", result); }, function(error) { // handle error console.log("Sample Error ", error); } );

Expected behaviour
I have API endpoints with JSON request/ response, I want when I do POST it save the data, and when I use GET it should return the recently posted data.

MockServerClient.clearById typescript definition incorrect

Describe the issue
When using MockServerClient.clearById a rest api error is returned.

What you are trying to do
clear an expectation by id

MockServer version
5.14.0

To Reproduce

  1. How you are running MockServer
    Docker

  2. Code you used to create expectations

const client = mockServerClient(mockServerHost, mockServerPort);
const value = await client.mockAnyResponse();
client.clearById({ id: value[0].id },"ALL");
  1. What error you saw

image

Expected behaviour
The expectation is cleared. The typescript definition is expecting an object with an id. However if you check mockServerClient.js it is creating an object and nesting the passed in expectationid and incorrectly creating the request.

image

image

MockServer Log
See above

`verifyById` is not a function

Describe the issue
When trying to verify an expectation by expectation ID getting an error.

What you are trying to do
Trying to verify an expectation by ID.

MockServer version
5.12.0

To Reproduce

In test:

const client = mockServerClient('127.0.0.1', 1080)
const res = await client.mockAnyResponse(//***//)
const expectationId = JSON.parse(res['body'])[0].id

//later:
await client.verifyById({ id: expectationId }, 1)

Furthermore:

console.log(client.verifyById) //=> undefined
  1. How you are running MockServer (i.e maven plugin, docker, etc): docker
  2. Code you used to create expectations: see above
  3. What error you saw: TypeError: client.verifyById is not a function

Expected behaviour
Expectation is verified correctly

MockServer Log
N/A

Support for https

We use the mock-server behind a proxy with https. At the moment the client does not support https.

We made a fork with a patch for this, see mgijsbertihodenpijl#1.

Is it possible to build support for https in the near future ?

Using in browser: fs.existsSync is not a function

Describe the issue
When I try to use mockserver-client-node in the browser, I get the error:

fs.existsSync is not a function

This is because the check to distinguish browser from node.js environment does not consider browser bundle build systems (i.e., using require or import in browser-based environments), which is common practice by now.

What you are trying to do
I want to use mockserver in Cypress.io end-to-end tests. To dynamically set my mocks depending on the tests I am running, I want to use mockserver-client-node. In Cypress, we can easily require or import CommonJS modules which are then transpiled to run in the browser, but we cannot easily add a script tag to the page.

MockServer version
latest (5.11.1)

To Reproduce
Steps to reproduce the issue:

  1. I use MockServer in a Docker container, and Cypress with mockserver-client-node installed in another container
  2. Code:
// In the cypress container in commands.js
// or, alternatively, in any browser-based JS application that is built with Webpack etc.
import { mockServerClient } from 'mockserver-client'
mockServerClient("e2e-mock", 1080)
    .mockAnyResponse({...})
  1. Error message:
fs.existsSync is not a function
node_modules/mockserver-client/sendRequest.js:31:1

Expected behaviour
I expected the check in https://github.com/mock-server/mockserver-client-node/blob/master/mockServerClient.js#L27 to detect that I am running in a browser and use the XHR-based makeRequest function instead of require('./sendRequest').sendRequest(tls, caCertPemFilePath).

MockServer Log
Not relevant, as it doesn't get far enough to talk to MockServer

1.0.16 is not released to NPM

Currently (2017-06-02) version 1.0.15 is the latest at the npm registry. That one still has the dependency on grunt which is supposed to be fixed in 1.0.16 according to the README. However, it seems that 1.0.16 hasn't been pushed to NPM

Incorrect type definition for verifySequence

Describe the issue
verifySequence expects a list of request definitions, but the TypeScript type definition looks like this:
verifySequence(matchers: RequestDefinition[]): Promise<void | string>;.

If I pass an array as an argument, I get this error from MockServer:

Error: Failed: "1 error:
 - instance type (array) does not match any allowed primitive type (allowed: [\"object\"]) for field \"/httpRequests/0\"

See: https://app.swaggerhub.com/apis/jamesdbloom/mock-server-openapi/5.10.x for OpenAPI Specification"`

MockServer version
5.10.0

To Reproduce
Call verifySequence with an array.

mockServerClient("localhost", 1080)
      .verifySequence([
        {
          'method': 'POST',
          'path': '/somePathOne',
          'body': 'someBody'
        },
        {
          'method': 'GET',
          'path': '/somePathTwo'
        }
      ])

Solution idea
Change the type definition so matchers is a rest parameter:

verifySequence(...matchers: RequestDefinition[]): Promise<void | string>;

https support

Hi,

We made a setup in AWS Fargate which enables us to provide end point of mock-server to different teams. The end point runs for security reason with https. With the Java client we use the .withSecure(true) option to start the mockServerClient (for example new MockServerClient(MOCK_SERVER, MOCK_SERVER_PORT).withSecure(true)).

But another team uses node.js and not Java. I tried to find an example or a similar option in the mockserver-client-node but I could not find it. Can you give us an example how to start the mock with mockServerClient("https://endpoint-mock-server", 443).mockAnyResponse( ... for a secure https connection ?

Thanks,
Martijn Gijsberti Hodenpijl
Software engineer Schuberg Philis
(https://schubergphilis.com/)

OpenApi with swagger is not returns the correct defined response.

Describe the issue
Not getting proper response which defined into my swagger schema, I think it's not mapping the defined references of response object.
It's always returns the same value in case of GET, PUT,POST for any end points( ideally it should return the values as defined into swagger schema response part)

What you are trying to do
I want to get mock response by calling defined openApI expectation. It's matching fine with expectation but not giving the response defined schema.

MockServer version
5.11.0

To Reproduce
Steps to reproduce the issue:

  1. I am using node client and running from grunt start_mockserver command.

  2. Code you used to create expectations
    example_failing.zip

function matchRequestByOpenAPIOperation() {
    var mockServerClient = require('mockserver-client').mockServerClient;
    mockServerClient("localhost", 1080).openAPIExpectation({
        "specUrlOrPayload": "/mockserver-client-node/examples/openapi_expectations_examples/swager.json"
    }).then(
        function () {
            console.log("expectation created");
        },
        function (error) {
            console.log(error);
        }
    );
}
  1. What error you saw
    I am not getting any error but all the time getting same response( in case of GET, PUT,POST).

Expected behaviour
In case of success :
it should map with swagger response 200 schema properly. For example see below response.

responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "properties": {
                "results": {
                  "type": "array",
                  "items": {
                    "$ref": "#/definitions/FileAttachment"
                  }
                }
              },
              "required": [
                "results"
              ]
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "$ref": "#/definitions/RestException"
            }
          },
          "403": {
            "description": "Forbidden",
            "schema": {
              "$ref": "#/definitions/RestException"
            }
          }
        }

So my expected response is:

{
    "results": [
        {"fileName": "abc.jpg", "id": "216786a2awei-sh", "mimeType": "jpg"}],
    "paging": {
        "nextPage": "some_string_value"
    }
}

But getting always this:

{
    "results": [
        {
            "id": "some_string_value",
            "title": "some_string_value",
            "body": "somebody",
            "availability": {
                "duration": {
                    "type": "Permanent",
                    "start": "2018-11-13T20:20:39+00:00",
                    "end": "2018-11-13T20:20:39+00:00"
                }
            },
            "showAtLogin": true,
            "showInCourses": true,
            "created": "2018-11-13T20:20:39+00:00",
            "modified": "2018-11-13T20:20:39+00:00"
        }
    ],
    "paging": {
        "nextPage": "some_string_value"
    }
}

MockServer Log
I attached my working example.
Here is CURL command to run the API.

curl --location --request GET 'http://localhost:1080/learn/api/public/v1/courses/math101/contents/_123_1/attachments' \
--header 'Cookie: Cookie_2=value' \
--data-raw ''

Cannot POST (404)

Hello. I implemented test for service, that does request to external microservice.
Before tests started I run mock server:

mockserver.start_mockserver({
    serverPort: 80
});

I have a function that defines API endpoint:

let defineServiceEndpoint = (host, port, method, path, status, body) => {
    return mockServerClient(host, port).mockAnyResponse({
      "httpRequest": {
        "method": method,
        "path": path
      },
      "httpResponse": {
        "statusCode": status,
        "body": body
      }
    });
};

Before my test case run I call defining new endpoint:

return defineServiceEndpoint(
        "localhost",
        80,
        "POST",
        `/api/job/start`,
        200,
        null
).then(() => {
    // calling service function that do request to external microservice
});

After tests I stop mock server:

mockserver.stop_mockserver({
    serverPort: 80
});

But in 60 percent of cases my test fails with error "Cannot POST {some requested path} (404)"

verify promise not behaving as expected

Use this packet a ton, thank you!

Don't know if this is a bug or I'm doing something wrong ,but I am uncertain with .verify.

When running the mock server like so from the command line:

mockserver -serverPort 3300 -logLevel INFO

And then running the following lines in node v4.6.2:

const mockClient = require('mockserver-client');
const client = mockClient.mockServerClient('localhost', 3300);
client
  .verify({
    httpRequest: {
      method: 'POST',
      path: '/testpath',
      body: {}
    }
  })
  .then(function(error, result, pending) {
    console.log({ error, result, pending });
  });

I will never see the console.log in the promise callback. If I'm not mistaken the verification should fail, since no previous request was made, right?

want method which will retrive all active requestMatchers

Want to have retrieve requestMatcher method

What you are trying to do
Want to retrive request matcher filed from all active expectation

The solution you'd like
Its already shown in the dashboard but not showing in node-client or rest client

When i retrive active expectations created using OpenAPI the resulting JSON object does not contain "requesterMatcher"
field under "httpRequest"

It only contains "operationId" and "specUrlOrPayload" fields

image

but if i look at the active expectaion using dashboard console it contains another field Namely "requestMatcher"....

image

What you are trying to do
Want to retrive request matcher filed from all active expectation

MockServer version
5.13.2

To Reproduce
Steps to reproduce the issue:

  1. Using mockserver-node
  2. expectation created using OpenApi
  3. While retriving active expectation using node client as well as REST API "requestMatcher" field is missing under "httpRequest"

Expected behaviour
retriving all active expectation must contain "requestMatcher" field under "httpRequest"

MockServer Log
Log output, as INFO level (or lower)

requestMatcher field not found while retrieving all active expectation created using openAPI

When i retrive active expectations created using OpenAPI the resulting JSON object does not contain "requesterMatcher"
field under "httpRequest"

It only contains "operationId" and "specUrlOrPayload" fields

image

but if i look at the active expectaion using dashboard console it contains another field Namely "requestMatcher"....

image

What you are trying to do
Want to retrive request matcher filed from all active expectation

MockServer version
5.13.2

To Reproduce
Steps to reproduce the issue:

  1. Using mockserver-node
  2. expectation created using OpenApi
  3. While retriving active expectation using node client as well as REST API "requestMatcher" field is missing under "httpRequest"

Expected behaviour
retriving all active expectation must contain "requestMatcher" field under "httpRequest"

MockServer Log
Log output, as INFO level (or lower)

Intercepting request

I'm using abstraction for communication with some API which is external dependency of my system. So sending http / https request to that external dependency looks like:

abstraction.sendHttpRequestToExternalDependency({
  ...
})

As with other abstraction i can't affect host part of url to which http request will be sent, cause it is hardcoded somewhere in abstraction code so how to use mock server in that case?

Concrete example:
Lets say that i want to mock request to http://duckduckgo.com/somePath, and lets say that i'm using duck abstraction for sending request:

var duck = require('duck')

duck.sendRequest({
  method: 'GET',
  path: 'somePath'
})
...

So there is no way, besides changing abstraction code (which would be anti-pattern), inside tests to sent request to http://localhost/somePath so mockServer can return fake response, right?

When specifying caCertPemFilePath the Certificate is still downloaded from github.

Describe the issue
When specifying the caCertPemFilePath or tls =false, The certificate is still downloaded from github.

What you are trying to do
we are behind a corporate proxy blocking the request to raw.githubusercontent.com. I would expect me specifyng the CaPath to not download a certificate that will never be used. This condition should be if tls && !caCertPemFilePath && !fs.existsSync('./' + dest) or something along those lines.

mockAnyResponse function adds default response headers

From documentation in code:
https://github.com/jamesdbloom/mockserver-client-node/blob/master/mockServerClient.js#L320

default headers are used to specify the response headers in mockSimpleResponse(...)
(note: if you use mockAnyResponse(...) the default headers are not used)

But the real implementation of mockAnyResponse uses default headers:
https://github.com/jamesdbloom/mockserver-client-node/blob/master/mockServerClient.js#L249

It is a problem when I want to use Content-type: text/xml.
For this situation, I can use setDefaultHeaders, but is it a correct way?

NPM v5.6.0: missing commit c943aef

Hi,

we have noticed that the library in it's current npm version 5.6.0 has changes in the README and some examples but it's missing the actual code from this commit c943aef.
Is this intended?

For us the current version is not usable because of the missing code.
So please publish the latest version of your code once you find the time ;-)

Mock with regular expression

I've tried to use client.mockAnyResponse with the following objects but don't get the expected result.

  • Use regex for matching path
{
    httpRequest: {
        method: 'POST',
        type: 'REGEX',
        path: '/somePath/[0-9]+'
    },
    httpResponse: {
        // details omitted
    }
}   
  • Use regex for matching query parameters
{
    httpRequest: {
        method: 'GET',
        path: '/somePath',
        queryStringParameters: [
            {
                type: 'REGEX',
                name: 'key1',
                values: ['.*']                     // match anything
            },
            {
                name: 'key2',
                values: ['specific value']          // string exact match
            },
            {
                name: 'key3',
                value: 0                        // match an exact number
            }
        ]
    },
    httpResponse: {
        // details omitted
    }
}

What's the correct way to do it @jamesdbloom ?

retrieveActiveExpectations not matching all active expectations

Hi there,

I'm setting up 18 expectations and when I try to use retrieveActiveExpectations it returns only 17 of them with one missing.

I've used this example and using [email protected]

Checking the mockserver logs I see the following;

 did not match expectation:

        {
          "method" : "GET",
          "path" : "/app/web-api/projects/1879048400/users",
          "queryStringParameters" : {
            "query" : [ ".*" ]
          }
        }

 because:

        method matches = true
        path matches = true
        query string parameters match = false
        body matches = true
        headers match = true
        cookies match = true
        keep-alive matches = true
        ssl matches = true

The only difference I can see is that the other expectations don't set a queryStringParameter.

I would have thought all recorded expectations are sent back ?

Can't call a custom function in a javascript template

Describe the issue
It seems that in a Javascript response template, I can call Javascript functions like Date() but I can't call functions I defined in the same file.

What you are trying to do
I'm trying to return a "random" number in the response. I can do that by embedding the code in the template, but if I extract the code into a function, the server returns 404.

MockServer version
5.10.0

To Reproduce
I'm running MockServer via node (node init.js). If I define my expectation like this:

"httpResponseTemplate": {
            "template": "return { statusCode: 200, body: JSON.stringify({TransactionId: Math.floor(Math.random() * Math.floor(9223372036854775807)), Queued: true, HasError: false}) };",
            "templateType": "JAVASCRIPT"
        }

it works. But if I extract the random number calculation to a function, it returns 404:

"httpResponseTemplate": {
            "template": "return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };",
            "templateType": "JAVASCRIPT"
        }

Expected behaviour
I expect both definitions to have the same behaviour

MockServer Log

Skipping {
ย  "host": "oss.sonatype.org",
ย  "path": "/content/repositories/releases/org/mock-server/mockserver-netty/5.10.0/mockserver-netty-5.10.0-jar-with-dependencies.jar",
ย  "port": 443
} as file already downloaded
Running 'java -Dfile.encoding=UTF-8 -jar node_modules/mockserver-node/mockserver-netty-5.10.0-jar-with-dependencies.jar -serverPort 55555 -logLevel TRACE'
2020-04-02 10:09:41 ย io.netty.channel.MultithreadEventLoopGroup ย FINE ย -Dio.netty.eventLoopThreads: 16
2020-04-02 10:09:41 ย io.netty.util.internal.InternalThreadLocalMap ย FINE ย -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
2020-04-02 10:09:41 ย io.netty.util.internal.InternalThreadLocalMap ย FINE ย -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINE ย -Dio.netty.noKeySetOptimization: false
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINE ย -Dio.netty.selectorAutoRebuildThreshold: 512
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย Platform: Windows
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย -Dio.netty.noUnsafe: false
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย Java version: 8
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย sun.misc.Unsafe.theUnsafe: available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย sun.misc.Unsafe.copyMemory: available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย java.nio.Buffer.address: available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย direct buffer constructor: available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย java.nio.Bits.unaligned: available, true
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable prior to Java9
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent0 ย FINE ย java.nio.DirectByteBuffer.<init>(long, int): available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย sun.misc.Unsafe: available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย -Dio.netty.tmpdir: D:\Users\vgarcia\AppData\Local\Temp (java.io.tmpdir)
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย -Dio.netty.bitMode: 64 (sun.arch.data.model)
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย -Dio.netty.maxDirectMemory: 4772593664 bytes
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย -Dio.netty.uninitializedArrayAllocationThreshold: -1
2020-04-02 10:09:41 ย io.netty.util.internal.CleanerJava6 ย FINE ย java.nio.ByteBuffer.cleaner(): available
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย -Dio.netty.noPreferDirect: false
2020-04-02 10:09:41 ย io.netty.util.internal.PlatformDependent ย FINE ย org.jctools-core.MpscChunkedArrayQueue: available
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@525b461a
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@61d47554
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@69b794e2
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@3f200884
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4d339552
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4461c7e3
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@351d0846
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@77e4c80f
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@35fc6dc4
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@7fe8ea47
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@226a82c4
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@731f8236
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@255b53dc
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@1dd92fe2
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6b53e23f
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@64d2d351
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@1b68b9a4
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4f9a3314
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@3b2c72c2
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@491666ad
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@176d53b2
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@971d0d8
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@51931956
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@2b4a2ec7
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@564718df
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@51b7e5df
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@18a70f16
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@62e136d3
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@c8e4bb0
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@6279cee3
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4206a205
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@29ba4338
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@57175e74
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@7bb58ca3
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@c540f5a
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@770c2e6b
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@1a052a00
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@4d826d77
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@61009542
2020-04-02 10:09:41 ย io.netty.channel.nio.NioEventLoop ย FINEST ย instrumented a special java.util.Set into: sun.nio.ch.WindowsSelectorImpl@77e9807f
2020-04-02 10:09:42 ย io.netty.util.ResourceLeakDetector ย FINE ย -Dio.netty.leakDetection.level: simple
2020-04-02 10:09:42 ย io.netty.util.ResourceLeakDetector ย FINE ย -Dio.netty.leakDetection.targetRecords: 4
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.numHeapArenas: 16
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.numDirectArenas: 16
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.pageSize: 8192
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.maxOrder: 11
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.chunkSize: 16777216
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.tinyCacheSize: 512
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.smallCacheSize: 256
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.normalCacheSize: 64
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.maxCachedBufferCapacity: 32768
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.cacheTrimInterval: 8192
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.cacheTrimIntervalMillis: 0
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.useCacheForAllThreads: true
2020-04-02 10:09:42 ย io.netty.buffer.PooledByteBufAllocator ย FINE ย -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
2020-04-02 10:09:42 ย io.netty.channel.DefaultChannelId ย FINE ย -Dio.netty.processId: 35272 (auto-detected)
2020-04-02 10:09:42 ย io.netty.util.NetUtil ย FINE ย -Djava.net.preferIPv4Stack: false
2020-04-02 10:09:42 ย io.netty.util.NetUtil ย FINE ย -Djava.net.preferIPv6Addresses: false
2020-04-02 10:09:42 ย io.netty.util.NetUtil ย FINE ย Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
2020-04-02 10:09:42 ย io.netty.util.NetUtil ย FINE ย Failed to get SOMAXCONN from sysctl and file \proc\sys\net\core\somaxconn. Default: 200
2020-04-02 10:09:42 ย io.netty.channel.DefaultChannelId ย FINE ย -Dio.netty.machineId: 00:50:56:ff:fe:a1:41:80 (auto-detected)
2020-04-02 10:09:42 ย io.netty.buffer.ByteBufUtil ย FINE ย -Dio.netty.allocator.type: pooled
2020-04-02 10:09:42 ย io.netty.buffer.ByteBufUtil ย FINE ย -Dio.netty.threadLocalDirectBufferSize: 0
2020-04-02 10:09:42 ย io.netty.buffer.ByteBufUtil ย FINE ย -Dio.netty.maxThreadLocalCharBufferSize: 16384
2020-04-02 10:09:42 ย org.mockserver.cli.Main ย FINEST ย logger level is TRACE, change using:
ย - 'ConfigurationProperties.logLevel(String level)' in Java code,
ย - '-logLevel' command line argument,
ย - 'mockserver.logLevel' JVM system property or,
ย - 'mockserver.logLevel' property value in 'mockserver.properties'
2020-04-02 10:09:42 ย org.mockserver.log.MockServerEventLog ย INFO ย started on port: 55555
waiting for MockServer to start retries remaining: 110
2020-04-02 10:09:42 ย io.netty.util.Recycler ย FINE ย -Dio.netty.recycler.maxCapacityPerThread: 4096
2020-04-02 10:09:42 ย io.netty.util.Recycler ย FINE ย -Dio.netty.recycler.maxSharedCapacityFactor: 2
2020-04-02 10:09:42 ย io.netty.util.Recycler ย FINE ย -Dio.netty.recycler.linkCapacity: 16
2020-04-02 10:09:42 ย io.netty.util.Recycler ย FINE ย -Dio.netty.recycler.ratio: 8
2020-04-02 10:09:42 ย io.netty.buffer.AbstractByteBuf ย FINE ย -Dio.netty.buffer.checkAccessible: true
2020-04-02 10:09:42 ย io.netty.buffer.AbstractByteBuf ย FINE ย -Dio.netty.buffer.checkBounds: true
2020-04-02 10:09:42 ย io.netty.util.ResourceLeakDetectorFactory ย FINE ย Loaded default ResourceLeakDetector: io.netty.util.ResourceLeakDetector@77f40934
2020-04-02 10:09:42 ย PortUnificationHandler-last ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 - R:/127.0.0.1:63538] RECEIVED(0B)
ย  ย  ย  ย  ย +-------------------------------------------------+
ย  ย  ย  ย  ย | ย 0 ย 1 ย 2 ย 3 ย 4 ย 5 ย 6 ย 7 ย 8 ย 9 ย a ย b ย c ย d ย e ย f |
+--------+-------------------------------------------------+----------------+
+--------+-------------------------------------------------+----------------+
channel: 96649986
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย org.mockserver.log.MockServerEventLog ย FINEST ย received request:

ย  {
ย  ย  "method" : "PUT",
ย  ย  "path" : "/mockserver/retrieve",
ย  ย  "queryStringParameters" : {
ย  ย  ย  "type" : [ "ACTIVE_EXPECTATIONS" ]
ย  ย  },
ย  ย  "headers" : {
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Connection" : [ "close" ],
ย  ย  ย  "Content-Length" : [ "0" ]
ย  ย  },
ย  ย  "keepAlive" : false,
ย  ย  "secure" : false
ย  }

2020-04-02 10:09:42 ย org.mockserver.log.MockServerEventLog ย INFO ย retrieving active expectations in json that match:

ย  { }

2020-04-02 10:09:42 ย PortUnificationHandler-last ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 - R:/127.0.0.1:63538] WRITE(2B)
ย  ย  ย  ย  ย +-------------------------------------------------+
ย  ย  ย  ย  ย | ย 0 ย 1 ย 2 ย 3 ย 4 ย 5 ย 6 ย 7 ย 8 ย 9 ย a ย b ย c ย d ย e ย f |
+--------+-------------------------------------------------+----------------+
|00000000| 5b 5d ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  |[] ย  ย  ย  ย  ย  ย  ย |
+--------+-------------------------------------------------+----------------+
channel: 96649986
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย PortUnificationHandler-last ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 - R:/127.0.0.1:63538] FLUSH
channel: 96649986
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย PortUnificationHandler-last ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 - R:/127.0.0.1:63538] CLOSE()
channel: 96649986
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

started MockServer
2020-04-02 10:09:42 ย PortUnificationHandler-last ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 ! R:/127.0.0.1:63538] CLOSE()
channel: 96649986
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย org.mockserver.log.MockServerEventLog ย FINE ย disconnected and closed socket view-localhost/127.0.0.1:55555
2020-04-02 10:09:42 ย PortUnificationHandler-first ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 ! R:/127.0.0.1:63538] FLUSH
channel: 96649986
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย PortUnificationHandler-first ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 ! R:/127.0.0.1:63538] INACTIVE
channel: 96649986
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย PortUnificationHandler-first ย FINEST ย [id: 0x96649986, L:view-localhost/127.0.0.1:55555 ! R:/127.0.0.1:63538] UNREGISTERED
channel: 96649986
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย PortUnificationHandler-last ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 - R:/127.0.0.1:63539] RECEIVED(247B)
ย  ย  ย  ย  ย +-------------------------------------------------+
ย  ย  ย  ย  ย | ย 0 ย 1 ย 2 ย 3 ย 4 ย 5 ย 6 ย 7 ย 8 ย 9 ย a ย b ย c ย d ย e ย f |
+--------+-------------------------------------------------+----------------+
|00000000| 7b 22 68 74 74 70 52 65 71 75 65 73 74 22 3a 7b |{"httpRequest":{|
|00000010| 22 6d 65 74 68 6f 64 22 3a 22 50 4f 53 54 22 2c |"method":"POST",|
|00000020| 22 70 61 74 68 22 3a 22 2f 61 70 69 2f 51 75 65 |"path":"/api/Que|
|00000030| 75 65 22 2c 22 68 65 61 64 65 72 73 22 3a 5b 5d |ue","headers":[]|
|00000040| 7d 2c 22 68 74 74 70 52 65 73 70 6f 6e 73 65 54 |},"httpResponseT|
|00000050| 65 6d 70 6c 61 74 65 22 3a 7b 22 74 65 6d 70 6c |emplate":{"templ|
|00000060| 61 74 65 22 3a 22 72 65 74 75 72 6e 20 7b 20 73 |ate":"return { s|
|00000070| 74 61 74 75 73 43 6f 64 65 3a 20 32 30 30 2c 20 |tatusCode: 200, |
|00000080| 62 6f 64 79 3a 20 4a 53 4f 4e 2e 73 74 72 69 6e |body: JSON.strin|
|00000090| 67 69 66 79 28 7b 54 72 61 6e 73 61 63 74 69 6f |gify({Transactio|
|000000a0| 6e 49 64 3a 20 67 65 74 52 61 6e 64 6f 6d 4c 6f |nId: getRandomLo|
|000000b0| 6e 67 28 29 2c 20 51 75 65 75 65 64 3a 20 74 72 |ng(), Queued: tr|
|000000c0| 75 65 2c 20 48 61 73 45 72 72 6f 72 3a 20 66 61 |ue, HasError: fa|
|000000d0| 6c 73 65 7d 29 20 7d 3b 22 2c 22 74 65 6d 70 6c |lse}) };","templ|
|000000e0| 61 74 65 54 79 70 65 22 3a 22 4a 41 56 41 53 43 |ateType":"JAVASC|
|000000f0| 52 49 50 54 22 7d 7d ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย |RIPT"}} ย  ย  ย  ย  |
+--------+-------------------------------------------------+----------------+
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:42 ย org.mockserver.log.MockServerEventLog ย FINEST ย received request:

ย  {
ย  ย  "method" : "PUT",
ย  ย  "path" : "/expectation",
ย  ย  "headers" : {
ย  ย  ย  "Content-Type" : [ "application/json; charset=utf-8" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Connection" : [ "close" ],
ย  ย  ย  "content-length" : [ "247" ]
ย  ย  },
ย  ย  "keepAlive" : false,
ย  ย  "secure" : false,
ย  ย  "body" : {
ย  ย  ย  "httpRequest" : {
ย  ย  ย  ย  "method" : "POST",
ย  ย  ย  ย  "path" : "/api/Queue",
ย  ย  ย  ย  "headers" : [ ]
ย  ย  ย  },
ย  ย  ย  "httpResponseTemplate" : {
ย  ย  ย  ย  "template" : "return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };",
ย  ย  ย  ย  "templateType" : "JAVASCRIPT"
ย  ย  ย  }
ย  ย  }
ย  }

2020-04-02 10:09:43 ย PortUnificationHandler-last ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 - R:/127.0.0.1:63539] WRITE(0B)
ย  ย  ย  ย  ย +-------------------------------------------------+
ย  ย  ย  ย  ย | ย 0 ย 1 ย 2 ย 3 ย 4 ย 5 ย 6 ย 7 ย 8 ย 9 ย a ย b ย c ย d ย e ย f |
+--------+-------------------------------------------------+----------------+
+--------+-------------------------------------------------+----------------+
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:43 ย PortUnificationHandler-last ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 - R:/127.0.0.1:63539] FLUSH
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:43 ย PortUnificationHandler-last ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 - R:/127.0.0.1:63539] CLOSE()
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

Queue expectation created.
2020-04-02 10:09:43 ย PortUnificationHandler-last ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 ! R:/127.0.0.1:63539] CLOSE()
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:43 ย PortUnificationHandler-first ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 ! R:/127.0.0.1:63539] FLUSH
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:43 ย PortUnificationHandler-first ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 ! R:/127.0.0.1:63539] INACTIVE
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:43 ย PortUnificationHandler-first ย FINEST ย [id: 0x6d8f4ba7, L:/127.0.0.1:55555 ! R:/127.0.0.1:63539] UNREGISTERED
channel: 6d8f4ba7
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:43 ย org.mockserver.log.MockServerEventLog ย INFO ย creating expectation:

ย  {
ย  ย  "id" : "e209f147-71bc-4443-a442-34a4866763eb",
ย  ย  "priority" : 0,
ย  ย  "httpRequest" : {
ย  ย  ย  "method" : "POST",
ย  ย  ย  "path" : "/api/Queue"
ย  ย  },
ย  ย  "times" : {
ย  ย  ย  "unlimited" : true
ย  ย  },
ย  ย  "timeToLive" : {
ย  ย  ย  "unlimited" : true
ย  ย  },
ย  ย  "httpResponseTemplate" : {
ย  ย  ย  "templateType" : "JAVASCRIPT",
ย  ย  ย  "template" : "return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };"
ย  ย  }
ย  }

2020-04-02 10:09:43 ย org.mockserver.log.MockServerEventLog ย FINE ย disconnected and closed socket /127.0.0.1:55555
2020-04-02 10:09:50 ย PortUnificationHandler-last ย FINEST ย [id: 0xcce03aef, L:0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:55555 - R:/0:0:0:0:0:0:0:1:63545] RECEIVED(0B)
ย  ย  ย  ย  ย +-------------------------------------------------+
ย  ย  ย  ย  ย | ย 0 ย 1 ย 2 ย 3 ย 4 ย 5 ย 6 ย 7 ย 8 ย 9 ย a ย b ย c ย d ย e ย f |
+--------+-------------------------------------------------+----------------+
+--------+-------------------------------------------------+----------------+
channel: cce03aef
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:50 ย org.mockserver.log.MockServerEventLog ย FINEST ย received request:

ย  {
ย  ย  "method" : "POST",
ย  ย  "path" : "/api/queue",
ย  ย  "headers" : {
ย  ย  ย  "User-Agent" : [ "PostmanRuntime/7.23.0" ],
ย  ย  ย  "Accept" : [ "*/*" ],
ย  ย  ย  "Cache-Control" : [ "no-cache" ],
ย  ย  ย  "Postman-Token" : [ "e46638fd-486e-46b8-9985-a49451cc1216" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Accept-Encoding" : [ "gzip, deflate, br" ],
ย  ย  ย  "Content-Length" : [ "0" ],
ย  ย  ย  "Connection" : [ "keep-alive" ]
ย  ย  },
ย  ย  "keepAlive" : true,
ย  ย  "secure" : false
ย  }

2020-04-02 10:09:50 ย org.mockserver.log.MockServerEventLog ย INFO ย received request:

ย  {
ย  ย  "method" : "POST",
ย  ย  "path" : "/api/queue",
ย  ย  "headers" : {
ย  ย  ย  "User-Agent" : [ "PostmanRuntime/7.23.0" ],
ย  ย  ย  "Accept" : [ "*/*" ],
ย  ย  ย  "Cache-Control" : [ "no-cache" ],
ย  ย  ย  "Postman-Token" : [ "e46638fd-486e-46b8-9985-a49451cc1216" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Accept-Encoding" : [ "gzip, deflate, br" ],
ย  ย  ย  "Content-Length" : [ "0" ],
ย  ย  ย  "Connection" : [ "keep-alive" ]
ย  ย  },
ย  ย  "keepAlive" : true,
ย  ย  "secure" : false
ย  }

2020-04-02 10:09:50 ย org.mockserver.log.MockServerEventLog ย INFO ย request:

ย  {
ย  ย  "method" : "POST",
ย  ย  "path" : "/api/queue",
ย  ย  "headers" : {
ย  ย  ย  "User-Agent" : [ "PostmanRuntime/7.23.0" ],
ย  ย  ย  "Accept" : [ "*/*" ],
ย  ย  ย  "Cache-Control" : [ "no-cache" ],
ย  ย  ย  "Postman-Token" : [ "e46638fd-486e-46b8-9985-a49451cc1216" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Accept-Encoding" : [ "gzip, deflate, br" ],
ย  ย  ย  "Content-Length" : [ "0" ],
ย  ย  ย  "Connection" : [ "keep-alive" ]
ย  ย  },
ย  ย  "keepAlive" : true,
ย  ย  "secure" : false
ย  }

ย matched expectation:

ย  {
ย  ย  "id" : "e209f147-71bc-4443-a442-34a4866763eb",
ย  ย  "priority" : 0,
ย  ย  "httpRequest" : {
ย  ย  ย  "method" : "POST",
ย  ย  ย  "path" : "/api/Queue"
ย  ย  },
ย  ย  "times" : {
ย  ย  ย  "unlimited" : true
ย  ย  },
ย  ย  "timeToLive" : {
ย  ย  ย  "unlimited" : true
ย  ย  },
ย  ย  "httpResponseTemplate" : {
ย  ย  ย  "templateType" : "JAVASCRIPT",
ย  ย  ย  "template" : "return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };"
ย  ย  }
ย  }

2020-04-02 10:09:50 ย PortUnificationHandler-last ย FINEST ย [id: 0xcce03aef, L:0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:55555 - R:/0:0:0:0:0:0:0:1:63545] WRITE(0B)
ย  ย  ย  ย  ย +-------------------------------------------------+
ย  ย  ย  ย  ย | ย 0 ย 1 ย 2 ย 3 ย 4 ย 5 ย 6 ย 7 ย 8 ย 9 ย a ย b ย c ย d ย e ย f |
+--------+-------------------------------------------------+----------------+
+--------+-------------------------------------------------+----------------+
channel: cce03aef
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:50 ย org.mockserver.log.MockServerEventLog ย INFO ย returning response:

ย  {
ย  ย  "statusCode" : 404,
ย  ย  "reasonPhrase" : "Not Found"
ย  }

ย for request:

ย  {
ย  ย  "method" : "POST",
ย  ย  "path" : "/api/queue",
ย  ย  "headers" : {
ย  ย  ย  "User-Agent" : [ "PostmanRuntime/7.23.0" ],
ย  ย  ย  "Accept" : [ "*/*" ],
ย  ย  ย  "Cache-Control" : [ "no-cache" ],
ย  ย  ย  "Postman-Token" : [ "e46638fd-486e-46b8-9985-a49451cc1216" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Accept-Encoding" : [ "gzip, deflate, br" ],
ย  ย  ย  "Content-Length" : [ "0" ],
ย  ย  ย  "Connection" : [ "keep-alive" ]
ย  ย  },
ย  ย  "keepAlive" : true,
ย  ย  "secure" : false
ย  }

ย for action:

ย  {
ย  ย  "templateType" : "JAVASCRIPT",
ย  ย  "template" : "return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };"
ย  }

2020-04-02 10:09:50 ย PortUnificationHandler-last ย FINEST ย [id: 0xcce03aef, L:0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:55555 - R:/0:0:0:0:0:0:0:1:63545] FLUSH
channel: cce03aef
current: LoggingHandler#0
pipeline: [HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, LoggingHandler#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

2020-04-02 10:09:50 ย org.mockserver.log.MockServerEventLog ย INFO ย Exception transforming template:

ย  function handle(request) {

ย  ย  return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };
ย  }

ย for request:

ย  {
ย  ย  "method" : "POST",
ย  ย  "path" : "/api/queue",
ย  ย  "headers" : {
ย  ย  ย  "User-Agent" : [ "PostmanRuntime/7.23.0" ],
ย  ย  ย  "Accept" : [ "*/*" ],
ย  ย  ย  "Cache-Control" : [ "no-cache" ],
ย  ย  ย  "Postman-Token" : [ "e46638fd-486e-46b8-9985-a49451cc1216" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Accept-Encoding" : [ "gzip, deflate, br" ],
ย  ย  ย  "Content-Length" : [ "0" ],
ย  ย  ย  "Connection" : [ "keep-alive" ]
ย  ย  },
ย  ย  "keepAlive" : true,
ย  ย  "secure" : false
ย  }

java.lang.RuntimeException: Exception transforming template:

ย  function handle(request) {

ย  ย  return { statusCode: 200, body: JSON.stringify({TransactionId: getRandomLong(), Queued: true, HasError: false}) };
ย  }

ย for request:

ย  {
ย  ย  "method" : "POST",
ย  ย  "path" : "/api/queue",
ย  ย  "headers" : {
ย  ย  ย  "User-Agent" : [ "PostmanRuntime/7.23.0" ],
ย  ย  ย  "Accept" : [ "*/*" ],
ย  ย  ย  "Cache-Control" : [ "no-cache" ],
ย  ย  ย  "Postman-Token" : [ "e46638fd-486e-46b8-9985-a49451cc1216" ],
ย  ย  ย  "Host" : [ "localhost:55555" ],
ย  ย  ย  "Accept-Encoding" : [ "gzip, deflate, br" ],
ย  ย  ย  "Content-Length" : [ "0" ],
ย  ย  ย  "Connection" : [ "keep-alive" ]
ย  ย  },
ย  ย  "keepAlive" : true,
ย  ย  "secure" : false
ย  }

ย  ย  ย  ย  at org.mockserver.templates.engine.javascript.JavaScriptTemplateEngine.executeTemplate(JavaScriptTemplateEngine.java:76)
ย  ย  ย  ย  at org.mockserver.mock.action.HttpResponseTemplateActionHandler.handle(HttpResponseTemplateActionHandler.java:42)
ย  ย  ย  ย  at org.mockserver.mock.action.ActionHandler.lambda$null$3(ActionHandler.java:103)
ย  ย  ย  ย  at org.mockserver.mock.action.ActionHandler.handleAnyException(ActionHandler.java:285)
ย  ย  ย  ย  at org.mockserver.mock.action.ActionHandler.lambda$processAction$4(ActionHandler.java:102)
ย  ย  ย  ย  at org.mockserver.scheduler.Scheduler.run(Scheduler.java:67)
ย  ย  ย  ย  at org.mockserver.scheduler.Scheduler.schedule(Scheduler.java:104)
ย  ย  ย  ย  at org.mockserver.mock.action.ActionHandler.processAction(ActionHandler.java:102)
ย  ย  ย  ย  at org.mockserver.netty.MockServerHandler.channelRead0(MockServerHandler.java:147)
ย  ย  ย  ย  at org.mockserver.netty.MockServerHandler.channelRead0(MockServerHandler.java:46)
ย  ย  ย  ย  at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
ย  ย  ย  ย  at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
ย  ย  ย  ย  at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at org.mockserver.dashboard.DashboardWebSocketServerHandler.channelRead(DashboardWebSocketServerHandler.java:130)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at org.mockserver.closurecallback.websocketregistry.CallbackWebSocketServerHandler.channelRead(CallbackWebSocketServerHandler.java:56)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at org.mockserver.logging.LoggingHandler.channelRead(LoggingHandler.java:170)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
ย  ย  ย  ย  at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
ย  ย  ย  ย  at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
ย  ย  ย  ย  at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at org.mockserver.netty.unification.PortUnificationHandler.switchToHttp(PortUnificationHandler.java:239)
ย  ย  ย  ย  at org.mockserver.netty.unification.PortUnificationHandler.decode(PortUnificationHandler.java:127)
ย  ย  ย  ย  at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:498)
ย  ย  ย  ย  at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
ย  ย  ย  ย  at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
ย  ย  ย  ย  at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
ย  ย  ย  ย  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
ย  ย  ย  ย  at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
ย  ย  ย  ย  at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
ย  ย  ย  ย  at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
ย  ย  ย  ย  at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
ย  ย  ย  ย  at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
ย  ย  ย  ย  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
ย  ย  ย  ย  at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
ย  ย  ย  ย  at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
ย  ย  ย  ย  at java.lang.Thread.run(Unknown Source)
Caused by: <eval>:3 ReferenceError: "getRandomLong" is not defined
ย  ย  ย  ย  at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
ย  ย  ย  ย  at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:319)
ย  ย  ย  ย  at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:291)
ย  ย  ย  ย  at jdk.nashorn.internal.objects.Global.__noSuchProperty__(Global.java:1442)
ย  ย  ย  ย  at jdk.nashorn.internal.scripts.Script$Recompilation$4$25A$\^eval\_.handle(<eval>:3)
ย  ย  ย  ย  at jdk.nashorn.internal.scripts.Script$Recompilation$3$178A$\^eval\_.serialise(<eval>:4)
ย  ย  ย  ย  at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:639)
ย  ย  ย  ย  at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
ย  ย  ย  ย  at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
ย  ย  ย  ย  at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:117)
ย  ย  ย  ย  at org.mockserver.templates.engine.javascript.JavaScriptTemplateEngine.executeTemplate(JavaScriptTemplateEngine.java:50)
ย  ย  ย  ย  ... 66 more

2020-04-02 10:09:50 ย PortUnificationHandler-first ย FINEST ย [id: 0xcce03aef, L:0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:55555 - R:/0:0:0:0:0:0:0:1:63545] FLUSH
channel: cce03aef
current: LoggingHandler#0
pipeline: [LoggingHandler#0, HttpServerCodec#0, HttpContentDecompressor#0, HttpContentLengthRemover#0, HttpObjectAggregator#0, CallbackWebSocketServerHandler#0, DashboardWebSocketServerHandler#0, MockServerServerCodec#0, MockServerHandler#0, DefaultChannelPipeline$TailContext#0]

Request sequence not found

Describe the issue
The expectations are not met. The request is returned instead of a comparison of the two paths.

What you are trying to do
I have a test where I expect 'authenticate' to be called before 'orders' (I'm using JUnit 4). Here's the code:

mockServer.verify(
    request().withPath("/users/v2/authenticate"),
    request().withPath("/data/v1/orders")
);

MockServer version
5.13.2

To Reproduce
Steps to reproduce the issue:

  1. How you are running MockServer (i.e maven plugin, docker, etc)
    In a JUnit 4 test:
@BeforeClass
public static void startMockServer() {
    ConfigurationProperties.initializationClass(ExpectationInitializer.class.getName());
    ConfigurationProperties.logLevel("WARN");
    mockServer = ClientAndServer.startClientAndServer(9001);
}
  1. Code you used to create expectations
@Override
public Expectation[] initializeExpectations() {
    return new Expectation[]{
            new Expectation(
                    request()
                            .withMethod("POST")
                            .withPath("/users/v2/authenticate")
            )
                    .thenRespond(
                    response()
                            .withStatusCode(200)
                            .withBody(json("{\n" +
                                    "  \"ImpersonationToken\": \"string\",\n" +
                                    "  \"KeepAliveTimeout\": \"string\",\n" +
                                    "  \"User\": {\n" +
                                    "    \"Language\": \"string\",\n" +
                                    "    \"Institution\": \"string\",\n" +
                                    "    \"Permissions\": {\n" +
                                    "      \"ImportSlides\": true,\n" +
                                    "      \"SaveAnnotations\": true,\n" +
                                    "      \"SaveOwnAnnotations\": true,\n" +
                                    "      \"ModifySystemConfiguration\": true,\n" +
                                    "      \"UseLisDataApi\": true,\n" +
                                    "      \"ExportImages\": true\n" +
                                    "    },\n" +
                                    "    \"Id\": \"00000000-0000-0000-0000-000000000000\",\n" +
                                    "    \"Login\": \"string\",\n" +
                                    "    \"Domain\": \"string\",\n" +
                                    "    \"FullName\": \"string\",\n" +
                                    "    \"RawName\": \"string\"\n" +
                                    "  },\n" +
                                    "  \"UrlAccessString\": \"string\"\n" +
                                    "}"))
            ),
            new Expectation(
                    request()
                            .withMethod("POST")
                            .withPath("/data/v1/orders")
            )
                    .thenRespond(
                    response()
                            .withStatusCode(200)
            )
    };
}
  1. What error you saw
    Intermittently I get this error:
junit.framework.AssertionFailedError: Request sequence not found, expected:<[ {
  "path" : "/users/v2/authenticate"
}, {
  "path" : "/data/v1/orders"
} ]> but was:<{
  "body" : {
    "contentType" : "application/json",
    "type" : "JSON",
    "json" : {
      "Login" : "ServerAccount",
      "Password" : "Password"
    },
    "rawBytes" : "eyJMb2dpbiI6IlNDSFNlcnZlckFjY591bnQiLCJQYXNzd29yZCI6IlNlY3RyYVBBQ1M0dSJ9"
  },
  "headers" : {
    "Authorization" : [ "Basic U0NIU9VydmVyQWNjb3VudDpTZWN0cmFQQUNTNHU=" ],
    "content-length" : [ "54" ],
    "Accept" : [ "application/json" ],
    "Connection" : [ "Keep-Alive" ],
    "User-Agent" : [ "Apache-HttpClient/4.5.4 (Java/11.0.14.1)" ],
    "Host" : [ "localhost:9001" ],
    "Accept-Encoding" : [ "gzip,deflate" ],
    "Content-Type" : [ "application/json" ]
  },
  "keepAlive" : true,
  "method" : "POST",
  "path" : "/users/v2/authenticate",
  "secure" : false
}>

Expected behaviour
To show that the calls were made in the right order

MockServer Log

at org.mockserver.client.MockServerClient.verify(MockServerClient.java:864)
at org.mockserver.client.MockServerClient.verify(MockServerClient.java:822)

Typescript binding for verifySequence is broken

The typescript binding for verifySequence is broken. It declares the matchers parameter as an array of RequestDefinitions, while the JS implementation expects a varargs parameter. As a result, the verifySequence example from the docs...

mockServerClient("localhost", 1080)
  .verifySequence(
    {
      'path': '/some/path/one'
    },
    {
      'path': '/some/path/two'
    },
    {
      'path': '/some/path/three'
    }
  )

... doesn't compile in typescript, and using it with an array like this:

mockServerClient("localhost", 1080)
  .verifySequence(
    [{
      'path': '/some/path/one'
    },
    {
      'path': '/some/path/two'
    },
    {
      'path': '/some/path/three'
    }]
  )

... fails on the server side with this error message:

  incorrect verification sequence json format for:
  
    {"httpRequests":[[{"path":"/some/path/one"},{"path":"/some/path/two"},{"path":"/some/path/three"}]]}
  
   schema validation errors:
  
    2 errors:
     - field: "/httpRequests/0" for schema: "httpRequest" has error: "instance type (array) does not match any allowed primitive type (allowed: ["object"])"
     - ...

(notice the array-in-array for httpRequests).

Here is the diff that solves the problem:

diff --git a/node_modules/mockserver-client/mockServerClient.d.ts b/node_modules/mockserver-client/mockServerClient.d.ts
index 5eaa8bb..f1072a2 100644
--- a/node_modules/mockserver-client/mockServerClient.d.ts
+++ b/node_modules/mockserver-client/mockServerClient.d.ts
@@ -41,7 +41,7 @@ export interface MockServerClient {
 
     verify(matcher: RequestDefinition, atLeast?: number, atMost?: number): Promise<void | string>;
 
-    verifySequence(matchers: RequestDefinition[]): Promise<void | string>;
+    verifySequence(...matchers: RequestDefinition[]): Promise<void | string>;
 
     reset(): Promise<RequestResponse>;
 

This issue body was partially generated by patch-package.

SSL Issue in the latest version

Describe the issue
I've been using mock-server successfully several months ago, but today, trying to upgrade to the latest version, I'm unable to load expectations.

What you are trying to do
Load expectations with a NodeJS script.

MockServer version
5.6.1 -> Works!
5.9.0 -> Doesn't work

To Reproduce
Run a mock-server in the 443 port with -serverPort

  1. How you are running MockServer: Docker
export CONTAINER_NAME=my-mock-server
export HOST_PORT=8243                       # your local port
export CONTAINER_PORT=443              # port inside the container
export DOCKER_IMAGE=jamesdbloom/mockserver:mockserver-5.9.0

docker run \
  -u 0 \
  --memory=1GB \
  -d \
  --name $CONTAINER_NAME \
  -p $HOST_PORT:$CONTAINER_PORT \
  $DOCKER_IMAGE -serverPort $CONTAINER_PORT
  1. Code you used to create expectations
    await mocksServer.mockAnyResponse({
      httpRequest: {
        method: 'POST',
        path:   '/my/url',
        headers: {
          'Authorization': [ 'Basic 1234' ]
        },
        body: {
          type: 'STRING',
          string: 'grant_type=client_credentials',
          contentType: 'application/x-www-form-urlencoded'
        }
      },
      httpResponse: {
        body: JSON.stringify({
          access_token: '1234',
          scope: 'default',
          token_type: 'Bearer',
          expires_in: 1113
        })
      }
    })
  1. What error you saw
Fetching {
  "protocol": "https:",
  "method": "GET",
  "host": "raw.githubusercontent.com",
  "path": "/mock-server/mockserver/master/mockserver-core/src/main/resources/org/mockserver/socket/CertificateAuthorityCertificate.pem",
  "port": 443
} failed with error Error: connect ETIMEDOUT 151.101.132.133:443

Expected behaviour
The expectation should be loaded

MockServer Log
No logs are shown.

Simplify / control verification errors

Is it possible to add method that disables or make less descriptive verification errors? I have mocked 20 request and when verification fails console reports from jasmine are not readable becouse of huge amount of text from verificaton errors.

How to match request by not matching querystring

I have a request which I want to server different responses to based on the querystring params, specifically if a certain param is present or not.

For example:
'/some/path?userId=2' and '/some/path?userId=2&model=modelA' will deliver two different responses.

I've tried various different approaches around specifying a queryStringParameters object but the results are not consistent. Is there a validated way of matching based on the existance or lack of a querystring param?

Schema Validation Errors

Describe the issue
Getting the above error when running the given example of openapi_request_matcher_examples.

What you are trying to do
I will inject my application swagger schema for mocking the request and response.

MockServer version
I am using version 5.11.0

To Reproduce
Steps to reproduce the issue:
I) clone the repository https://github.com/mock-server/mockserver-client-node
ii) npm install for root and start the mock server
iii) go to the example folder and selected one example "openapi_request_matcher_examples" and run the npm install again for this folder
iv) called one function for this server.js file and than getting error.

  1. How you are running MockServer --> I started mock server manually by running grunt command "grunt start_mockserver"
  2. Code you used to create expectations
  3. What error you saw below is the error --> I am getting with an existing example only.

**schema validation errors:

2 errors:

  • field: "/httpRequest" for schema: "httpRequest" has error: "object instance has properties which are not allowed by the schema: ["operationId","specUrlOrPayload"]"
  • field: "/httpRequest" for schema: "openAPIDefinition" has error: "object instance has properties which are not allowed by the schema: ["headers"]"**

Expected behaviour
What you expected to happen

MockServer Log
Log output, as INFO level (or lower)

verifySequenceById is not a function

Describe the issue
Calling client.verifySequenceById() throws an error verifySequenceById is not a function

What you are trying to do
Trying to call client.verifySequenceById() method as it described in Typescript types -

verifySequenceById(...expectationIds: ExpectationId[]): Promise<void | string>;

MockServer version
5.13.2

To Reproduce
Steps to reproduce the issue:

I do not think it needs to reproduce, because it is obvious where is the error in the code.
Here function verifySequenceById is not exported, as for example verifySequence is exported -

verifySequence: verifySequence,

Expected behaviour
verifySequenceById to be callable because it exists and described in types

MockServer Log
Not relevant

Copy all proxied requests button

Describe the feature request
Now you can copy each individual request logged in the Proxied Requests, but I really could use a copy all that copies a list of all of it into the clipboard.

What you are trying to do
Easily re-mock tests that become outdated. REALLY IMPORTANT!

The solution you'd like
A button that copies everything in the Proxied Requests as a list in JSON format.

Describe alternatives you've considered
I could code this myself but I want to know if there is somebody with a lot of experience in the codebase such that they can do it much faster than I would if I had to pull this and work on this.

ClearById is not a function error

Describe the issue
Error when using the new function clearById:
TypeError: mockServerClient(...).clearById is not a function

What you are trying to do
Clear expectations using the expectation id

MockServer version
5.12.0

It looks like the new function hasn't been exported.

Fix package.json to include TypeScript typings

Describe the issue
The package.json files section doesn't include the TypeScript typings so they are not published.

What you are trying to do
Use TypeScript typings.

MockServer version
5.11.0

Wrong types for HttpRequestAndHttpResponse.httpResponse

Describe the issue
Newest mockserver-client types does not match returned value of function retrieveRecordedRequestsAndResponses.

What you are trying to do
When I retrieve recorded requests with retrieveRecordedRequestsAndResponses the types indicates that HttpRequestAndHttpResponse should have httpResponse as an array, but an object is returned.

MockServer version
5.15.0

To Reproduce
Steps to reproduce the issue:

  1. Run MockServer
  2. Hit to mock server
  3. Get value of retrieveRecordedRequestsAndResponses to see that types does not match the value.

Expected behaviour
Type HttpRequestAndHttpResponse.httpResponse should be object type instead of an array.

verify does not work according to docs in 5.6.0

Impact: I haven't found any way to actually use verify call successfully in node client
Expectation: using documentation example (although using it with async) successfully verifies request
Actual outcome: error is thrown, verification is not done.

object instance has properties which are not allowed by the schema: ["atLeast","atMost"] for field "/times"

try {
  const outcome = await mockServerClient("localhost", 1080)
    .verify(
        {
            'method': 'POST',
            'path': '/somePath',
            'body': 'someBody'
        }, 
        1, true
    );
} catch(error){
  console.error(error.message);
}
console.log(`outcome: ${outcome}`);

//expected:
// outcome: ...
//
// actual:
// object instance has properties which are not allowed by the schema: ["atLeast","atMost"] for field "/times"

Cannot install mockserver-client-node on Ubuntu

Describe the issue
When I try to install via npm I get error

What you are trying to do
npm install mockserver-client --save-dev

MockServer version
latest

To Reproduce
Steps to reproduce the issue:
npm install mockserver-client --save-dev

I got

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  undefined
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sergeis/.npm/_logs/2021-04-30T11_15_41_302Z-debug.log

Expected behaviour
mockserver is installed

MockServer Log
Log output, as INFO level (or lower)

Add Promise support

Describe the feature request
Add Promise support. The package methods are currently returning objects with a then property which make them look like they're returning Promises but are not. This goes against the TS type definitions which clearly indicate that the return type is a Promise!

What you are trying to do
While implementing some integration tests using Jest and MockServer client, I've found that this package doesn't support Promises when I tried to do this:

await expect(mockServerClient.verify({ ... })).resolves.toBeUndefined();

The Jest expection still passes when an error is returned by verify method because verify is not returning a Promise!

The solution you'd like
Promise support should be added, so that the above example can work. This can be achieved by wrapping the current methods with new Promise((resolve, reject) => {}) (configurable?) or by rewriting the whole package with Promises in mind.

CORS issue

I'm getting a CORS error when trying to POST to my mockserver from another port on localhost. I'm using setDefaultHeaders to set Access-Control-Allow-Origin to all. Is there something I'm doing wrong?

Problem with ssl certificates

Hello,

I want to mock the server for my mobile application. Currently I stacked on ssl certificate. Can you please provide exact steps how I can get ssl certificate used by mock-server for ssl communication and use it on mobile?
Thank you for your help.

Ivan

Calling callback instead of returning promise ?

The fact that you return Promise from mock call more or less forces client code to use Q library. Would you be open to call a callback like it's done in most of the places in node world ?

"object is not extensible" error with Protractor 3.0

Getting this error when using protractor 3.0.0:

 Message:
    Failed: Can't add property resolve, object is not extensible
  Stack:
    TypeError: Can't add property resolve, object is not extensible
        at sendRequest (/Users/krogers/bc/docker-snooze/node_modules/mockserver-client/index.js:21:30)
        at Object.reset (/Users/krogers/bc/docker-snooze/node_modules/mockserver-client/index.js:249:24)
        at Object.<anonymous> (/Users/krogers/bc/docker-snooze/tests/e2e/specs/status.spec.js:19:27)
    From: Task: Run beforeEach in control flow
    From asynchronous test: 
    Error
        at Suite.<anonymous> (/Users/krogers/bc/docker-snooze/tests/e2e/specs/status.spec.js:17:5)
        at Object.<anonymous> (/Users/krogers/bc/docker-snooze/tests/e2e/specs/status.spec.js:14:1)

Maybe switch to copying deferred.fulfill = deferred.resolve when using Q and use fulfill instead of resolve?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.