Skip to content

Commit aa376ef

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # docs/introduction.md # pom.xml # src/main/java/com/bootique/bootique/OrderItem.java
2 parents 793f21e + a6508c8 commit aa376ef

26 files changed

+1318
-895
lines changed

.mvn/wrapper/maven-wrapper.jar

-46.5 KB
Binary file not shown.

.mvn/wrapper/maven-wrapper.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.
322 KB
Binary file not shown.

README.md

Lines changed: 132 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,133 @@
1-
## Kotlin Bootique
1+
## Kotlin Bootique Workshop
22

3-
Documentation can be found in the [introduction](./docs/introduction.md) guide.
3+
### Introduction
4+
5+
Welcome to the Kotlin Bootique Workshop. The Kotlin Bootique application provides a very minimalistic implementation of a RESTful API for building a Webshop. The application consists of the following endpoints:
6+
7+
| Uri | HttpMethod | Description |
8+
| --------------------- | :-----------: | ------------------------------------------------- |
9+
| _/products_ | GET | retrieve product and price information |
10+
| _/baskets/{id}_ | GET | retrieve a shopping basket |
11+
| _/baskets/{id}/items_ | POST | adding an item to a basket |
12+
13+
Throughout this workshop you are going to convert this Spring Boot based application written in Java to the Kotlin equivalent. You will be guided through some of the challenges you as a developer will be facing while migrating existing applications to Kotlin.
14+
15+
If you are able to successfully complete this workshop, you should have enough knowledge to start using Kotlin in any of your (existing) Java projects.
16+
17+
### Prerequisites
18+
19+
This tutorial assumes that you at least have some basic knowledge about Java 8, Maven, Git and Spring Boot.
20+
21+
#### Git
22+
23+
Download and install git from [https://git-scm.com/downloads](https://git-scm.com/downloads)
24+
25+
#### Java
26+
27+
Make sure you have at least JDK 8 or 11 installed. You can check which version is installed by executing in your terminal:
28+
29+
```
30+
java -version
31+
```
32+
33+
Should output something similar like:
34+
35+
```bash
36+
java -version
37+
openjdk version "11.0.5" 2019-10-15
38+
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
39+
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)
40+
```
41+
42+
Java can be downloaded from the AdaptOpenJDK website: [https://adoptopenjdk.net/](https://adoptopenjdk.net/). Or, if you really need to, from the Oracle website: [http://www.oracle.com/technetwork/java/javase/downloads/index.html](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
43+
44+
#### IDE - IntelliJ
45+
46+
In this tutorial we assume that you will be using IntelliJ because of it`s excellent Kotlin support! That makes sense considering Kotlin was invented and created by JetBrains, the creator of IntelliJ.
47+
48+
IntelliJ Ultimate Edition is preferred but IntelliJ Community will also work. IntelliJ can be downloaded from: [https://www.jetbrains.com/idea/download/](https://www.jetbrains.com/idea/download/).
49+
50+
#### Sources
51+
52+
The Kotlin Bootique exercises can be found in a separate git repository. Please clone the source to your local machine from github:
53+
54+
```
55+
git clone https://github.com/sourcelabs-nl/kotlin-bootique-exercises.git
56+
```
57+
58+
Keep this documentation open in your browser while completing the exercises.
59+
60+
### Build the application
61+
62+
Open the project in IntelliJ ( File > Open... ) or navigate with your favorite terminal application to the location where you just cloned the project.
63+
64+
You can build the project using maven by executing the following command:
65+
66+
```
67+
./mvnw clean install
68+
```
69+
70+
_mvnw_ is no typo, this makes sure you are using the maven wrapper file. If you experience issues with you existing maven settings file you can use the provided settings.xml inside the project. Or temporarily renamed your settings.xml to settings.tmp.
71+
72+
```
73+
./mvnw -s settings.xml clean install
74+
```
75+
76+
### Run the application
77+
78+
You can launch the Kotlin Bootique application by running the project using the spring-boot maven plugin. Execute the following maven command:
79+
80+
```
81+
./mvnw spring-boot:run
82+
```
83+
84+
### Exploring the API
85+
86+
The Kotlin Bootique application exposes a Swagger endpoint that allows you to explore the API: [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
87+
88+
Alternatively you can also execute all the request against the API using curl or Postman (or a browser for all the GET requests).
89+
90+
#### Products
91+
92+
You can list all the products using your browser, Swagger or curl
93+
94+
```
95+
curl -X GET http://localhost:8080/products
96+
```
97+
98+
#### Basket
99+
100+
You can view the content of your basket using your browser, Swagger or curl
101+
102+
```
103+
curl -X GET http://localhost:8080/baskets/1
104+
```
105+
106+
#### Adding items
107+
108+
You can add items to the basket using Swagger or curl
109+
110+
```
111+
curl -H "Content-Type: application/json" -X POST -d '{"productId":"1","quantity":2}' http://localhost:8080/baskets/1/items
112+
curl -H "Content-Type: application/json" -X POST -d '{"productId":"2","quantity":4}' http://localhost:8080/baskets/1/items
113+
```
114+
115+
### Next steps
116+
117+
This workshop consist of several exercises that will guide you through the process of converting the Java code to Kotlin. Each of the exercises are in the kotlin-bootique-exercises project on an separate git branch.
118+
119+
By checking out each exercise branch, you will start of with a working implementation of the previous exercise.
120+
121+
The lines marked with: **Exercise** are the task that need to be performed!
122+
123+
You can start your journey now by switching to the exercise-1 branch, either by using IntelliJ or, by issue the following command in your terminal:
124+
125+
```
126+
git checkout exercise-1
127+
```
128+
129+
Please keep this documentation open in your browser while completing the exercises.
130+
131+
The documentation for the first exercise can be found here: [exercise-1.md](./exercise-1.md)
132+
133+
Enjoy the ride!

docs/exercises/exercise-1.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/introduction.md

Lines changed: 2 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,3 @@
1-
## Introduction
1+
## Kotlin Bootique Workshop
22

3-
Welcome to the Kotlin workshop. During this workshop you are going to convert an existing Java application to Kotlin.
4-
5-
The Kotlin Bootique application is currently written in Java. It provides a very minimalistic implementation of an API for a Webshop. Consisting of the following functionality provided by RESTful endpoints:
6-
7-
- _/products_: retrieving product and price information
8-
- _/baskets/{id}_: retrieving an overview of a shopping basket
9-
- _/baskets/{id}/items_: being able to add item to your basket
10-
11-
Step-by-step you are going to convert the code to Kotlin. If you are able to successfully complete this workshop, you should have enough knowledge to start using Kotlin in any of your (existing) Java projects.
12-
13-
### Prerequisites
14-
15-
This tutorial assumes that you have some basic knowledge about Java 8, Maven, Git and Spring Boot (Web).
16-
17-
18-
#### Git
19-
20-
Download and install git from [https://git-scm.com/downloads](https://git-scm.com/downloads)
21-
22-
#### Java
23-
24-
Make sure you have at least JDK8+ installed, both Oracle and OpenJDK are fine. You can check which version is installed by executing in your terminal:
25-
26-
```
27-
java --version
28-
```
29-
30-
Java can be downloaded from the Oracle website: [http://www.oracle.com/technetwork/java/javase/downloads/index.html](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
31-
32-
#### IntelliJ
33-
34-
In this tutorial we assume that you will be using IntelliJ because of it`s excellent Kotlin support. IntelliJ Ultimate Edition is preferred but Community edition will also work.
35-
36-
IntelliJ can be downloaded from: [https://www.jetbrains.com/idea/download/](https://www.jetbrains.com/idea/download/)
37-
38-
#### Sources
39-
40-
First get the Kotlin Bootique application source code on your machine by cloning the project from github:
41-
42-
```
43-
git clone https://github.com/sourcelabs-nl/kotlin-bootique.git
44-
```
45-
46-
### Build the application
47-
48-
Open the project with IntelliJ or go with your favorite terminal application to the location where you just cloned the project.
49-
50-
You can build the project using maven by firing the following command:
51-
52-
```
53-
./mvnw clean install
54-
```
55-
56-
_mvnw_ is no typo, this makes sure you are using the maven wrapper file. If you experience issues with you existing maven settings file you can use the provided one.
57-
58-
```
59-
./mvnw -s settings.xml clean install
60-
```
61-
62-
### Run the application
63-
64-
Start the application by running the project using the spring-boot maven plugin:
65-
66-
```
67-
./mvnw spring-boot:run
68-
```
69-
70-
### Exploring the API
71-
72-
The Kotlin Bootique application exposes a Swagger endpoint that allows you to explore the API: [http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
73-
74-
Alternatively you can also execute all the request against the API using curl (or a browser for all the GET requests).
75-
76-
#### Products
77-
78-
You can list all the products using your browser, Swagger or curl
79-
80-
```
81-
curl -X GET http://localhost:8080/products
82-
```
83-
84-
#### Basket
85-
86-
You can view the content of your basket using your browser, Swagger or curl
87-
88-
```
89-
curl -X GET http://localhost:8080/baskets/1
90-
```
91-
92-
#### Adding items
93-
94-
You can add items to the basket using Swagger or curl
95-
96-
```
97-
curl -H "Content-Type: application/json" -X POST -d '{"productId":"1","quantity":2}' http://localhost:8080/baskets/1/items
98-
curl -H "Content-Type: application/json" -X POST -d '{"productId":"2","quantity":4}' http://localhost:8080/baskets/1/items
99-
```
100-
101-
### Next steps
102-
103-
This workshop consist of several exercises that guide you through the process. Each of the exercises are in an separate git branch.
104-
105-
By checking out a each new exercise you can start with a working implementation of the previous exercise.
106-
107-
You can start your journey by switching to the exercise-1 branch either by using IntelliJ or issue the following command in your terminal:
108-
109-
```
110-
git checkout exercise-1
111-
```
112-
113-
The exercises can be found in the [./exercises/](exercises/exercise-1.md) folder.
114-
115-
Enjoy the ride!
3+
The documentation has moved: [here](https://github.com/sourcelabs-nl/kotlin-bootique/)

0 commit comments

Comments
 (0)