trying to start a standalone wiremockcsv application - wiremock

Has any one tried wiremock csv standalone application?
I did a mvn clean install for wiremockcsv and the build is successfull. I can see wiremockcsv-1.1.1-standalone.jar in my target folder. Then launched using the below command in my terminal
java -jar "##MyProjectPath##/WireMockCsv/target/wiremockcsv-1.1.1-standalone.jar" --port 8181 --root-dir ".\src\test\resources\factures\mock" --verbose
The application is launched successfully. But when I hit the below request in postman I get not found response. Can someone help me what I am missing here.
http://localhost:8181/rechercherClients
Response:
Error 404
HTTP ERROR: 404
Problem accessing /__files/rechercherClients. Reason:
<pre> Not Found</pre>
</p>
<hr />
<i>
<small>Powered by Jetty://</small>
</i>
and in my terminal i can see this
Matched response definition:
(no response definition configured)
When i hit http://localhost:8181/__admin
I get below response
{
"mappings": [],
"meta": {
"total": 0
}
}
Am i missing something?

With the demo project, the mappings are already done, it's ready to launch with examples of all features.
In your case, the command line is not correct, if the current directory is not the project's base, it will not work, ##MyProjectPath## should be path of your project
Try this:
java -jar "##MyProjectPath##\WireMockCsv\target\wiremockcsv-1.1.1-standalone.jar" --port 8181 --root-dir "**##MyProjectPath##**\src\test\resources\factures\mock" --verbose
Or better and easier, directly with the provided Eclipse Launch Config ;-)

Related

JPAM Configuration for Apache Drill

I'm trying to configure PLAIN authentification based on JPAM 1.1 and am going crazy since it doesnt work after x times checking my syntax and settings. When I start drill with cluster-id and zk-connect only, it works, but with both options of PLAIN authentification it fails. Since I started with pam4j and tried JPAM later on, I kept JPAM for this post. In general I don't have any preferences. I just want to get it done. I'm running Drill on CentOS in embedded mode.
I've done anything required due to the official documentation:
I downloaded JPAM 1.1, uncompressed it and put libjpam.so into a specific folder (/opt/pamfile/)
I've edited drill-env.sh with:
export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"
I edited drill-override.conf with:
drill.exec: {
cluster-id: "drillbits1",
zk.connect: "local",
impersonation: {
enabled: true,
max_chained_user_hops: 3
},
security: {
auth.mechanisms: ["PLAIN"],
},
security.user.auth: {
enabled: true,
packages += "org.apache.drill.exec.rpc.user.security",
impl: "pam",
pam_profiles: [ "sudo", "login" ]
}
}
It throws the subsequent error:
Error: Failure in starting embedded Drillbit: org.apache.drill.exec.exception.DrillbitStartupException: Problem in finding the native library of JPAM (Pluggable Authenticator Module API). Make sure to set Drillbit JVM option 'java.library.path' to point to the directory where the native JPAM exists.:no jpam in java.library.path (state=,code=0)
I've run that *.sh file by hand to make sure that the necessary path is exported since I don't know if Drill is expecting that. The path to libjpam should be know known. I've started Sqlline with sudo et cetera. No chance. Documentation doesn't help. I don't get it why it's so bad and imo incomplete. Sadly there is 0 explanation how to troubleshoot or configure basic user authentification in detail.
Or do I have to do something which is not told but expected? Are there any Prerequsites concerning PLAIN authentification which aren't mentioned by Apache Drill itself?
Try change:
export DRILLBIT_JAVA_OPTS="-Djava.library.path=/opt/pamfile/"
to:
export DRILL_JAVA_OPTS="$DRILL_JAVA_OPTS -Djava.library.path=/opt/pamfile/"
It works for me.

How to debug JavaScript tests in JHipster applications using Karma?

