Giter VIP home page Giter VIP logo

java_socketio_chatroom's Introduction

Ubuntu Action Status Windows Action Status macOS Action Status

Coverage Status

Maintainability Rating Reliability Rating Security Rating Quality Gate Status
Bugs Code Smells Coverage Duplicated Lines (%) Technical Debt Vulnerabilities


Chatroom App

Advanced Programming Techniques exam project at UNIFI

Our project is a simple chatroom application developed in Java 8, with communications between clients and server handled by the socket.io library, natively in JavaScript. We used this Java port to develop the Server and this to develop the Client. Messages are stored in a MongoDB database and the GUI is implemented with Java Swing.

Building

N.B. The Server is bound to TCP port 3000, make sure that it is available before continuing.

  1. Clone the repo:
git clone https://github.com/marcodiri/java_socketio_chatroom.git
  1. Navigate inside the root project directory:
cd java_socketio_chatroom

Build with Maven

You can build the Server and Client jars with Maven using the command (we suggest using the provided wrapper mvnw on Unix or mvnw.cmd on Windows):

./mvnw -f java_socketio_chatroom_aggregator/pom.xml clean package -Dmaven.test.skip

You'll find the jars in the target folder of the corresponding module.

Testing

Maven

You can run the tests with Maven using the command:

./mvnw -f java_socketio_chatroom_aggregator/pom.xml clean verify

Unit tests and Integration tests

The following profiles can be enabled with the -P Maven switch:

  • jacoco to check the code coverage
  • mutation-testing to run mutation testing with PIT

End to End tests

E2E tests are enabled by default. If you wish to skip it, set the variable -DskipE2E in the Maven command.

IDE

For IT and E2E tests you'll need to have a running instance of MongoDB, either on your PC on port 27017 or in a Docker container with the command:

docker run --rm  -p 27017:27017 mongo:4.2.15

Then you can manually run the tests from your favourite IDE.

Running

Build the modules following the steps in the Building section. To launch the application run the generated *-jar-with-dependencies.jar in the target folder of the corresponding module, with the command:

Server

cd java_socketio_chatroom_server
java -jar ./target/*-jar-with-dependencies.jar

Client

cd java_socketio_chatroom_client
java -jar ./target/*-jar-with-dependencies.jar hostname

The hostname or IP address of the Server must be indicated in the hostname parameter.

Known issues

It seems that sometimes the socket.io library is not able to send or receive the events correctly, resulting in tests failure or undefined behaviours by the Client application. We reported the issue to the library maintainers.

java_socketio_chatroom's People

Contributors

marcodiri avatar

java_socketio_chatroom's Issues

Start Mongo docker image with random port

See if it's possible to run the MongoDB docker image with a random port.
The problem is that pitest-maven plugin seems to not being able to connect to db when the maven-failsafe-plugin property is set.

Client continuously disconnects from server after a few seconds

When the client disconnects it automatically tries to reconnect but after a few seconds it disconnects again and tries another reconnect and so on... This cycle performs some operations that are not supported by our application.
Therefore we must prevent the client from disconnecting, probably by implementing the websocket protocol

Fix maven build warnings and errors

  • Reports path not found or is not a directory: /home/runner/work/java_socketio_chatroom/java_socketio_chatroom/java_socketio_chatroom_e2e/target/surefire-reports because in e2e module there are no unit tests.

  • JAR will be empty - no content was marked for inclusion! in e2e module because there are no source files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.