Skip to content

Commit 2e9af9c

Browse files
author
Jegors Čemisovs
committed
Fixed readme file
1 parent 64b95a0 commit 2e9af9c

File tree

5 files changed

+58
-53
lines changed

5 files changed

+58
-53
lines changed

README.md

-53
This file was deleted.

CNAME docs/CNAME

File renamed without changes.

docs/README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## About
2+
3+
This project demonstrates the capabilities of the Spring Shell framework, as well as testing examples using the Spock
4+
Framework.
5+
6+
The solution of the [HyperMetro](https://hyperskill.org/projects/120) project was taken as the basis. This is a console
7+
application that loads a subway map and allows you to execute various commands to work with the metro schema.
8+
9+
In particular, you can find the shortest or fastest route between stations, print various reports, and edit the metro
10+
map.
11+
12+
## Technologies used
13+
14+
When creating this project, I used:
15+
16+
- Java 17
17+
- Gradle
18+
- Spring Boot + Spring Shell
19+
- Jackson JSON parser
20+
- Spock Framework
21+
22+
## How to build and run the project
23+
24+
To build the application use this command:
25+
26+
`./gradlew bootJar`
27+
28+
In order to run the application you should specify a metro schema as argument:
29+
30+
`$ java -jar build/libs/hypermetro-1.0-SNAPSHOT.jar london.json`
31+
32+
## Commands
33+
34+
- add-head line station
35+
- append line station
36+
- remove line station
37+
- connect line1 station1 line2 station2
38+
- output line
39+
- route line1 station1 line2 station2
40+
- fastest-route line1 station1 line2 station2
41+
42+
## Documentation
43+
44+
You may check the report and the documentation:
45+
- [JavaDoc](https://rabestro.github.io/hypermetro/docs/javadoc) for the program
46+
- [Specifications](https://rabestro.github.io/hypermetro/docs/spock-reports) by Spock Reports
47+
- [Tests Coverage](https://rabestro.github.io/hypermetro/docs/coverage) report
48+
- [Gradle unit test](https://rabestro.github.io/hypermetro/docs/reports/test) report
49+

_config.yml docs/_config.yml

File renamed without changes.

src/main/java/metro/repository/MetroRepositoryJson.java

+9
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
import java.util.Map;
1717
import java.util.NoSuchElementException;
1818

19+
import static java.lang.System.Logger.Level.INFO;
1920
import static java.util.Objects.requireNonNull;
2021

2122
/**
2223
* Repository interface implementation that loads a metro map from a JSON file
2324
*/
2425
@Repository
2526
public class MetroRepositoryJson implements MetroRepository, InitializingBean {
27+
private static final System.Logger LOGGER = System.getLogger(MetroRepositoryJson.class.getName());
2628

2729
private static final TypeReference<Map<String, Deque<Station>>> SCHEMA_TYPE = new TypeReference<>() {
2830
};
@@ -37,7 +39,9 @@ public class MetroRepositoryJson implements MetroRepository, InitializingBean {
3739

3840
@Override
3941
public void afterPropertiesSet() throws Exception {
42+
LOGGER.log(INFO, "Loading metro schema from file: „{0}“", schemaPath);
4043
metroMap = new JsonMapper().readValue(schemaPath.toFile(), SCHEMA_TYPE);
44+
LOGGER.log(INFO, "Metro map successfully loaded.");
4145
}
4246

4347
@Override
@@ -51,6 +55,7 @@ private Deque<Station> getLine(String line) {
5155

5256
@Override
5357
public void addHead(String line, String station, int time) {
58+
LOGGER.log(INFO, "Executing command: add-head „{0}“ „{1}“ „{2}“", line, station, time);
5459
var metroLine = getLine(line);
5560
var metroStation = new Station(station, time);
5661

@@ -66,6 +71,7 @@ public void addHead(String line, String station, int time) {
6671

6772
@Override
6873
public void append(String line, String station, int time) {
74+
LOGGER.log(INFO, "Executing command: append „{0}“ „{1}“ „{2}“", line, station, time);
6975
var metroLine = getLine(line);
7076
var metroStation = new Station(station, time);
7177

@@ -81,11 +87,14 @@ public void append(String line, String station, int time) {
8187

8288
@Override
8389
public void remove(String line, String station) {
90+
LOGGER.log(INFO, "Executing command: remove „{0}“ „{1}“", line, station);
8491
throw new UnsupportedOperationException("This operation has not yet been implemented");
8592
}
8693

8794
@Override
8895
public void connect(String sourceLine, String sourceStation, String targetLine, String targetStation) {
96+
LOGGER.log(INFO, "Executing command: connect „{0}“ „{1}“ „{2}“ „{3}“",
97+
sourceLine, sourceStation, targetLine, targetStation);
8998
var source = getStation(sourceLine, sourceStation);
9099
var target = getStation(targetLine, targetStation);
91100
source.transfer().add(new StationId(targetLine, targetStation));

0 commit comments

Comments
 (0)