Skip to content

AjayShukla1212/mock-lib-impl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mock Library Implementation

Description

Welcome to the Mocking Library project! This project showcases how to effectively mock Java libraries in a Spring Boot application using a Java agent with Byte Buddy. It's a comprehensive guide to setting up and running a mock environment for your Java applications.

Structure

Here's a quick rundown of the project structure:

  • app/: Contains the Spring Boot application.
  • agent/: Houses the Java agent that intercepts and mocks library functions.
  • docker-compose.yml: Docker Compose configuration to run both the application and the agent seamlessly.

How to Build and Run

Follow these steps to get the project up and running:

  1. Build the Docker image

    docker-compose build 
  2. Start the containers:

    docker-compose up
  3. Test the application by sending a POST request:

    curl -X POST http://localhost:8080/api/createNewPost -H "Content-Type: application/json" -d '{"post_name":"test-post","post_contents":"This is a test post"}'

Environment Variables

To configure the application, you'll need to set the following environment variables:

  • HT_MODE: The mode for the Java agent. It can be set to either RECORD or REPLAY.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published