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
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# get base image
FROM adoptopenjdk/openjdk8

# install dependencies
ENV APP_HOME=usr/app
WORKDIR $APP_HOME
COPY ./target/cake-manager-1.0.0-SNAPSHOT.jar /usr/app

# Run default command
CMD ["java" ,"-jar","cake-manager-1.0.0-SNAPSHOT.jar"]
33 changes: 30 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,27 @@ Original Project Info

To run a server locally execute the following command:

`mvn jetty:run`
1# Run CakeManagerApplication class in any IDE will start the API from IDE.
2#
a. Compile application using 'mvn clean install' command.
b. run jar file using 'java -jar cake-manager-1.0.0-SNAPSHOT.jar'
3# Once the application is compiled and jar is ready create docker build and run from docker using below commands.
a. docker build -t cake-manager .
b. docker run -p 8282:8282 cake-manager

Note: 2 & 3 methods should run from application context from command terminal.


and access the following URL:

`http://localhost:8282/`
API testing and see sample JSON schema.
http://localhost:8282/swagger-ui.html

API usage for Integration
GET REQUEST: will display all the cakes list available in the system
http://localhost:8282/cakes
POST REQUEST: Alternatively system will allow to new cake entry to the system using post method using same endpoint.
http://localhost:8282/cakes

Feel free to change how the project is run, but clear instructions must be given in README
You can use any IDE you like, so long as the project can build and run with Maven or Gradle.
Expand All @@ -54,4 +70,15 @@ share it with us.

Please also keep a log of the changes you make as a text file and provide this to us with your submission.

Good luck!
Changes made:

1. upgraded project to Spring boot 2.7 version
2. Fixed issues in the existing implementation and API is now working
3. created a new POST method to create new entries in the system.
4. created a few unit tests to cover basic functionalities. Jacoco integrated to visualize test coverage can be find. In the target folder.
5. Simple Docker file is created to build and test the API service.
6. Integrated Swagger API to visualize and try out the API endpoints.
7. Documentation updated for all public methods.
8. YAML configuration added.
9. project structure changed for easy access and readability.

178 changes: 112 additions & 66 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,77 +1,123 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.waracle</groupId>
<artifactId>cake-manager</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>cake-manager Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.waracle</groupId>
<artifactId>cake-manager</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>cake-manager</name>
<description>Cake Manager API</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- JSON -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<!-- JPA -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>

<!-- In-memory database -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.4</version>
</dependency>
<!-- JSON -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.14.0</version>
</dependency>

<!-- Test dependencies. -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>
<!-- JPA -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

</dependencies>
<build>
<finalName>cake-manager</finalName>
<plugins>
<!-- In-memory database -->
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.4</version>
</dependency>

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- Test dependencies. -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.1</version>
<scope>test</scope>
</dependency>

<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<stopKey>STOP</stopKey>
<stopPort>8005</stopPort>
<httpConnector>
<port>8282</port>
</httpConnector>
</configuration>
</plugin>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>

<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.8</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

</plugins>
</build>
</project>
106 changes: 0 additions & 106 deletions src/main/java/com.waracle.cakemgr/CakeServlet.java

This file was deleted.

36 changes: 0 additions & 36 deletions src/main/java/com.waracle.cakemgr/HibernateUtil.java

This file was deleted.

Loading