diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..6fd6b4f --- /dev/null +++ b/.classpath @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 942f861..e855b3f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,4 +1,4 @@ -# This workflow will build a Java project with Maven +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven name: Java CI with Maven @@ -16,9 +16,17 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v2 with: - java-version: 1.8 + java-version: '17' + distribution: 'adopt' + cache: maven + server-id: github + server-username: GITHUB_USER_REF + server-password: GITHUB_TOKEN_REF - name: Build with Maven - run: mvn -B package --file pom.xml \ No newline at end of file + env: + GITHUB_USER_REF: ${{ secrets.GH_PACKAGE_REPO_USERNAME }} + GITHUB_TOKEN_REF: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }} + run: mvn -s settings.xml -B package --file pom.xml diff --git a/.gitignore b/.gitignore index 549e00a..c132b52 100644 --- a/.gitignore +++ b/.gitignore @@ -6,12 +6,12 @@ target/ ### STS ### .apt_generated -.classpath .factorypath .project .settings .springBeans .sts4-cache +.classpath ### IntelliJ IDEA ### .idea diff --git a/README.md b/README.md index 1669634..41da75f 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ User A creates a buy order of 2 items (e.g. 2 shares, 2 bitcoin, etc) with a pri ##### Request ``` -POST /order/ - ?side=BUY - &amount=2 - &price=5 +POST /api/v1/order/ + ?side=BUY + &amount=2 + &price=5 ``` ##### Response @@ -67,10 +67,10 @@ User B creates a sell order of 2 items with a price of 5. ##### Request ``` -POST /order/ - ?side=SELL - &amount=2 - &price=5 +POST api/v1//order/ + ?side=SELL + &amount=2 + &price=5 ``` ##### Response diff --git a/pom.xml b/pom.xml index 6ac3704..571f108 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,13 @@ - 4.0.0 org.springframework.boot spring-boot-starter-parent 2.6.0 - + net.laffyco.java-matching-engine rest-api @@ -14,14 +15,40 @@ rest-api Rest API for the Java Matching Engine - 1.8 + 17 + + + + central + https://repo1.maven.org/maven2 + + true + + + true + + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/Laffini/Java-Matching-Engine-Core + + true + + + true + + + + + - - net.laffyco.java-matching-engine - core - 0.0.1 - + + net.laffyco.java-matching-engine + core + 0.0.1-SNAPSHOT + org.springframework.boot spring-boot-starter-web @@ -42,18 +69,18 @@ - org.springframework.boot - spring-boot-maven-plugin + org.apache.maven.plugins + maven-surefire-plugin - + - - github - GitHub Laffini Apache Maven Packages - https://maven.pkg.github.com/Laffini/Java-Matching-Engine-REST-API - - + + github + GitHub Laffini Apache Maven Packages + https://maven.pkg.github.com/Laffini/Java-Matching-Engine-REST-API + + diff --git a/settings.xml b/settings.xml new file mode 100644 index 0000000..f782444 --- /dev/null +++ b/settings.xml @@ -0,0 +1,29 @@ + + + + github + + + + + github + + + github + GitHub OWNER Apache Maven Packages + https://maven.pkg.github.com/Laffini/Java-Matching-Engine-Core + + + + + + + + github + Laffini + ${env.GITHUB_TOKEN_REF} + + + \ No newline at end of file diff --git a/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/OrderController.java b/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/OrderController.java index 3d3b488..071ae08 100644 --- a/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/OrderController.java +++ b/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/OrderController.java @@ -25,7 +25,7 @@ * */ @RestController -@RequestMapping("/order") +@RequestMapping("/api/v1/order") public class OrderController { /** diff --git a/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadController.java b/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadController.java index 0ee5f3b..de6e598 100644 --- a/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadController.java +++ b/src/main/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadController.java @@ -16,7 +16,7 @@ * */ @RestController -@RequestMapping("/spread") +@RequestMapping("/api/v1/spread") public class SpreadController { /** diff --git a/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/OrderControllerTests.java b/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/OrderControllerTests.java index 72c05bf..702989c 100644 --- a/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/OrderControllerTests.java +++ b/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/OrderControllerTests.java @@ -1,28 +1,28 @@ -package net.laffyco.javamatchingengine.restapi.controllers; - -import javax.annotation.Resource; - -import org.mockito.InjectMocks; -import org.mockito.Mock; - -import net.laffyco.javamatchingengine.core.api.OrderInterface; - -/** - * Tests the OrderController. - * - * @author Laffini - * - */ -public class OrderControllerTests { - - @Mock - private OrderInterface orderInterface; - - @InjectMocks - @Resource - private OrderController orderController; - - // TODO: Tests for each end point verifying that the correct method in the - // OrderInterface was called. - -} +//package net.laffyco.javamatchingengine.restapi.controllers; +// +//import javax.annotation.Resource; +// +//import org.mockito.InjectMocks; +//import org.mockito.Mock; +// +//import net.laffyco.java-matching-engine.core.api.OrderInterface; +// +///** +// * Tests the OrderController. +// * +// * @author Laffini +// * +// */ +//public class OrderControllerTests { +// +// @Mock +// private OrderInterface orderInterface; +// +// @InjectMocks +// @Resource +// private OrderController orderController; +// +// // TODO: Tests for each end point verifying that the correct method in the +// // OrderInterface was called. +// +//} diff --git a/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadControllerTests.java b/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadControllerTests.java index 1b20715..13af6a3 100644 --- a/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadControllerTests.java +++ b/src/test/java/net/laffyco/javamatchingengine/restapi/controllers/SpreadControllerTests.java @@ -1,28 +1,28 @@ -package net.laffyco.javamatchingengine.restapi.controllers; - -import javax.annotation.Resource; - -import org.mockito.InjectMocks; -import org.mockito.Mock; - -import net.laffyco.javamatchingengine.core.api.SpreadInterface; - -/** - * Tests the SpreadController. - * - * @author Laffini - * - */ -public class SpreadControllerTests { - - @Mock - private SpreadInterface spreadInterface; - - @InjectMocks - @Resource - private SpreadController spreadController; - - // TODO: Tests for each end point verifying that the correct method in the - // SpreadController was called. - -} +//package net.laffyco.javamatchingengine.restapi.controllers; +// +//import javax.annotation.Resource; +// +//import org.mockito.InjectMocks; +//import org.mockito.Mock; +// +//import net.laffyco.java-matching-engine.core.api.SpreadInterface; +// +///** +// * Tests the SpreadController. +// * +// * @author Laffini +// * +// */ +//public class SpreadControllerTests { +// +// @Mock +// private SpreadInterface spreadInterface; +// +// @InjectMocks +// @Resource +// private SpreadController spreadController; +// +// // TODO: Tests for each end point verifying that the correct method in the +// // SpreadController was called. +// +//}