https://github.com/andylvua/FlowerStore
Lab 5, 7, 8 and 9 assignment of OOP course
https://github.com/andylvua/FlowerStore
ci-cd java maven oop unit-testing
Last synced: 7 months ago
JSON representation
Lab 5, 7, 8 and 9 assignment of OOP course
- Host: GitHub
- URL: https://github.com/andylvua/FlowerStore
- Owner: andylvua
- License: mit
- Created: 2022-10-13T19:37:13.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-20T13:37:15.000Z (almost 3 years ago)
- Last Synced: 2025-03-10T22:37:17.230Z (7 months ago)
- Topics: ci-cd, java, maven, oop, unit-testing
- Language: Java
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flower Store
[](https://github.com/andylvua/FlowerStore/actions/workflows/ci.yaml)
## Description
Simple flower store application for Labs 5-8 assignment of OOP course.
## Lab 5 Task
- [x] Implement a class Flower or system of classes that implement the essence of Rose, Chamomile, and Tulip in a flower store. The class or classes should have attributes sepalLength, color, and price.
- [x] Submit a project to GitHub.
- [x] Add SuperLinter to the project and fix all issues.
- [x] Propose an approach to represent flower color (explore the proposed tests).
- [x] Add all next changes in a separate branch flower-bucket and merge them into the main branch with Pull Request.
- [x] Implement FlowerPack class with attributes flower and amount. Implement method getPrice in it.
- [x] Implement FlowerBucket class that will aggregate several FlowerPack. Implement method price in it.
- [x] Implement class Store and method search in it.
- [x] Add tests to the project.
- [x] Setup GitHub Actions for this project that would run your tests.
- [x] Send a link to your GitHub here.## Lab 7 Task
- [x] Initialize simple web
- [x] Add `@RestController` to a `DemoApplication.java` and implement methods with `@GetMapping` to return a list of objects.
- [x] Migrate `Flower` to this project and implement an endpoint that will return `List.of(Flower)`.
- [x] Refactor `FlowerController`: move to separate package and add `@RequestMapping`.
- [x] Implement `Order` that will implement client order.
- [x] Implement `Item` that will represent the basic element of `Order`.
- [x] Implement different payment strategies with an interface `Payment` and several implementations of it `CreditCardPaymentStrategy`, `PayPalPaymentStrategy`. Use Strategy pattern.
- [x] Implement several `Delivery` strategies: `PostDeliveryStrategy`, `DHLDeliveryStrategy`.
- [x] Cover delivery and payment packages with tests and endpoints for them.
- [x] Set up GitHub Actions for this project that would run your tests.
- [x] Send a link to your GitHub here.### Results of Lab 7
#### api/flowerstore
Here we can see welcoming message with simple usage instructions.
#### api/flowerstore/help
This endpoint returns a list of all available endpoints.
#### api/flowerstore/all
We can go to the endpoint `api/flowerstore/all` to see all flowers in the store. Flower store is being automatically initialized with random flower objects.
### Lab 8 Task
- [x] Refactor business logic of `getFlowers` to `FlowerService`
- [x] Use `@Autowired` and `@Servic`e for Dependency Injection.
- [x] Setup DB with Docker `docker run --name oop-course -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres`
- [x] Add flowers DB via Database viewer (Intellj IDEA Ultimate or DBViewer)
- [x] Add JPA config. See application.properties attached.
- [x] Add `FlowerRepository` interface and inject it instance in `FlowerService`. Inject several record in DB. Check whether the endpoint will return all the records from DB.
- [x] Add `addFlower` method to API and Service layers. Implement `@PostMapping` with `@RequestBody` extraction.
- [x] Test GET and POST with test.http.
- [x] Implement `AbstractDecorator` that will implement basic decorator behavior.
- [x] Implement decorators based on attached diagram. This implementation should follow `Decorator Pattern`.
- [x] Cover decorators with tests.
- [x] Set up GitHub Actions for this project that would run your tests.
- [x] Send a link to your GitHub here.### Results of Lab 8
#### GET request
We can add a several flower instances to the database using IntelliJ IDEA Database Viewer.
Now, let's send a GET request to the endpoint `api/flowerstore/database/view` to see all flowers in the store's database.
We can see that all flower instances were successfully added to the database and returned by the endpoint.
#### POST request
Now, let's send a several POST requests to the endpoint `api/flowerstore/database/add` to add a new flower instance to the store's database.
As we can see, the server responded with a status code 200 and the flower instances were successfully added to the database:
![]()
![]()
Now, sending a GET request to the endpoint `api/flowerstore/database/view` yields the following result:
## License
The [MIT](https://choosealicense.com/licenses/mit/) License (MIT)
Copyright © 2022. Andrii Yaroshevych