This repository was archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start of room processing logic - handling initial player connection and
the look command.
- Loading branch information
1 parent
08869b2
commit 55e4049
Showing
13 changed files
with
295 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app-common/src/main/java/net/wasdev/gameon/room/common/RegistrationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app-common/src/main/java/net/wasdev/gameon/room/common/Room.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
concierge-app/src/test/java/net/wasdev/gameon/concierge/TestDynamicConcierge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package net.wasdev.gameon.concierge; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import net.wasdev.gameon.room.common.Exit; | ||
import net.wasdev.gameon.room.common.Room; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* The dynamic strategy will make it harder to draw out a map of the rooms because there is some | ||
* arbitrariness. | ||
*/ | ||
public class TestDynamicConcierge { | ||
|
||
@Test | ||
public void registerARoom() { | ||
// We want the room itself to come up and publish to the concierge. So the flow will require the room to say "Here I am concierge" | ||
Concierge c = addEasyStartingRoom(); | ||
assertEquals("The start room should be the first room we add", "Starting Room", c.getStartingRoom().getRoomName()); | ||
} | ||
|
||
@Test | ||
public void placeTwoRoomsNearEachother() { | ||
// We want the room itself to come up and publish to the concierge. So the flow will require the room to say "Here I am concierge" | ||
Concierge c = new Concierge(new DynamicGrowthPlacement()); | ||
Room anEasyRoom = new Room("Starting Room"); | ||
List<Exit> exits = new ArrayList<Exit>(); | ||
exits.add(new Exit("North", "Second Room", "Test room")); | ||
anEasyRoom.setExits(exits); | ||
UUID startingRoomUUID = c.registerRoom(anEasyRoom); | ||
|
||
Room secondRoomAsRegistered = new Room("Second Room"); | ||
UUID secondRoomUUID = c.registerRoom(secondRoomAsRegistered); | ||
Room secondRoomAsFound = c.exitRoom(startingRoomUUID, "North"); | ||
assertEquals("The secondRoom should be returned", secondRoomUUID, secondRoomAsFound.getAssignedID()); | ||
} | ||
|
||
|
||
|
||
|
||
private Concierge addEasyStartingRoom() { | ||
Concierge c = new Concierge(); | ||
Room anEasyRoom = new Room("Starting Room"); | ||
List<Exit> exits = new ArrayList<Exit>(); | ||
exits.add(new Exit("North", "Second Room", "Test room")); | ||
anEasyRoom.setExits(exits); | ||
c.registerRoom(anEasyRoom); | ||
return c; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ | |
/src/main/webapp/META-INF/ | ||
|
||
/target | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
room-app/src/main/java/net/wasdev/gameon/room/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015 IBM Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*******************************************************************************/ | ||
package net.wasdev.gameon.room; | ||
|
||
public interface Constants { | ||
// A field enum or just free-form? | ||
String USERNAME = "username"; | ||
String BOOKMARK = "bookmark"; | ||
String CONTENT = "content"; | ||
String LOCATION = "location"; | ||
String TYPE = "type"; | ||
String NAME = "name"; | ||
String DESCRIPTION = "description"; | ||
String EXITS = "exits"; | ||
String STATE = "state"; | ||
} |
15 changes: 15 additions & 0 deletions
15
room-app/src/main/java/net/wasdev/gameon/room/LifecycleManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.