Sign inSign up

parasoft/parabank

By parasoft

Updated about 6 hours ago

ParaBank demo application

Image
4

10K+

parasoft/parabank repository overview

Quick reference

What is ParaBank?

ParaBank is a Web application to demonstrate Web, API and other software testing functionality of Parasoft products.

How to use this image

To run the image:

$ docker run -d -p 8080:8080 -p 61616:61616 -p 9001:9001 parasoft/parabank

Note: you can skip the following ports if you don't plan to directly connect to the following Parabank's endpoints:

  • 61616 - Loan Processor JMS service endpoint
  • 9001 - Parabank and Bookstore SQL database endpoint

Injecting Jtest coverage agent into ParaBank Docker image

1. Locate the Jtest monitor directory containing Jtest agent jar and configuration files.

For details how to create the monitor directory and Jtest integration with Tomcat see Web Application Coverage Tutorial section of the Jtest docs.

This example will use C:\jtest\monitor path for the monitor directory.

2. Run parabank container with the following options:

docker run -p 8080:8080 -p 8050:8050 -e CATALINA_OPTS=-javaagent:"/home/docker/jtest/monitor/agent.jar"=settings="/home/docker/jtest/monitor/agent.properties",runtimeData="/home/docker/jtest/monitor/runtime_coverage" -v C:\jtest\monitor:/home/docker/jtest/monitor parasoft/parabank

Port 8050 is optional, and can be used to check the Jtest agent status at http://your-parabank-host:8050/status

C:\jtest\monitor is a Jtest monitor directory on your local machine, /home/docker/jtest/monitor is a directory in the container that is mapped to the C:\jtest\monitor directory on your local machine. You can replace the /home/docker/jtest/monitor path with a valid path of your choice.

Alternatively you can put the CATALINA_OPTS property in a file and use Docker run --env-file option instead:

docker run -p 8080:8080 -p 8050:8050 --env-file my-env.txt -v C:\jtest\monitor:/home/docker/jtest/monitor parasoft/parabank

Or you can set CATALINA_OPTS environment variable in the console you use to run docker and pass only the variable name to the -e option of the docker run command:

docker run -p 8080:8080 -p 8050:8050 -e CATALINA_OPTS -v C:\jtest\monitor:/home/docker/jtest/monitor parasoft/parabank

3. Inspect the C:\jtest\monitor directory on your machine, a runtime_coverage folder should contain coverage data.

Injecting Virtualize JDBC driver into ParaBank

1. Assemble Virtualize JDBC dependencies

1.1 Copy <VIRTUALIZE_INSTALL_DIR>/proxies/ParasoftJDBCDriver.jar to a directory of your choice (<VIRT_JDBC_DIR>).

1.2 In <VIRT_JDBC_DIR> create a jdbc.properties file with the following content:

jdbc.driverClassName=com.parasoft.xtest.jdbc.virt.driver.JDBCProxyDriver
jdbc.url=jdbc:parasoft:proxydriver:org.hsqldb.jdbcDriver:@jdbc:hsqldb:hsql://localhost/parabank
jdbc.username=sa
jdbc.password=

1.3 In <VIRT_JDBC_DIR> create a my-env.txt file with the following content:

CATALINA_OPTS=-Dparasoft.virtualize.server.url=http://<VIRT_SERVER_HOST>:9080 -Dparasoft.virtualize.group.id=parabank -Dparasoft.virtualize.driver.register.jdbcproxydriver.in.drivermanager=true -Dparasoft.virtualize.driver.proxy.direct=true

Replace <VIRT_SERVER_HOST> with the IP address where your Virtualize Server is running. Use host.docker.internal as Docker replacement for localhost if your Virtualize Server is running on the same host as your ParaBank Docker container.

2. Start the Virtualize server

Open Parasoft Virtualize and start the Server.

3. Run ParaBank container

In the command line below replace <VIRT_JDBC_DIR> with the absolute path of the folder where you assembled Virtualize JDBC dependencies in step 1. Alternatively, instead of specifying the absolute path you can use %cd% (Windows) or ${PWD} (Linux) shortcut to get the absolute path of the current directory, such as %cd%\ParasoftJDBCDriver.jar or ${PWD}/ParasoftJDBCDriver.jar.

docker run -p 8080:8080 --env-file <VIRT_JDBC_DIR>\my-env.txt -v <VIRT_JDBC_DIR>\ParasoftJDBCDriver.jar:/usr/local/tomcat/webapps/parabank/WEB-INF/lib/ParasoftJDBCDriver.jar -v <VIRT_JDBC_DIR>\jdbc.properties:/usr/local/tomcat/webapps/parabank/WEB-INF/classes/jdbc.properties parasoft/parabank

4. Verify the parabank JDBC Controller

Open the ParaBank Web page.

Refresh the Virtualize Server - a parabank JDBC Controller should appear in the Server tree view.

Note: Parasoft JDBC driver expects a special Virtual Asset to handle logging at the http://<VIRT_SERVER_HOST>:9080/ServerLogger?type=log URL, so unless you have set it up as described in the Configuring Logging for JDBC Operations section of the Virtualize docs you will see the following errors in the ParaBank Docker console:

Catch report, error getting input stream from connection.
java.io.FileNotFoundException: http://host.docker.internal:9080/ServerLogger?type=log

Alternatively, to get rid of this error double click on the parabank JDBC controller in the Virtualize Server tree view and set Destination type field of the Logging panel to Stdout. The logging messages of the Parasoft JDBC driver will be printed in the ParaBank Docker console.

Tag summary

Content type

Image

Digest

sha256:d68615049

Size

251.9 MB

Last updated

about 6 hours ago

docker pull parasoft/parabank