Skip to content

Commit

Permalink
Merge pull request #104 from Arquisoft/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
uo284548 authored Apr 10, 2023
2 parents abff66e + c7b9c7e commit 2145f92
Show file tree
Hide file tree
Showing 72 changed files with 24,015 additions and 12,133 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/lomap_es2b.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,35 @@ name: CI for LOMAP_ES2B
on:
release:
types: [published]
pull_request:
branches:
- master
- develop
push:
branches:
- develop

jobs:
unit-test-webapp:
unit-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: webapp
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test --coverage --watchAll
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
unit-test-restapi:
runs-on: ubuntu-latest
defaults:
run:
working-directory: restapi
steps:
- uses: actions/checkout@v3
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test --coverage --watchAll
- run: npm --prefix webapp ci
- run: npm --prefix restapi ci
- run: npm --prefix webapp test --coverage --watchAll
- run: npm --prefix restapi test --coverage --watchAll
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
e2e-tests:
needs: [unit-test-webapp, unit-test-restapi]
needs: [unit-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
5 changes: 5 additions & 0 deletions docs/03_system_scope_and_context.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ image::diagrama.png[]
=== Technical Context

To develop this aplication we are going to use SOLID architecture using PODs to store the user’s personal data. As programming lenguaje we are going to use TypeScript with REACT to create the inteface. We will use NodeJS as execution enviroment. On the other hand, we are going to use the NonSQL datebase MongoDB.
For the restApi we will use the work express framework.Mapbox will be our map provider and we will rely on MUI library to make the graphic interface.

[options="header",cols="1,2"]
|===
Expand All @@ -52,5 +53,9 @@ To develop this aplication we are going to use SOLID architecture using PODs to
| PODs | Store the personal data
| TYPESCRIPT | Main programing lenguage
| REACT | The library to make the GUI
| Mui | Provides components
| Node.js | The execution enviroment
| Express | Framework for the restapi
| Mapbox | Map api

|===
19 changes: 19 additions & 0 deletions docs/05_building_block_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,22 @@ Contained Building Blocks::
|Database
|Saves the data tha the pod does not
|===

=== Level 2

:imagesdir: images/
image::05_Diagrama_Level_2.png[]

Motivation::
In this section the description is extended to provide more info on how it works.

Contained Building Blocks::
[options="header",cols="1,2"]
|===
|Name| Description
|Log in|Authenticates the user with their solid account
|Manage friend| Allows to add and delete friends
|Add marker| Allows you to add markers
|Delele marker| Allows you to delete markers
|Share marker| Allows you to share markers with friends
|===
36 changes: 36 additions & 0 deletions docs/06_runtime_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,39 @@ The pod returns the result of the login.
:imagesdir: images/
image::06_Diagrama_secuencia_anadir_mark.png[]
The app ask for the data of the mark, when receives the data, the app create the mark and saves it on the pod.

=== Delete mark

:imagesdir: images/
image::06_Diagrama_secuencia_delete.png[]
The app delete the mark from the Pod.

=== Add friend

:imagesdir: images/
image::06_Diagrama_secuencia_addFriend.png[]
To add a friend, the user is asked for a webID and the user with that webID is added to friends.

=== Delete friend

:imagesdir: images/
image::06_Diagrama_secuencia_deleteFriend.png[]
The user delete and confirm on the app and the app remove the friend from the POD.

=== Load markers

:imagesdir: images/
image::06_Diagrama_secuencia_loadMarkers.png[]
The app first loads its own marks, then those of friends and finally shows them.

=== Share markers

:imagesdir: images/
image::06_Diagrama_secuencia_shareMark.png[]
The app change the state of the marker and save it into the public folder of the POD.

=== Make marker private

:imagesdir: images/
image::06_Diagrama_secuencia_privateMark.png[]
The app change the state of the marker and save it into the private folder of the POD.
2 changes: 1 addition & 1 deletion docs/08_concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ image::Modelo de dominio.png[]
[options="header",cols="1,2"]
|===
| Entity | Description
| User | Application user
| User | Application user which is saved in SOLID
| Marker | Location marker with the information
|===

Expand Down
17 changes: 2 additions & 15 deletions docs/10_quality_scenarios.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@
== Quality Requirements

=== Quality Tree

[plantuml, "Quality tree", png]
----
left to right direction
(Privacy) as (Pr)
(Usability) as (U)
(Security) as (S)
(Interoperability) as (I)
(Portability) as (P)
User --> Pr
User --> U
User --> S
User --> I
User --> P
----
:imagesdir: images/
image::QualityTree.PNG[]

=== Quality Scenarios
[options="header",cols="1,3,3,1"]
Expand Down
Binary file modified docs/images/05_Diagrama_Level_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/05_Diagrama_Level_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/06_Diagrama_secuencia_addFriend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/06_Diagrama_secuencia_anadir_mark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/06_Diagrama_secuencia_delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/06_Diagrama_secuencia_loadMarkers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/06_Diagrama_secuencia_privateMark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/06_Diagrama_secuencia_shareMark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/Modelo de dominio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/QualityTree.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/diagrama.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions restapi/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NODE_ENV=development
PORT=5000

MONGODB_USERNAME=lomap_es2b
MONGODB_PASSWORD=ZPDS0tM0vRoeiSPA
MONGODB_DATABASE_NAME=lomap
MONGODB_TEST_DATABASE_NAME=lm-test
MONGODB_HOST=cluster0.9hp3spq.mongodb.net

JWT_TOKEN=secret
98 changes: 49 additions & 49 deletions restapi/tests/api.test.ts → restapi/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import request, {Response} from 'supertest';
import express, { Application } from 'express';
import * as http from 'http';
import bp from 'body-parser';
import cors from 'cors';
import api from '../api';

let app:Application;
let server:http.Server;

beforeAll(async () => {
app = express();
const port: number = 5000;
const options: cors.CorsOptions = {
origin: ['http://localhost:3000']
};
app.use(cors(options));
app.use(bp.json());
app.use("/api", api)

server = app.listen(port, ():void => {
console.log('Restapi server for testing listening on '+ port);
}).on("error",(error:Error)=>{
console.error('Error occured: ' + error.message);
});
});

afterAll(async () => {
server.close() //close the server
})

describe('user ', () => {
/**
* Test that we can list users without any error.
*/
it('can be listed',async () => {
const response:Response = await request(app).get("/api/users/list");
expect(response.statusCode).toBe(200);
});

/**
* Tests that a user can be created through the productService without throwing any errors.
*/
it('can be created correctly', async () => {
let username:string = 'Pablo'
let email:string = 'gonzalezgpablo@uniovi.es'
const response:Response = await request(app).post('/api/users/add').send({name: username,email: email}).set('Accept', 'application/json')
expect(response.statusCode).toBe(200);
});
import request, {Response} from 'supertest';
import express, { Application } from 'express';
import * as http from 'http';
import bp from 'body-parser';
import cors from 'cors';
import api from './api';

let app:Application;
let server:http.Server;

beforeAll(async () => {
app = express();
const port: number = 5000;
const options: cors.CorsOptions = {
origin: ['http://localhost:3000']
};
app.use(cors(options));
app.use(bp.json());
app.use("/api", api)

server = app.listen(port, ():void => {
console.log('Restapi server for testing listening on '+ port);
}).on("error",(error:Error)=>{
console.error('Error occured: ' + error.message);
});
});

afterAll(async () => {
server.close() //close the server
})

describe('user ', () => {
/**
* Test that we can list users without any error.
*/
it('can be listed',async () => {
const response:Response = await request(app).get("/api/users/list");
expect(response.statusCode).toBe(200);
});

/**
* Tests that a user can be created through the productService without throwing any errors.
*/
it('can be created correctly', async () => {
let username:string = 'Pablo'
let email:string = 'gonzalezgpablo@uniovi.es'
const response:Response = await request(app).post('/api/users/add').send({name: username,email: email}).set('Accept', 'application/json')
expect(response.statusCode).toBe(200);
});
});
5 changes: 5 additions & 0 deletions restapi/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
transform: {
"^.+\\.tsx?$": "ts-jest"
},
}
10 changes: 10 additions & 0 deletions restapi/tests/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NODE_ENV=development
PORT=5000

MONGODB_USERNAME=lomap_test
MONGODB_PASSWORD=UMW9dIUMVryPPBdw
MONGODB_DATABASE_NAME=lm-test
MONGODB_TEST_DATABASE_NAME=lm-test
MONGODB_HOST=cluster0.9hp3spq.mongodb.net

JWT_TOKEN=secret
8 changes: 0 additions & 8 deletions restapi/tests/jest.config.ts

This file was deleted.

3 changes: 2 additions & 1 deletion webapp/e2e/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default {
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
moduleNameMapper:{"^uuid$": "uuid"},
preset: "jest-puppeteer",
passWithNoTests: true,
testTimeout: 30000
}
}
Loading

0 comments on commit 2145f92

Please sign in to comment.