Micro-project : 01—Discover the Application of the Micro-Project, Minisocs
Getting started
Connect to the GitLabEnse platform at https://gitlabensee.imtbs-tsp.eu by using the button SSO IMTBS-TSP SSO.
Select button Explore project at the top right of the page and search for project csc-mw-project.
In the csc-mw-project page, select the Fork button at the top right of the page. Please, do not change the name of the project: we use scripts to parse your projects.
To add a collaborator to your project, they must log in to the platform at least once. Next, in the left-hand menu, select Manage /Members; then, in the top-right corner of the page, click Invite Members; in the pop-up window, search for your collaborator by entering their name and select Owner as their role.
(Mandatory) Add your lecturers to the project members with the Maintainer role (so that we could help you in the management of the Git repository).
(Mandatory) Use the email on push feature to track the progress of your project. Once on your project page, in the left-hand menu, select Settings / Integrations to access the Emails on push page. In this page, select Send from committer and enter the email addresses of the project members, including those of the theachers.
In a console, execute the following:
-
Clone the Git repository of the GitLabEnse project, the
address being visible with blue-colored button Code
(choose the Clone with SSH address):
$ cd $ mkdir CSC5002 $ git clone git@gitlabensee.imtbs-tsp.eu:csc5002-teachers/csc-mw-project.git $ cd csc-mw-project $ ls -1 MiniSocs # Directory containing the code (you can make backup copy) readme.md # Documentation for getting started + status of the project $ ls -1 MiniSocs/ anomaly-detection # Microservice Anomaly Detection: to be ignored at the beginning LICENSE.txt # minisocs-frontend # Microservice MiniSocs Frontend: to develop first pom.xml # POM for configuring Maven properties that are common to all the other Maven modules readme.md # $ ls -1 MiniSocs/minisocs-frontend/ common-api # Maven module of the API of the application Diagrams # PlantUML diagrams of the documentation hexagon # Maven module of the business part of the application LICENSE.txt # pom.xml # POM for the MiniSocs Frontend microservice readme.md # MarkDown file with the documentation of the MiniSocs application
-
Compile and install the code:
$ cd MiniSocs/ $ mvn clean install # the first compilation takes some time [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] ... [INFO] MINI SOCial networkS [pom] [INFO] MINI SOCial networkS: the common part with the API [jar] [INFO] MINI SOCial networkS: the hexagon or business logic [jar] ... [INFO] ----------------------< minisocs:minisocs-frontend >---------------------- ... [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- ... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for MINI SOCial networkS 1.0-SNAPSHOT: [INFO] [INFO] MINI SOCial networkS ............................... SUCCESS [ 0.891 s] [INFO] MINI SOCial networkS: the common part with the API . SUCCESS [ 2.175 s] [INFO] MINI SOCial networkS: the hexagon or business logic SUCCESS [ 4.520 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: x.xxx s [INFO] Finished at: xxx-xx-xxTxx:xx:xx+xx:xx [INFO] ------------------------------------------------------------------------
- Import the Maven projects in the Eclipse IDE: Select IDE menu File / import; then select Maven / Existing Maven Projects, and use the Browse button to select directory csc-mw-project/MiniSocs. You can see the seven Maven projects in your IDE, three for the Anamoly Detection microservice (namely, minisocs-anomaly-dection, minisocs-anomaly-detection.common-api, and minisocs-anomaly-detection.hexagon), three for the MiniSocs Frontend microservice (namely, minisocs-frontend, minisocs-frontend.common-api, and minisocs-frontend.hexagon), and one for configuring Maven, whose name is minisocs-BOM (BOM stands for Bill Of Materials).
-
In Eclipse, execute JUnit test
class TestScenario: Browse the classes of
the minisocs-frontend.hexagon Maven project to
find the class; then, right-click on the class and select
menu Run As / JUnit Test. You should see in
the Eclipse console some text similar to the following:
moderator, new notification : type = new message; contents = {"newMessages":[{"nameSocialNetwork":"csc5002","instant":1787666233.363248481,"content":"messageModerator"}]} member, new notification : type = new message; contents = {"newMessages":[{"nameSocialNetwork":"csc5002","instant":1787666233.363248481,"content":"messageModerator"}]} moderator, new notification : type = moderation request; contents = {"nameSocialNetwork":"csc5002","instant":1787666233.588221699} ... otherMember, new notification : type = new messages; contents = {"newMessages":[{"nameSocialNetwork":"csc5002","instant":1787666233.809337644,"content":"otherMessageModerator"},{"nameSocialNetwork":"csc5002","instant":1787666233.588221699,"content":"messageMember"},{"nameSocialNetwork":"csc5002","instant":1787666233.363248481,"content":"messageModerator"}]}
-
In a terminal, in
directory MiniSocs-solution/minisocs-frontend/hexagon/,
execute the same JUnit test class with the following Maven
command:
$ mvn test -Dtest=mw.minisocs.validation.TestScenario
Organisation of the code
We use Maven for organising the code and building the software.
Verify that you are able to answer the following questions on Maven.
The module dependencies are declared in files pom.xml with in tags <dependencies> and <dependency>.
The parent module at the root (file pom.xml in directory MiniSocs) is used to centralise the Maven configuration for all the other modules in the system under development: e.g. version of JAVA and other libraries, and Maven plug-ins to use when building the modules with some Java code, etc.
We have placed the API, along with constants and common classes, in the minisocs-frontend.common-api module. The objective is that all the other modules share this code by using a Maven dependency relationship.
Requirements, Specification, and Design of the application
The requirements, the specification and the design of the application are documented in file MiniSocs/minisocs-frontend/readme.mdreadme.md. This a MarkDown file that you can visualise and read in your browser: as its name suggests, this is the main page of the GitLab project.
Please also note that some validation tests are set out in the same readme.md MarkDown documentation file.
Verify that you are able to answer the following questions on the documentation of the application.
Secondly, the main difference and the added value of the application lie in the moderation of each message within a social network; this is possible because there are few members in a social network.
Thirdly, the users can choose to be notified of new messages according to several strategies: immediate, daily, etc.
The list of uses cases that are not implemented yet: block user account, remove user account, remove social network, remove member, promote user as moderator, remove moderation for user, modify one of their messages, hide one of their messages, remove one of their messages.
The input data of use case "moderate a message" are: the moderator's pseudo, the name of the social network, the instant of creation of the message, the moderator's decision. The first three arguments are unique identifiers of the user, the social network, and the message, respectively.
N.B. : in this ‘toy’ application, it is reasonable to uniquely identify a message with the instant of its creation.
The results of this use case are notifications of the new message sent to members who have selected the ‘immediate’ notification strategy.
NotificationManager plays the same role, but for the exit: This is the unique exit point of the system. All the Java Flow SubmissionPublisher objects are in that class, and all the notifications go through that class.
In the other state machine diagram, similar questions arise regarding the deletion of social networks.
Java Code of the Application
Verify that you are able to answer the following questions on the code of the application.
Given a use case, the implementation of a sequence diagram is found in part whithin the corresponding method of the Façade, and the sub-messages are found in the methods called by the Façade's method.
Let us observe that these verifications may through exceptions of type UnfeasibleOperation.
On the contrary, the exceptions thrown by the Façade's methods are part of their prototype (the programming interface). As a consequence, we use checked exceptions.