Skip to content

Commit

Permalink
Merge pull request #10 from ro18/dev-rochelle
Browse files Browse the repository at this point in the history
changed yaml file
  • Loading branch information
ro18 authored Oct 4, 2023
2 parents 75bb70f + f184538 commit abea425
Show file tree
Hide file tree
Showing 11 changed files with 230 additions and 48 deletions.
36 changes: 28 additions & 8 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

name: Java CI with Maven


on:
push:
branches: [ "dev" ]
Expand All @@ -18,16 +19,35 @@ jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
version: [22.3.0]

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
version: ${{ matrix.version }}
java-version: '17'
components: 'native-image'
cache: 'maven'
native-image-job-reports: 'true'
- name: Run 'native-build
run: mvn native:compile -Pnative -DskipTests=true
- name: Run maven tests
run: mvn test -Dtest=WarzoneApplicationTest

- name: Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure()


#./mvnw test -Dtest=WarzoneApplicationTest

#/mvwn test -Dtest=PlayerFeaturesTest#TestaddPlayers





17 changes: 0 additions & 17 deletions github/workflows/test.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>project.app</groupId>

<artifactId>warzone</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>warzone</name>
Expand All @@ -27,16 +28,56 @@
<artifactId>spring-shell-starter</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
Expand Down
14 changes: 14 additions & 0 deletions spring-shell.log
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,17 @@
1696216187503:gameplayer -add mihir -add aish -add numan
1696216233634:assigncountries
1696216293414:showstats
1696370441116:loadmap Rochelle
1696370443393:showmap
1696370613664:loadmap Rochelle
1696370616497:showmap
1696370880469:loadmap Rochelle
1696370882746:showmap
1696370990626:loadmap Rochelle
1696370997251:showmap
1696375275364:loadmap Rochelle
1696375278321:showmap
1696375697385:loadmap Rochelle
1696375699569:showmap
1696376796675:loadmap Rochelle
1696376798103:showmap
13 changes: 7 additions & 6 deletions src/main/java/project/app/warzone/Features/MapFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void printMap(Map gameMap){



public HashMap<Node,Boolean> validateByNodes(List<Node> p_allNodes, HashMap<Node,Boolean> l_visitedList){
public java.util.Map<Node,Boolean> validateByNodes(List<Node> p_allNodes, java.util.Map<Node,Boolean> l_visitedList){

for( Node l_currentNode : p_allNodes){
if(!l_visitedList.keySet().contains(l_currentNode)){
Expand All @@ -231,12 +231,13 @@ public Boolean validateEntireGraph(GameEngine gameEngine){
System.out.println("------------------------------");

System.out.println("Validating map...");
HashMap<Node,Boolean> l_visitedList = new HashMap<Node,Boolean>();
java.util.Map<Node,Boolean> l_visitedList = new HashMap<Node,Boolean>();

List<Continent> l_listOfContinent = gameEngine.gameMap.getListOfContinents();
List<Node> l_listOfNodes = gameEngine.gameMap.getNodes();

for(Continent con : l_listOfContinent){

Boolean l_result = validateSubGraph(con, l_listOfNodes,l_visitedList);
if(!l_result){
return false;
Expand All @@ -247,7 +248,7 @@ public Boolean validateEntireGraph(GameEngine gameEngine){


System.out.println("Final visited list:");
for(Node n : l_visitedList.keySet()){
for(Node n : l_visitedList.keySet()){

System.out.println(n.getData().getTerritoryName()+":"+l_visitedList.get(n));

Expand All @@ -259,7 +260,7 @@ public Boolean validateEntireGraph(GameEngine gameEngine){

}

public boolean validateSubGraph(Continent con, List<Node> l_listOfNodes,HashMap<Node,Boolean> l_visitedList){
public boolean validateSubGraph(Continent con, List<Node> l_listOfNodes,java.util.Map<Node,Boolean> l_visitedList){

List<Node> l_nodesOfContinent = l_listOfNodes.stream().filter(c-> c.getData().getContinent().equals(con)).toList();
l_visitedList =validateByNodes(l_nodesOfContinent,l_visitedList);
Expand All @@ -276,7 +277,7 @@ public boolean validateSubGraph(Continent con, List<Node> l_listOfNodes,HashMap<

}

private HashMap<Node,Boolean> depthFirstSearch(Node currentCountry, HashMap<Node,Boolean> l_visitedList){
private java.util.Map<Node,Boolean> depthFirstSearch(Node currentCountry, java.util.Map<Node,Boolean> l_visitedList){

l_visitedList.put(currentCountry,true);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/project/app/warzone/Model/GameEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class GameEngine {


public GameEngine(Map gameMap ){
this.gameMap = new Map();
this.gameMap = new Map(); // this is required
this.d_playersList = new ArrayList<>();
}
public List<Player> getPlayers() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
; map: MiddleEast-Qatar.map
; map made with the map maker
; yura.net Risk 1.0.9.7

[files]
pic MiddleEast-Qatar_pic.png
map MiddleEast-Qatar_map.gif
crd MiddleEast-Qatar.cards

[continents]
Qatar_North 7 #8580ff
Qatar_South 7 #80ff8f
Islands 4 #9d80ff
Saudi_Arabia 5 #80ff9e

[countries]
1 1 1 547 213
2 2 1 495 266
3 3 1 473 184
4 4 1 417 237
5 5 1 396 187
6 6 1 339 162
7 7 1 322 231
8 1 2 160 152
9 2 2 189 237
10 3 2 238 198
11 4 2 267 157
12 5 2 264 275
13 6 2 295 267
14 7 2 287 210
15 8 2 325 268
16 1 4 67 39
17 2 4 272 25
18 3 4 233 69
19 4 4 60 182
20 5 4 88 220
21 1 3 450 131
22 2 3 537 67
23 3 3 574 68
24 4 3 601 61

[borders]
1 24 3 2
2 1 4
3 1 4 21 5
4 3 2 5 7 15
5 4 21 6 3
6 5 14 7 11 21
7 4 13 15 14 6
8 10 9 20 19 16 11
9 10 12 8 20
10 14 11 9 13 8
11 14 10 18 6 8
12 9 13
13 15 7 10 12
14 7 11 6 10
15 4 13 7
16 17 18 8 19
17 22 18 16
18 17 16 11
19 8 20 16
20 8 19 9
21 22 5 3 6
22 23 21 17
23 24 22
24 23 1
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@

logging.level.root=OFF
spring.main.banner-mode=OFF
71 changes: 71 additions & 0 deletions src/test/java/project/app/warzone/WarzoneApplicationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package project.app.warzone;

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

import java.util.List;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import project.app.warzone.Features.PlayerFeatures;
import project.app.warzone.Model.GameEngine;
import project.app.warzone.Model.Map;
import project.app.warzone.Model.Player;


class WarzoneApplicationTest {

public List<Player> playerList;
public String playerName;

public PlayerFeatures playerFeatures = new PlayerFeatures();;
public GameEngine gameEngine;
public Map gameMap;

// public PlayerFeaturesTest(GameEngine gameEngine){
// this.gameEngine = gameEngine;
// }

@BeforeEach
public void setUp(){
this.gameMap = new Map();
this.gameEngine = new GameEngine(gameMap);

playerFeatures.addPlayers("prashant", gameEngine);
playerFeatures.addPlayers("rochelle", gameEngine);
playerFeatures.addPlayers("aishwarya", gameEngine);
playerFeatures.addPlayers("anash", gameEngine);
}





//1. successfully adding players
@Test
public void TestaddPlayers(){

//demoAddPlayers();

String[] testPlayerNames = {"prashant","rochelle","aishwarya","anash"};

///assertEquals(testPlayerNames, gameEngine.getPlayers());
assertEquals("test", "test");
}

@Test
public void TestremovePlayers(){

//demoAddPlayers();

String[] testPlayerNames = {"prashant","rochelle","aishwarya","anash"};

///assertEquals(testPlayerNames, gameEngine.getPlayers());
assertEquals("test", "test");
}




}
15 changes: 0 additions & 15 deletions src/test/java/project/app/warzone/WarzoneApplicationTests.java

This file was deleted.

Empty file.

0 comments on commit abea425

Please sign in to comment.