In this demo you will
- Start locally HAM server
- Start the sample application
- Connect to it through proxy
- Record the simplified db interactions of the sample application
- Modify db data on the recording!
For more infos check here
Download the two tar.gz, ham and ham-samples from github releases and extract them in the same directory
Go on the "calendar" directory and run "runcalendardbproxy.bat/sh"
This will start
- H2 db server (tcp://localhost:9123, web console http://localhost:8082)
- ham (localhost:80)
- be (localhost:8100) proxied by http://localhost/int/be.sample.test
- gateway (localhost:8090) proxied by http://localhost/int/gateway.sample.test
- fe (localhost:8080)
First you should choose if you want to recreate the db go for Y the first time
Then you will have to wait a bit. Now DO NOT START THE BE!!
It's composed of three parts
- FE, that calls gateway for all its needs
- GATEWAY, that acts a "middleman" between FE and BE
- BE, with the database that is called only by the GATEWAY
Should set the proxy to 127.0.0.1 And port 1080 for socks5 or 1081 for http/https
Click me for more explanations
-
Chrome:
- Install Proxy Switch Omega
- Go to options
- Add http and https proxy server with
- Select "proxy" from the extension menu and back to "direct" when you want to disconnect
-
-
Firefox
- Now you can start the application on the command line :) and wait for its readiness
- Stop it
- Run the benogen.bat/sh but do not press a key to continue!
You can now check the configuration
- Going on ham proxyes you can verify that all proxies are ok if they don't work just "Refresh Status"
- And a db proxy for be
- Then you can create a recording on the recording page
- Set the recording with the simplified recording! This will record only "most important" stuffs. What can't be simulated will be recorded
- Once you create the recording you can start recording! CHECKING THE "Record db calls" and the "Use simulated engine"
-
Now you can press the key on the benogen! And start the application
-
Wait for its start
-
Go then on the application and do some interaction
- Add an Employee "John Doe"
- Go on Appointements
- Add an Appointment with "Doctor" as description
- Change the state of the appointament till it shows "Confirmed"
- Delete the appointment
- Back on employee, delete the employee too
-
And stop the recording!
-
Now you will se all the calls on the just created recording
-
First the hibernate initialization phase
- ..or see how an employee is created.
- First a post to the gateway
- Forwarded to the be
- Then the be opens the connections and run the query
- You can even see the details of the queries there are many visualisations available
- JSON: the native format of Janus-Jdbc (editable)
- Component: the "easy editable visualisation", when available
- Tree: the structure of the json message (that include the data types)
Analyzing the Json we identify a prepared statement with one Long parameter with set the index 1 (the first to set JDBC prepared statement parameters)
{
"command": {
"sql": "
select
employee0_.id as id1_1_0_,
employee0_.name as name2_1_0_,
employee0_.role as role3_1_0_
from
employee employee0_
where employee0_.id=?",
":sql:": "java.lang.String",
"parameters": [
{
"_": {
"columnindex": 1,
":columnindex:": "java.lang.Integer",
"value": 0,
":value:": "java.lang.Long"
},
":_:": "org.kendar.janus.cmd.preparedstatement.parameters.LongParameter"
}
],
":parameters:": "java.util.ArrayList"
},
":command:": "org.kendar.janus.cmd.preparedstatement.PreparedStatementExecuteQuery"
}
- Select all 'http' type calls and delete them
- "Download" the recording as "SimplifiedDb.json"
- Look for the first PreparedStatement/executeQuery and edit it
- Go then on RESDATA/COMPONENT
- Add a row (1), save the JdbcResultSet (2) and the Selected item (3)
- Stop the benogen
- Play the recording with the "Use simulated engine" checked
- Restart the benogen!
- Go on www.sample test and be happy :)
















