diff --git a/.gitignore b/.gitignore index c29286e..56624a0 100644 --- a/.gitignore +++ b/.gitignore @@ -121,4 +121,5 @@ $RECYCLE.BIN/ .idea ## bin -bin/ \ No newline at end of file +bin/ +gradle.properties \ No newline at end of file diff --git a/.gitlab/issue_templates/bug_report_client.md b/.gitlab/issue_templates/bug_report_client.md new file mode 100644 index 0000000..d1b4373 --- /dev/null +++ b/.gitlab/issue_templates/bug_report_client.md @@ -0,0 +1,31 @@ +## Bug Report + +### Summary + + +### Affected Component + + +### Steps to Reproduce +1. Do this first +2. Then do that next +3. Lastly, see the unexprected error message ... + +### Expected Behavior + + +### Actual Behavior + + +### Stack Trace / Error Message +``` + +``` + +### Possible Cause + + + +/label ~bug + +/label ~client diff --git a/.gitlab/issue_templates/bug_report_server.md b/.gitlab/issue_templates/bug_report_server.md new file mode 100644 index 0000000..46d7572 --- /dev/null +++ b/.gitlab/issue_templates/bug_report_server.md @@ -0,0 +1,30 @@ +## Bug Report + +### Summary + + +### Affected Component + + +### Steps to Reproduce +1. Do this first +2. Then do that next +3. Lastly, see the unexprected error message ... + +### Expected Behavior + + +### Actual Behavior + + +### Stack Trace / Error Message +``` + +``` + +### Possible Cause + + +/label ~bug + +/label ~server diff --git a/.gitlab/issue_templates/feature_request_client.md b/.gitlab/issue_templates/feature_request_client.md new file mode 100644 index 0000000..c654230 --- /dev/null +++ b/.gitlab/issue_templates/feature_request_client.md @@ -0,0 +1,27 @@ +## Feature Request + +### Summary + + +### Motivation / Problem + + +### Description + + +### Affected Components + + + +### Acceptance Criteria + +- [ ] +- [ ] +- [ ] + +### Open Questions / Trade-offs + + +/label ~enhancement + +/label ~client diff --git a/.gitlab/issue_templates/feature_request_server.md b/.gitlab/issue_templates/feature_request_server.md new file mode 100644 index 0000000..38d3377 --- /dev/null +++ b/.gitlab/issue_templates/feature_request_server.md @@ -0,0 +1,27 @@ +## Feature Request + +### Summary + + +### Motivation / Problem + + +### Description + + +### Affected Components + + + +### Acceptance Criteria + +- [ ] +- [ ] +- [ ] + +### Open Questions / Trade-offs + + +/label ~enhancement + +/label ~server diff --git a/.gitlab/issue_templates/protocol_change.md b/.gitlab/issue_templates/protocol_change.md new file mode 100644 index 0000000..6c5d5b2 --- /dev/null +++ b/.gitlab/issue_templates/protocol_change.md @@ -0,0 +1,37 @@ +## Protocol / API Change + +### Summary + + +### Affected Commands / Responses + + +| Command | Response | Type of Change | Description | +|---------|----------|----------------|-------------| +| | | New / Changed / Removed | | + +### New / Changed Syntax +``` + + +``` + +### Affected Implementation Layers + +- [ ] `Session` +- [ ] `User` or `UserRegistry` +- [ ] `Tokenizer` / `RequestTokenClassifier` +- [ ] `ProtocolParser` +- [ ] `CommandParserDispatcher` + corresponding `CommandParser` +- [ ] `CommandHandler` +- [ ] `Response` hierarchy +- [ ] `GameEngine` or `GameState` +- [ ] Client-side (create your own issue and create link) + +### Motivation + + +/label ~protocol diff --git a/.gitlab/issue_templates/task_client.md b/.gitlab/issue_templates/task_client.md new file mode 100644 index 0000000..f75a1c4 --- /dev/null +++ b/.gitlab/issue_templates/task_client.md @@ -0,0 +1,25 @@ +## Task + +### Summary + + +### Context + + +### Affected Components + + +### Definition of Done +- [ ] +- [ ] +- [ ] + +### Notes + + +### Checklist +- [ ] Linked to other issues or branches that must be completed first? + +/label ~task + +/label ~client diff --git a/.gitlab/issue_templates/task_server.md b/.gitlab/issue_templates/task_server.md new file mode 100644 index 0000000..e6206d1 --- /dev/null +++ b/.gitlab/issue_templates/task_server.md @@ -0,0 +1,25 @@ +## Task + +### Summary + + +### Context + + +### Affected Components + + +### Definition of Done +- [ ] +- [ ] +- [ ] + +### Notes + + +### Checklist +- [ ] Linked to other issues or branches that must be completed first? + +/label ~task + +/label ~server diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 287cd3b..f51f87a 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -20,7 +20,7 @@ - + @@ -42,16 +42,6 @@ "/> - - - - - - - - - - @@ -62,7 +52,13 @@ - + + + + + + + diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/Message.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/Message.java deleted file mode 100644 index 8fb2b0e..0000000 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/client/chat/Message.java +++ /dev/null @@ -1,136 +0,0 @@ -package ch.unibas.dmi.dbis.cs108.casono.client.chat; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Message Object for internal handling of Chat-Messages - * TODO: Should be used on both sides of the network - */ - -public class Message { - private final MessageType type; - private final String message; - public String user; - public String timestamp; - public int game_id = 0; - public String target = null; - public enum MessageType { - GLOBAL, LOBBY, WHISPER - }; - - /** - * Constructor for creating Messages with all information given - * @param type - Either global, local or whisper - * @param game_id - lobby id, or null, if the type is global - * @param user - username - * @param target - username of the target user, for whisper chat - * @param message - */ - - public Message(MessageType type, int game_id, String user, String target, String timestamp, String message) { - this.type = type; - this.game_id = game_id; - this.user = user; - this.target = target; - this.timestamp = timestamp; - this.message = message; - } - - /** - * Constructor for creating the Messages of the current user, using this client -> time of writing is being recorded - * @param type - Either global, local or whisper - * @param game_id - lobby id, or null, if the type is global - * @param user - username - * @param target - username of the target user, for whisper chat - * @param message - */ - - public Message(MessageType type, int game_id, String user, String target, String message) { - this.type = type; - this.game_id = game_id; - this.user = user; - this.target = target; - this.message = message; - LocalDateTime now = LocalDateTime.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm"); - this.timestamp = now.format(formatter); - } - - - public String getMessage() { - return message; - } - - public MessageType getMessageType() { - return type; - } - - /* - * Method to test the system - * @return - String representation of the Message instance, as for example "player1: Hello World" - - public String toString() { - return String.format("%s: %s", this.user, this.message); - } - */ - /** - * Method to create the request representation of the message object, to be sent to the server - * @return - request as specified in the network protocol, as String - */ - public String toArgsString() { - return String.format("TYPE=%s GAME=%d USER=%s TARGET=%s TIME=%s TEXT=%s", - this.type.toString(), this.game_id, this.user, this.target, this.timestamp, this.message); - } - - - /** - * Pattern, to analyze the response String with the given parameters - */ - public static Pattern msgRex = Pattern.compile( - "TYPE=(?\\w+) GAME=(?\\w+) USER=(?\\w+) TARGET=(?\\w+) TIME=(?