Skip to content

Commit

Permalink
Merge pull request #58 from danieskj/dev
Browse files Browse the repository at this point in the history
MVP Finished
  • Loading branch information
danieskj authored May 16, 2026
2 parents 473e022 + 0977c89 commit 00862a1
Show file tree
Hide file tree
Showing 94 changed files with 4,525 additions and 483 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,21 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: 'maven'

- name: Build with Maven
run: mvn -B compile --file pom.xml

- name: Test with Maven
run: mvn -B test --file pom.xml

- name: Build site + JavaDocs & JaCoCo
run: mvn clean verify site

- name: Deploy to Github Pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: target/site/
publish_branch: gh-pages

88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,94 @@

The exam of IDATT2003, "Programming 2" subject.

# Overview
<!--toc:start-->
- [Summary](#summary)
- [Packages](#packages)
- [How to run](#how-to-run)
- [Guide to tests](#guide-to-tests)
<!--toc:end-->

# Summary
This is a game emulating a evolving stock market where the player is encouraged to take their own risks and go from rags to riches. With strategic planning and unsuspected events how far can you go?

What you can expect from the game:
- Something 1
- Something 2
- Something 3

# Packages
```
.
├── java
│   └── edu
│   └── ntnu
│   └── idi
│   └── idatt
│   ├── common
│   │   └── Observer.java
│   ├── Launcher.java
│   ├── model
│   │   ├── Exchange.java
│   │   ├── market
│   │   │   └── Stock.java
│   │   ├── player
│   │   │   └── Player.java
│   │   ├── portfolio
│   │   │   ├── Portfolio.java
│   │   │   └── Share.java
│   │   └── transaction
│   │   ├── Purchase.java
│   │   ├── Sale.java
│   │   ├── TransactionArchive.java
│   │   └── Transaction.java
│   ├── service
│   │   └── transaction
│   │   ├── PurchaseCalculator.java
│   │   ├── SaleCalculator.java
│   │   └── TransactionCalculator.java
│   ├── session
│   │   └── UserSession.java
│   ├── storage
│   │   ├── SessionManager.java
│   │   ├── StockParser.java
│   │   └── StorageFile.java
│   └── view
│   ├── components
│   │   ├── AbstractController.java
│   │   ├── AbstractView.java
│   │   ├── AbstractViewUI.java
│   │   ├── elements
│   │   │   ├── IconComponent.java
│   │   │   └── SearchBarComponent.java
│   │   ├── Model.java
│   │   ├── primitives
│   │   │   └── ActionEventHandler.java
│   │   └── ui
│   ├── entry
│   │   ├── StartController.java
│   │   ├── StartModel.java
│   │   └── StartView.java
│   ├── primary
│   │   └── MainView.java
│   └── SceneManager.java
└── resources
├── icons
│   ├── portfolio.png
│   ├── quit.png
│   ├── search.png
│   └── user.png
├── save.json
├── stocks.csv
├── themes
│   └── default.css
└── user.png
```

# How to run
- Running program: `mvn clean javafx:run`
- Running tests: `mvn clean test`

# Guide to tests

- The test generally start with a @BeforeEach method that sets up everything necessary for positive testing.
Expand Down
126 changes: 73 additions & 53 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,18 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
</dependency>

<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>25.0.1</version>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.13.2</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>25.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<artifactId>javafx-controls</artifactId>
<version>25.0.1</version>
</dependency>

Expand All @@ -62,9 +40,9 @@
<artifactId>junit-jupiter</artifactId>
<version>6.0.1</version>
<scope>test</scope>
</dependency>
</dependency>

</dependencies>
</dependencies>

<build>

Expand All @@ -82,34 +60,76 @@
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>edu.ntnu.idi.idatt.gui.javafx</mainClass>
<mainClass>edu.ntnu.idi.idatt.Launcher</mainClass>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId> <!-- Lett running fra ide -->
<artifactId>exec-maven-plugin</artifactId>
<version>3.6.3</version> <!-- Sjekkk versjon her -->
<configuration>
<mainClass>edu.ntnu.idi.idatt.Main</mainClass>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId> <!-- Skippe manifest.mf declaration her -->
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version> <!-- SJEKK VERSJON HER Å -->
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>edu.ntnu.idi.idatt.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin> <!-- JavaDoc generation plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.12.0</version>
<configuration>
<javadocExecutable>/usr/lib/jvm/java-25-openjdk/bin/javadoc</javadocExecutable>
</configuration>
</plugin>


<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.14</version>

<executions>
<!-- 1. Attach JaCoCo agent before tests -->
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- 2. Generate report after tests -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin> <!-- Display site folder -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M9</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId> <!-- Skippe manifest.mf declaration her -->
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>edu.ntnu.idi.idatt.Launcher</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

</plugins>
</build>
</build>


<reporting> <!-- Add reporting to JavaDoc plugin, not only output -->
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.12.0</version>
</plugin>
</plugins>
</reporting>

</project>
31 changes: 31 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt/Launcher.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package edu.ntnu.idi.idatt;

import edu.ntnu.idi.idatt.view.SceneFactory;
import edu.ntnu.idi.idatt.view.SceneManager;
import javafx.application.Application;
import javafx.stage.Stage;

public final class Launcher {

/**
* Entry point of application.
*/
static void main() {
Application.launch(StockGame.class);
}

public static final class StockGame extends Application {

@Override
public void start(Stage stage) {
stage.setWidth(1200);
stage.setHeight(700);
stage.setTitle("Stock Game");

SceneManager.init(stage, SceneFactory.createStartView());
stage.show();
}

}

}
11 changes: 0 additions & 11 deletions src/main/java/edu/ntnu/idi/idatt/Main.java

This file was deleted.

57 changes: 0 additions & 57 deletions src/main/java/edu/ntnu/idi/idatt/Player.java

This file was deleted.

Loading

0 comments on commit 00862a1

Please sign in to comment.