Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/mock-server"
schedule:
interval: daily
time: "23:30"
open-pull-requests-limit: 10
94 changes: 94 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Default ignored files
/shelf/
/workspace.xml
.idea

/target/
/target/classes/application.properties
/target/classes/

#########from online
##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*

##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar

##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
*.ipr
*.iws

##############################
## Eclipse
##############################
.settings/
bin/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath

##############################
## NetBeans
##############################
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace

##############################
## OS X
##############################
.DS_Store
42 changes: 31 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
# Mock-server
Create and use custom responses. No need to wait for the backend!

## What is it?
**Description** : Create mock response to test your backend or downstream REST calls for any service.
It can be used to integration with any service without calling actul service.


- Spring boot application to mock API requests quickly.
- Integrated UI makes designing mock requests easier.
- All mock requests are persisted in MongoDB.
- Can be used to mock both REST and SOAP APIs.
- All mock response are persisted in MongoDB.
- Can be used to mock REST APIs
- Can mock request to be sent to any service.
- Mock response to any request from other service.
- Test Service as a whole with endpoints by mocking request and response for a service.
- Uses ReactiveMongo for db connection.

## Installation notes for creating your own server
1. Install MongoDB
1. Run the app using spring boot or create an uber jar to deploy
- **Technology stack** : Standalone Springboot appliation providing RESTful service written in JAVA 8 with Maven as Build tool and MongoDB as Database.

## Usage
1. Design your API response, customize headers and status
1. Add network delay, if needed
1. Hit submit, your mock link http://localhost:8080/mock/{mockUUID} is ready

## Screenshot
![Screenshot](https://github.com/kunwardeeps/mock-server/raw/master/mock-server/src/images/screenshot.png)

## Dependencies
1. Language: Java 8
2. Database: MongoDb
3. Framework: SpringBoot
4. Build tool: Maven

## Installation Notes:
1. Install MongoDB or use any cloud service for mongodb.
2. Run the app using spring boot or create an jar to deploy.

## Configuration:
1. Configure mongoDb instance/uri in application.yml

## Usage
1. Design your API response, customize headers and status
2. Add network delay, if needed
3. Hit submit, your mock link http://localhost:8080/mock/{mockUUID} is ready


68 changes: 49 additions & 19 deletions mock-server/pom.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<groupId>com.mockapi</groupId>
<artifactId>mock-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>demo</name>
<description>Demo project for Spring Boot</description>
<name>mock-server</name>
<description>Mocking server developed with Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<version>2.5.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand All @@ -35,30 +35,31 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>


<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>provided</scope>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<dependency>
Expand All @@ -67,12 +68,38 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-facebook</artifactId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
Expand All @@ -84,6 +111,9 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
24 changes: 0 additions & 24 deletions mock-server/src/main/java/com/mockapi/MockController.java

This file was deleted.

92 changes: 0 additions & 92 deletions mock-server/src/main/java/com/mockapi/MockRestController.java

This file was deleted.

Loading