I have a simple monolithic application generated using JHipster v4.10.1 with front-end using Angular 4.x. To run JavaScript unit tests, as suggested in the documentation I ran
./node_modules/karma/bin/karma start src/test/javascript/karma.conf.js --debug
The command runs the tests, reports coverage summary and exits, whether tests all pass or some test fail does not matter. Test run output does show at one point that the debug server is loaded:
21 11 2017 13:41:20.616:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
But because the command exits, the Karma debug server can not be accessed. How to run tests so that Karma console can be used in browser to debug?
Figured out that the magic flag is actually single-run which seems to be true by default. So the main command to run for JS debug is:
yarn test --single-run=false
which in turn runs
$ karma start src/test/javascript/karma.conf.js --single-run=false
With this the command will only exit with explicit kill e.g. with Ctrl+C or Z. Karma debug console can then be accessed on http://localhost:9876/debug.html (assuming default port is not already busy. If it is, test output should tell you which port was chosen).
Additionally you need to disable minimization (and also istanbul config - not sure why) so that you can breakpoint and step through the .ts code in debugger easily. I figured this is done by making following changes in webpack/webpack.test.js file:
Remove following istanbul config from module.rules array:
{
test: /src[/|\\]main[/|\\]webapp[/|\\].+\.ts$/,
enforce: 'post',
exclude: /(test|node_modules)/,
loader: 'sourcemap-istanbul-instrumenter-loader?force-sourcemap=true'
}
Add minimize: false to the LoaderOptionsPlugin under plugins array:
new LoaderOptionsPlugin({
minimize: false,
options: {
tslint: {
emitErrors: !WATCH,
failOnHint: false
}
}
})

webdriver-manager update failed to download chrome driver and update-config.json

When I clean webdriver-manager and update, it is unable to download chrome driver and update-config.json. Later on when I start protractor it is complaining couldn't find update-config.json.
package.json
"scripts": {
"webdrivermanager:update": "node node_modules/protractor/bin/webdriver-manager update --versions.standalone=3.4.0 --ignore_ssl",
"webdrivermanager:clean": "node node_modules/protractor/bin/webdriver-manager clean",
"install": "npm run webdrivermanager:clean && npm run webdrivermanager:update"
}
protractor.conf.js
seleniumServerJar: '../../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar',
multiCapabilities: [
{browserName: 'chrome'}
//specify if any other browser
],
directConnect: true,
Now when I do npm install, I can not see chrome driver and
update-config.json at
node_modules\protractor\node_modules\webdriver-manager\selenium
location
webdriver-manager update log
> node node_modules/protractor/bin/webdriver-manager update --versions.standalon
e=3.4.0 --ignore_ssl
[09:58:34] I/http_utils - ignoring SSL certificate
(node:10944) UnhandledPromiseRejectionWarning: Unhandled promise rejection (reje
ction id: 1): TypeError: Cannot read property 'ListBucketResult' of undefined
[09:58:34] I/downloader - curl -o C:\..\..\node_mo
dules\protractor\node_modules\webdriver-manager\selenium/selenium-server-standal
one-3.4.0.jar https://selenium-release.storage.googleapis.com/3.4/selenium-serve
r-standalone-3.4.0.jar
[09:58:35] I/downloader - curl -o C:\..\..\node_mo
dules\protractor\node_modules\webdriver-manager\selenium/geckodriver-v0.16.1.zip
https://github.com/mozilla/geckodriver/releases/download/v0.16.1/geckodriver-v0
.16.1-win64.zip
[09:58:36] I/update - geckodriver: unzipping geckodriver-v0.16.1.zip
In my log also chrome driver is not downloading anymore. For this reason I can not start my protractor as update-config.json is not available. Any idea would be great. Thanks
During a previous update call, the xml response was cancelled before the file could be created. There are two options (features to fix this are not complete yet):
delete the chrome-response.xml and then call update again
wait an hour and make an update request again. The last modified time will invalidate that file and it will make a request and will replace the chrome-response.xml.
On my end, if my webdriver-manager instance was closed.
I am required to delete npm and npm-cache folders from roaming and reinstall protractor again.
Right after installing protractor, webdriver-manager update needs to be executed immediately.
If an error appears, make sure to run node.js cmd as an admin.
With these steps, I was able to download drivers properly.
That was very weird. I did everything nothing helped. Actual reason was my organization blocked the chrome driver api site. chrome-response.xml is the main clue that is showing access denied message so, I came to know actual reason.
I requested to #cnishina to thrown an actual error message if chrome driver website is not reached.

Phantom JS Karma runner connects but doesn't execute tests in C9.io

