jamesdbloom / mockserver-grunt Goto Github PK
View Code? Open in Web Editor NEWNode.js module and grunt plugin to start and stop MockServer and MockServer Proxy
Home Page: http://mock-server.com/
Node.js module and grunt plugin to start and stop MockServer and MockServer Proxy
Home Page: http://mock-server.com/
I am trying to match the SOAP webservices request body to set the expectations.
My web services request content is too long to have all the values in the expectation. Is it possible to use wildcard approach with regex to match the pattern?
If yes, could you please provide an example for the same?
What do you think of adding callback function to start_mockserver call to be able to define expectations once server is started ?
It will provide async capability to the end users.
Something like this:
mockserver.start_mockserver({
serverPort: 1080,
serverSecurePort: 1082,
proxyPort: 1090,
proxySecurePort: 1092,
verbose: true
}, function() {
console.log('Ready');
});
If you are open to this I can apply it soon.
I was all decided to go ahead and write a mockserver-client
wrapper in ScalaJS for using as a backend when testing some browser-sensible code so I took the liberty of going to http://webjars.org to make it grab your mockserver-grunt
NPM module so I can reference the library in SBT.
Unfortunately in the moment I hit "Build WebJar" I got this:
All attempts to determine an acceptable license have been exhausted. The package.json file did not contain a spec-compliant license definition and the license could not be determined by trolling through the source repo: git+https://github.com/jamesdbloom/mockserver-grunt The acceptable open source software licenses are at: https://bintray.com/docs/api/#_footnote_1 The provided licenses were: Apache This problem will likely need to be resolved by working with the library maintainers directly. If you feel you have reached this failure in error, please file an issue: https://github.com/webjars/webjars/issues
The issue seems to be that the "license type" referenced in the package.json
must be either Apache-1.0
or Apache-2.0
(see https://bintray.com/docs/api/#_footnote_1) whilst current file only says Apache
.
As discussed.
var commandLineOptions = ['-Dfile.encoding=UTF-8', '-Dmockserver.logLevel=TRACE', '-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005', '-jar', glob.sync('**/mockserver-netty-*-jar-with-dependencies.jar')];
I installed [email protected]
and I'm still getting grunt@~0.4
as a peerDependency. I believe it's because the version was not bumped after the changes introduces by this e81d8cf merge.
Can you please create a new release that includes these changes?
Hey.
I'm utilizing mockserver for protractor tests to mock a server. Runs otherwise fine but stopping the mock server fails due to following error:
Using port '8500' to stop MockServer and MockServer Proxy
TypeError: callback is not a function
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
[09:39:24] E/launcher - Process exited with error code 1
Using node v4.6.1 on Linux machines
Hi @jamesdbloom,
I was running tests on very fast environment and realised that tests are failing with ECONNREFUSED when server starts too fast your check functions assumes everything is all right and passes control to tests to define the mocks and they fail cuz server seems to be not fully initialised.
request(options, function (error, response) {
if (error) {
deferred.reject(new Error(error));
} else {
setTimeout(fundeferred.resolve(response); }, 4000);
}
});
This was the quick solution. but it's ugly. I'm thinking on how to get this solved properly and will send pull request. If you have any ideas let me know.
request(options, function (error, response) {
if (error) {
deferred.reject(new Error(error));
} else {
setTimeout(function() { deferred.resolve(response); }, 4000);
}
});
when I run the server via grunt and want to keep it active i am doing:
grunt start_mockserver
Then when finished I expected to be able to do:
grunt stop_mockserver
but it fails as it defaults to port 80.
stop_mockserver ignores the port settings unless run in the same task group within grunt like the tests are so the test port is still defined.
I've been looking for a way to mock an external api for quite some time and was very happy to find your mockserver packages for Node!
I've been able to use your mockserver-client
without issues while running the mockserver itself through Homrebrew.
However I have not been as succesful running mockserver itself with the help of your mockserver-grunt
package.
// When calling it like so, the promise will never execute:
var mockserver = require('mockserver-grunt');
mockserver
.start_mockserver({ serverPort: 3200, verbose: true })
.then(() => { console.log('loaded mockserver') ;} )
// I will see this printed though and the server will respond at the defined port
Skipping {"host":"oss.sonatype.org","path":"/content/repositories/releases/org/mock-server/mockserver-netty/3.10.6/mockserver-netty-3.10.6-jar-with-dependencies.jar","port":443} as file already downloaded
{ state: 'pending' }
> Running 'java -Dfile.encoding=UTF-8 -Dmockserver.logLevel=INFO -jar mockserver-netty-3.10.6-jar-with-dependencies.jar -serverPort 3200'
waiting for MockServer to start retries remaining: 100
...
waiting for MockServer to start retries remaining: 3
waiting for MockServer to start retries remaining: 2
waiting for MockServer to start retries remaining: 1
MockServer failed to start
2017-05-02 23:16:51,862 INFO o.m.m.MockServer MockServer started on port: 3200
// And when trying to stop it I'll see this
mockserver.stop_mockserver()
TypeError: Cannot read property 'serverPort' of undefined
...
The promise hooks would be greate for testing.
I'm on macOS, running node 4.6.2
and using "devDependencies": { "mockserver-grunt": 1.0.38" }
.
Thank you in advance.
bower doesn't seem to be able to manage the jar file within the package.
change the execution process to check whether the jar file is present and download the correct version if its not present.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.