Oracle Developers
Published in

Oracle Developers

Build, deploy and test a Redis based Java application using Oracle Cloud

This blog will demonstrate how to get started with a Redis based Java application

  • Run it on Oracle Application Container cloud and CI/CD using Oracle Developer cloud

Application

Here is a summary of the what the application is about

  • Exposes REST endpoints using Jersey

Here is the application

NoSQLunit

NoSQLUnit is an open source testing framework for applications which use NoSQL databases. It works on the concept of (JUnit) Rules and a couple of annotations. These rules are meant for both database lifecycle (start/stop) as well as state (seeding/deleting test data) management. In the sample application, we use it for state management for Redis instance i.e.

  • with the help of a json file, we define test data which will be seeded to Redis before our tests start and then

Our test dataset in json format

NoSQLUnit in action

Setup

Redis on Oracle Container Cloud

  • Use the existing service or create your own (make sure you expose the default Redis port to the host IP) — documentation here

Configure Oracle Developer Cloud

We’ll start with bootstrapping the application in Oracle Developer Cloud. Check this section for reference Project & code repository creation. Once this is done, we can now start configuring our Build which is in the form of a pipeline consisting of the build, deployment, integration test and tear down phases

Build & deploy phase

The code is built and deployed on Oracle Application Container cloud. Please note that we are skipping the unit test part in order to keep things concise

Build step

Post-build (deploy)

Deployment

At the end of this phase, our application will be deployed to Application Container Cloud — its time to configure the integration tests

Integration test phase

Our integration tests will run directly against the deployed application using the Redis instance (on Oracle Container Cloud which we had setup earlier). For this

  • we define another build job and

Integration build job

Define the dependency

Tear Down phase

Thanks to Oracle Developer Cloud integration with Oracle PaaS Service Manager (PSM), it’s easy to add a PSMcli build step that invokes Oracle PaaS Service Manager command line interface (CLI) command to stop our ACCS application once the pipeline has been executed. More details in the documentation

We covered the following

  • Built a Java application on top of Redis

Don’t forget to…

The views expressed in this post are my own and do not necessarily reflect the views of Oracle.

--

--

Aggregation of articles from Oracle engineers, Groundbreaker Ambassadors, Oracle ACEs, and Java Champions on all things Oracle technology. The views expressed are those of the authors and not necessarily of Oracle.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhishek Gupta

Principal Developer Advocate at AWS | I ❤️ Databases, Go, Kubernetes