Skip to content

Commit

Permalink
Add Maven to project
Browse files Browse the repository at this point in the history
  • Loading branch information
Lex van der Stoep committed Sep 20, 2020
1 parent 7e6ff71 commit b6818d2
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
*.tar.gz
*.rar

# Maven
log/
target/

# IntelliJ IDEA
.idea/
out/
Expand Down
20 changes: 20 additions & 0 deletions Exchange/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<project>
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>uk.co.complex.lvs.cm</groupId>
<artifactId>complex-markets</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>exchange</artifactId>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package uk.co.complex.lvs.cm.gui;

import layout.TableLayout;
import uk.co.complex.lvs.cm.*;
import uk.co.complex.lvs.cm.Account;
import uk.co.complex.lvs.cm.MarketManager;
import uk.co.complex.lvs.cm.PriceTimePriorityQueue;
import uk.co.complex.lvs.cm.Product;
import uk.co.complex.lvs.cm.TradeListener;
import uk.co.complex.lvs.cm.traders.RandomIntervalProductTrader;
import layout.TableLayout;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
package uk.co.complex.lvs.cm.traders;

import uk.co.complex.lvs.cm.*;
import uk.co.complex.lvs.cm.Account;
import uk.co.complex.lvs.cm.IllegalTradeException;
import uk.co.complex.lvs.cm.MarketManager;
import uk.co.complex.lvs.cm.Order;
import uk.co.complex.lvs.cm.Product;
import uk.co.complex.lvs.cm.Side;

import java.time.OffsetDateTime;
import java.util.Random;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package uk.co.complex.lvs.cm.tests;
package uk.co.complex.lvs.cm;

import org.junit.jupiter.api.Test;
import uk.co.complex.lvs.cm.*;
import org.junit.Test;

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.Assert.assertEquals;

class MarketManagerTest {
public class MarketManagerTest {
@Test
void cancelOrder() throws IllegalTradeException {
public void cancelOrder() throws IllegalTradeException {
Account alice = new Account("Alice");
Account bob = new Account("Bob");
Product xyz = new Product("XYZ");
Expand Down Expand Up @@ -49,7 +48,7 @@ void cancelOrder() throws IllegalTradeException {
}

@Test
void placeOrder() throws IllegalTradeException {
public void placeOrder() throws IllegalTradeException {
Account alice = new Account("Alice");
Account bob = new Account("Bob");
Product xyz = new Product("XYZ");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
package uk.co.complex.lvs.cm.tests;
package uk.co.complex.lvs.cm;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import uk.co.complex.lvs.cm.*;
import org.junit.Test;

import java.time.OffsetDateTime;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

/**
* Created by Lex van der Stoep on 06/12/2017.
*/
class OrderTest {
public class OrderTest {
@Test
void tradeProduct() {
public void tradeProduct() {
Account alice = new Account("Alice");
Product xyz = new Product("XYZ");
Order aliceBuy1 = new Order(xyz, 100.10f, 20, alice, Side.BUY, OffsetDateTime.now());
assertEquals(aliceBuy1.getRemainingAmount(), 20);
Assertions.assertEquals(aliceBuy1.getStatus(), Status.NEW);

assertEquals(aliceBuy1.getStatus(), Status.NEW);

try {
aliceBuy1.tradeProduct(0);
Expand Down
27 changes: 27 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<project>
<modelVersion>4.0.0</modelVersion>

<groupId>uk.co.complex.lvs.cm</groupId>
<artifactId>complex-markets</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>pom</packaging>

<modules>
<module>exchange</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit b6818d2

Please sign in to comment.