I followed the directions as per the Karma website to run Karma in the Cloud9 IDE (http://karma-runner.github.io/0.10/plus/cloud9.html)
my karma.config correctly contains:
hostname: process.env.IP,
port: process.env.PORT,
runnerPort: 0,
my terminal output:
Running "karma:test" (karma) task
INFO [karma]: Karma v0.10.10 server started at http://0.0.0.0:8080/
INFO [launcher]: Starting browser PhantomJS
WARN [launcher]: PhantomJS have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start PhantomJS again.
I am able to see the words "Karma starting..." at
http://..c9.io/
However, I receive the following error logged in my console:
Mixed Content: The page at 'https://test-raptoria.c9.io/?
_c9_id=livepreview24&_c9_host=https://ide.c9.io' was loaded
over HTTPS, but requested an insecure XMLHttpRequest
endpoint http://test-raptoria.c9.io/socket.io/
EIO=3&transport=polling&t=1426358810471-0'. This
request has been blocked; the content must be served over HTTPS.
Any ideas on how to fix this?? It seems like the requests are being blocked..
I've shared my workspace here:
https://ide.c9.io/raptoria/test
Thank you!
Could you try to change the request to socket.io to https? If that is not possible, Try loading the test-raptoria.c9.io with http instead of https.
I downloaded my entire workspace from test (without the data folder and dependencies), and created a new one called simple. I ran 'grunt test' again and it works. I must've corrupted my old workspace somehow.
Problem solved!
Thanks for helping me look into this.

node.js - can't get mongodb to work, may have installed wrong?

I guess this is a shot in the dark since there's not a lot of specific code I can show you...
but I'm using node and trying to use mongodb, however I can't get mongodb to connect. I've tried a couple of tutorials that should pretty much work out of the box. in several cases pages that don't seem to have any immediate reference to the database will load ok. For example, a 'posts/new' page will load. but '/' which likely makes reference to showing posts, will just hang silently (the browser shows page loading).
If for example I got so submit a new post the browser hangs and in the terminal i get:
Express app started on port 3000
Error: Invalid ObjectId
at Function.fromString (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js:27:11)
at ObjectId.cast (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/schema/objectid.js:99:16)
at ObjectId.castForQuery (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/schema/objectid.js:133:17)
at Query.cast (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/query.js:249:32)
at Query.findOne (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/query.js:851:10)
at Function.findOne (/Users/xxx/Node_projects/noobjs/node_modules/mongoose/lib/model.js:714:16)
at /Users/xxx/Node_projects/noobjs/routes/articles.js:13:13
at paramCallback (/Users/xxx/Node_projects/noobjs/node_modules/express/lib/router/index.js:259:7)
at param (/Users/xxx/Node_projects/noobjs/node_modules/express/lib/router/index.js:241:11)
at pass (/Users/xxx/Node_projects/noobjs/node_modules/express/lib/router/index.js:253:5)
GET /article/new 500
GET /articles/new 200
if it helps at all, here's the package.json for the tutorial app used above:
{
"name": "noobjs"
, "description": "A demo app in nodejs illustrating use of express, jade and mongoose"
, "version": "2.0.0"
, "private": true
, "author": "Madhusudhan M S (http://twitter.com/madhums)"
, "engines": {
"node": ">= 0.4.10"
}
, "dependencies": {
"express" : ">= 2.3.12"
, "jade" : ">= 0.12.4"
, "mongoose": ">= 1.4.0"
, "stylus" : ">= 0.13.7"
, "express-csrf" : ">= 0.3.3"
, "gzippo" : ">= 0.0.4"
, "express-messages" : ">= 0.0.2"
}
}
Also when I do ./mongod from the command line i get -bash: ./mongod: No such file or directory. Anything else I try from the terminal or browser doesnt seem to communicate with mongodb at all.
Let me know if there's anything I can do to diagnose/change my installation.
Step 0: ensure that MongoDB is running ps -ef | grep mongod. If it's not started, check the log file for the reason it failed.
Step 1: ensure that you can connect to MongoDB from the command line.
Step 2: check your connection method, there are several ways to do this, but ensure the you have the correct servername:post/dbname
Here's a blog post I wrote. That walks through a simple setup with Node.JS + MongoDB + Cloudfoundry. The simple setup works locally and on Cloudfoundry, so you should be able to ignore the Cloudfoundry steps and still get something working.