Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from gameontext/dynamicGrowth
Browse files Browse the repository at this point in the history
Gradle fixes and manual wiring
  • Loading branch information
MarkNSweep committed Oct 23, 2015
2 parents 680e427 + 20d9afb commit 08869b2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 47 deletions.
1 change: 0 additions & 1 deletion concierge-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
compile project(':app-common')
}


// Set the Eclipse facets to use 3.1 of the Dynamic Web Module which requires Java 1.7 by default.
// Also include the JAX-RS and javascript
eclipse.wtp.facet {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package net.wasdev.gameon.concierge;

import java.util.UUID;
import net.wasdev.gameon.room.common.Room;

public class Connection {

private UUID startRoom;
private UUID endRoom;
private Room startRoom;
private Room endRoom;
private String startingEntrance;
public Connection(UUID startingRoom, UUID endRoom, String startingEntrance) {
public Connection(Room startingRoom, Room endRoom, String startingEntrance) {
this.startingEntrance = startingEntrance;
this.startRoom = startingRoom;
this.endRoom = endRoom;
}
public UUID getStartRoom() {
public Room getStartRoom() {
return startRoom;
}

public UUID getEndRoom() {
public Room getEndRoom() {
return endRoom;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,37 @@
import java.util.Map;
import java.util.UUID;

import net.wasdev.gameon.room.common.Exit;
import net.wasdev.gameon.room.common.Room;

public class ManualWiringPlacement implements PlacementStrategy {

List<String> exitNodes = new ArrayList<String>();
private UUID roomUUID;
Map<UUID, List<Exit>> exitMap = new HashMap<UUID, List<Exit>>();

private Map<UUID, String> roomNameToUUIDMapping = new HashMap<UUID, String>();
private Map<String, UUID> roomNameToUUIDMapping = new HashMap<String, UUID>();


@Override
public UUID getConnectingRoom(UUID currentRoom, String exit) {

return roomUUID;

public UUID getConnectingRoom(UUID currentRoom, String exitName) {
List<Exit> currentRoomExits = exitMap.get(currentRoom);
String roomName = null;
UUID nextRoom = null;
for (Exit exit : currentRoomExits) {
if (exit.getName().equals(exitName)) {
roomName = exit.getRoom();
}
}
if (roomName != null) {
nextRoom = roomNameToUUIDMapping.get(roomName);
}
return nextRoom;
}

@Override
public void placeRoom(UUID roomUUID, Room room) {
roomNameToUUIDMapping.put(roomUUID, room.getRoomName());
// Loop through exits
roomNameToUUIDMapping.put(room.getRoomName(), roomUUID);

this.roomUUID = roomUUID;

exitMap.put(roomUUID, room.getExits());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public void MoveToNewRoomAndBack() {

Room secondRoomAsRegistered = new Room("Second Room");
List<Exit> secondRoomExits = new ArrayList<Exit>();
secondRoomExits.add(new Exit("South", "StartingRoom"));
anEasyRoom.setExits(secondRoomExits);
secondRoomExits.add(new Exit("South", "Starting Room"));
secondRoomAsRegistered.setExits(secondRoomExits);
UUID secondRoomUUID = c.registerRoom(secondRoomAsRegistered);
Room secondRoomAsFound = c.exitRoom(startingRoomUUID, "North");
assertEquals("The secondRoom should be returned", secondRoomUUID, secondRoomAsFound.getAssignedID());
Expand Down
29 changes: 2 additions & 27 deletions room-app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
plugins {
id "com.moowork.grunt" version "0.11"
}

node {
version = '4.1.2'
download = false
}

// Install the bower components for front-end library management
task bowerInstall(dependsOn: 'npmInstall', type: Exec) {
commandLine "node_modules/bower/bin/bower", 'install'
}

apply plugin: 'war'
apply plugin: 'eclipse-wtp'

Expand All @@ -21,7 +7,9 @@ dependencies {
providedCompile group:'javax.websocket', name:'javax.websocket-api', version:'1.1'
providedCompile group:'javax.ws.rs', name:'javax.ws.rs-api', version:'2.0'
providedCompile group:'javax.json', name:'javax.json-api', version:'1.0'
providedCompile group:'javax.servlet', name:'javax.servlet-api', version:'3.1.0'
compile 'org.mongodb:mongo-java-driver:2.12.3'
compile project(':app-common')
}

// Set the Eclipse facets to use 3.1 of the Dynamic Web Module which requires Java 1.7 by default.
Expand All @@ -47,16 +35,3 @@ task publishWar(dependsOn: 'jar', type: Copy) {

assemble.dependsOn('publishWar')

eclipse.project.file {
// Exclude node resources from validation
withXml { xmlProvider ->
Node project = xmlProvider.asNode()
Node filter = project.appendNode('filteredResources').appendNode('filter')
filter.appendNode('id', 2889034)
filter.appendNode('name', 'node_modules')
filter.appendNode('type', 22)
Node matcher = filter.appendNode('matcher')
matcher.appendNode('id', 'org.eclipse.ui.ide.multiFilter')
matcher.appendNode('arguments', '1.0-name-matches-false-false-*')
}
}

0 comments on commit 08869b2

Please sign in to comment.