Skip to content

Commit b5928c1

Browse files
committed
travis and coveral adaptation.
1 parent 77fd648 commit b5928c1

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

.coveralls.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
service_name: travis-ci

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
before_install:
5+
- chmod +x mvnw
6+
install:
7+
- ./mvnw test-compile -DskipTests=true -Dmaven.javadoc.skip=true -B -V
8+
script:
9+
- ./mvnw test jacoco:report
10+
after_success:
11+
- ./mvnw coveralls:report

BankApplicationBackend/pom.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
99
<version>2.1.3.RELEASE</version>
10-
<relativePath /> <!-- lookup parent from repository -->
10+
<relativePath />
1111
</parent>
1212
<groupId>com.demo</groupId>
1313
<artifactId>BankApplicationBackend</artifactId>
@@ -78,6 +78,25 @@
7878
<groupId>org.springframework.boot</groupId>
7979
<artifactId>spring-boot-maven-plugin</artifactId>
8080
</plugin>
81+
<plugin>
82+
<groupId>org.jacoco</groupId>
83+
<artifactId>jacoco-maven-plugin</artifactId>
84+
<version>0.7.6.201602180812</version>
85+
<executions>
86+
<execution>
87+
<id>prepare-agent</id>
88+
<goals>
89+
<goal>prepare-agent</goal>
90+
</goals>
91+
</execution>
92+
</executions>
93+
</plugin>
94+
<plugin>
95+
<groupId>org.eluder.coveralls</groupId>
96+
<artifactId>coveralls-maven-plugin</artifactId>
97+
<version>4.3.0</version>
98+
</plugin>
99+
81100
</plugins>
82101
</build>
83102

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<img align="left" width="48" height="48" src="./spring-boot-logo.jpg">
2+
3+
# Spring Boot Application Example
4+
5+
[![Build Status](https://travis-ci.org/mertakdut/Spring-Boot-Sample-Project.svg?branch=master)](https://travis-ci.org/mertakdut/Spring-Boot-Sample-Project)
6+
[![Coverage Status](https://coveralls.io/repos/github/mertakdut/Spring-Boot-Sample-Project/badge.svg?branch=master)](https://coveralls.io/github/mertakdut/Spring-Boot-Sample-Project?branch=master)
7+
8+
## Installation Instructions
9+
You can import the project as a maven application to your favorite IDE. I made my tests by using eclipse jee-2018-12.
10+
11+
If lombok gets in your way, by referring [this answer](https://stackoverflow.com/a/22332248/4130569), you can install lombok by its jar file.
12+
13+
## To run the application
14+
Use one of the several ways of running a Spring Boot application. Below are just three options:
15+
16+
1. Build using maven goal (or by using maven wrapper): `mvn clean package` and execute the resulting artifact as follows `java -jar BankApplicationBackend-0.0.1-SNAPSHOT.jar` or
17+
2. On Unix/Linux based systems: run `mvn clean package` then run the resulting jar as any other executable `./BankApplicationBackend-0.0.1-SNAPSHOT.jar`
18+
3. Run as a [Docker](https://www.docker.com/) container.
19+
1) Clone the repository.
20+
2) cd to project root directory.
21+
3) `docker build -t demo/bankapp .`
22+
* If you get a `./mvnw not found` error, just run `mvn -N io.takari:maven:wrapper -Dmaven=3.5.3` while in the root directory of the project.
23+
4) `docker run --expose 8080 -p 8080:8080 demo/bankapp`
24+
25+
## To test the application
26+
1. Create a user with /api/user/create url.
27+
28+
`$ curl -X POST localhost:8080/api/user/create -d "{\"username\": \"yourUsername\", \"password\": \"yourPassword\", \"tcno\": \"12512561125\"}" -H "Content-Type:application/json"`
29+
You'll get a response as in below.
30+
31+
`{"username":"yourUsername","tcno":"12512561125"}`
32+
2. Generate an access token by api/login url.
33+
34+
`$ curl -H "Content-Type: application/json" -X POST -d "{\"username\": \"yourUsername\", \"password\": \"yourPassword\"}" http://localhost:8080/api/login`
35+
36+
You'll be getting an access token similar to this.
37+
38+
`eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5b3VyVXNlcm5hbWUiLCJleHAiOjE1NTI0NDMzNjZ9.0WSCg4vaP7BVeJz8tQnL3s-BYjBB6UWXlQKCZHm1_zqEVIiA8_71Ni7tbPDm2DbW-Qc_fPP9CQF1jKcRC9njFQ`
39+
40+
3. Use the token to access content available to all authenticated users, through the RESTful API
41+
42+
Http.Get request example:
43+
`curl -i -H "Accept: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5b3VyVXNlcm5hbWUiLCJleHAiOjE1NTI0NDMzNjZ9.0WSCg4vaP7BVeJz8tQnL3s-BYjBB6UWXlQKCZHm1_zqEVIiA8_71Ni7tbPDm2DbW-Qc_fPP9CQF1jKcRC9njFQ" -X GET http://localhost:8080/api/user/find/all`
44+
45+
Http.Post request example:
46+
`curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5b3VyVXNlcm5hbWUiLCJleHAiOjE1NTI0NDMzNjZ9.0WSCg4vaP7BVeJz8tQnL3s-BYjBB6UWXlQKCZHm1_zqEVIiA8_71Ni7tbPDm2DbW-Qc_fPP9CQF1jKcRC9njFQ" -X POST -d "{\"username\": \"yourUsername\", \"buying\": \"true\", \"currency\": \"USD\", \"amount\": \"250\"}" http://localhost:8080/api/transaction/create`

0 commit comments

Comments
 (0)