diff --git a/angular.json b/angular.json index a04f750..dbfc862 100644 --- a/angular.json +++ b/angular.json @@ -24,9 +24,19 @@ "styles": [ "node_modules/bootstrap/dist/css/bootstrap.min.css", "./node_modules/@angular/material/prebuilt-themes/pink-bluegrey.css", - "apps/sample-platform/src/styles.css" + "apps/sample-platform/src/styles.scss", + "node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss", + "node_modules/@fortawesome/fontawesome-free/scss/solid.scss", + "node_modules/@fortawesome/fontawesome-free/scss/regular.scss", + "node_modules/@fortawesome/fontawesome-free/scss/brands.scss", + "node_modules/angular-bootstrap-md/assets/scss/bootstrap/bootstrap.scss", + "node_modules/angular-bootstrap-md/assets/scss/mdb.scss", + "node_modules/animate.css/animate.css" ], - "scripts": [] + "scripts": [ + "node_modules/chart.js/dist/Chart.js", + "node_modules/hammerjs/hammer.min.js" + ] }, "configurations": { "production": { @@ -530,6 +540,157 @@ "style": "scss" } } + }, + "api-implementation-report": { + "root": "libs/api-implementation/report", + "sourceRoot": "libs/api-implementation/report/src", + "projectType": "library", + "schematics": {}, + "architect": { + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "libs/api-implementation/report/tsconfig.lib.json", + "libs/api-implementation/report/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**", + "!libs/api-implementation/report/**" + ] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/api-implementation/report/jest.config.js", + "tsConfig": "libs/api-implementation/report/tsconfig.spec.json", + "passWithNoTests": true + } + } + } + }, + "api-implementation-test-entry": { + "root": "libs/api-implementation/test-entry", + "sourceRoot": "libs/api-implementation/test-entry/src", + "projectType": "library", + "schematics": {}, + "architect": { + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "libs/api-implementation/test-entry/tsconfig.lib.json", + "libs/api-implementation/test-entry/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**", + "!libs/api-implementation/test-entry/**" + ] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/api-implementation/test-entry/jest.config.js", + "tsConfig": "libs/api-implementation/test-entry/tsconfig.spec.json", + "passWithNoTests": true + } + } + } + }, + "frontend-test-entry": { + "projectType": "library", + "root": "libs/frontend/test-entry", + "sourceRoot": "libs/frontend/test-entry/src", + "prefix": "frontend", + "architect": { + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "libs/frontend/test-entry/tsconfig.lib.json", + "libs/frontend/test-entry/tsconfig.spec.json" + ], + "exclude": ["**/node_modules/**", "!libs/frontend/test-entry/**"] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/frontend/test-entry/jest.config.js", + "tsConfig": "libs/frontend/test-entry/tsconfig.spec.json", + "passWithNoTests": true, + "setupFile": "libs/frontend/test-entry/src/test-setup.ts" + } + } + }, + "schematics": { + "@nrwl/angular:component": { + "style": "scss" + } + } + }, + "api-implementation-test-run": { + "root": "libs/api-implementation/test-run", + "sourceRoot": "libs/api-implementation/test-run/src", + "projectType": "library", + "schematics": {}, + "architect": { + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "libs/api-implementation/test-run/tsconfig.lib.json", + "libs/api-implementation/test-run/tsconfig.spec.json" + ], + "exclude": [ + "**/node_modules/**", + "!libs/api-implementation/test-run/**" + ] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/api-implementation/test-run/jest.config.js", + "tsConfig": "libs/api-implementation/test-run/tsconfig.spec.json", + "passWithNoTests": true + } + } + } + }, + "frontend-test-runs": { + "projectType": "library", + "root": "libs/frontend/test-runs", + "sourceRoot": "libs/frontend/test-runs/src", + "prefix": "frontend", + "architect": { + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "libs/frontend/test-runs/tsconfig.lib.json", + "libs/frontend/test-runs/tsconfig.spec.json" + ], + "exclude": ["**/node_modules/**", "!libs/frontend/test-runs/**"] + } + }, + "test": { + "builder": "@nrwl/jest:jest", + "options": { + "jestConfig": "libs/frontend/test-runs/jest.config.js", + "tsConfig": "libs/frontend/test-runs/tsconfig.spec.json", + "passWithNoTests": true, + "setupFile": "libs/frontend/test-runs/src/test-setup.ts" + } + } + }, + "schematics": { + "@nrwl/angular:component": { + "style": "scss" + } + } } }, "cli": { diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index 06638e6..e10b977 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -1,17 +1,28 @@ -import { Module } from '@nestjs/common'; +import { Module, HttpModule } from '@nestjs/common'; import { AppController } from './app.controller'; +//TODO: fix the naming so that prefix import will work import { VMOrchestrationModule } from '../../../../libs/api-implementation/orchestration/src'; import { ApiImplementationRegressionTestsModule } from '@new-sample-platform/api-implementation/regression-tests'; import { ApiImplementationDatabaseModule } from '@new-sample-platform/api-implementation/database'; -import { ApiImplementationSamplesModule } from '@new-sample-platform/api-implementation/samples' +import { ApiImplementationSamplesModule } from '@new-sample-platform/api-implementation/samples'; +import { ApiImplementationReportModule } from '@new-sample-platform/api-implementation/report'; +import { ApiImplementationTestEntryModule } from '@new-sample-platform/api-implementation/test-entry'; +import { ApiImplementationXmlModule } from '@new-sample-platform/api-implementation/xml'; +import { ApiImplementationTestRunModule } from '@new-sample-platform/api-implementation/test-run'; +import { HttpAdapterHost } from '@nestjs/core'; @Module({ imports: [ + HttpAdapterHost, VMOrchestrationModule, + ApiImplementationTestRunModule, + ApiImplementationXmlModule, + ApiImplementationTestEntryModule, + ApiImplementationReportModule, ApiImplementationRegressionTestsModule, ApiImplementationDatabaseModule, - ApiImplementationSamplesModule + ApiImplementationSamplesModule, ], controllers: [AppController], providers: [], diff --git a/apps/api/tsconfig.json b/apps/api/tsconfig.json index 4d5dcd9..cdafb1f 100644 --- a/apps/api/tsconfig.json +++ b/apps/api/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "types": ["node", "jest"], "emitDecoratorMetadata": true, - "target": "es2015" + "target": "es6" }, "include": ["**/*.ts"] } diff --git a/apps/github-interactions-api/tsconfig.json b/apps/github-interactions-api/tsconfig.json index 4d5dcd9..cdafb1f 100644 --- a/apps/github-interactions-api/tsconfig.json +++ b/apps/github-interactions-api/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "types": ["node", "jest"], "emitDecoratorMetadata": true, - "target": "es2015" + "target": "es6" }, "include": ["**/*.ts"] } diff --git a/apps/sample-platform/proxy.conf.json b/apps/sample-platform/proxy.conf.json index 37da373..9a1dea2 100644 --- a/apps/sample-platform/proxy.conf.json +++ b/apps/sample-platform/proxy.conf.json @@ -1,5 +1,5 @@ { - "/api/*": { + "/api": { "target": "http://localhost:3333", "secure": false, "changeOrigin": true, diff --git a/apps/sample-platform/src/app/app.component.css b/apps/sample-platform/src/app/app.component.css index e69de29..df99981 100644 --- a/apps/sample-platform/src/app/app.component.css +++ b/apps/sample-platform/src/app/app.component.css @@ -0,0 +1,5 @@ +.logo { + /* height: 10%; */ + width: 10%; + /* float: right; */ +} \ No newline at end of file diff --git a/apps/sample-platform/src/app/app.component.html b/apps/sample-platform/src/app/app.component.html index b7c7904..e1b7e9c 100644 --- a/apps/sample-platform/src/app/app.component.html +++ b/apps/sample-platform/src/app/app.component.html @@ -1,3 +1,40 @@ + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/apps/sample-platform/src/app/app.module.ts b/apps/sample-platform/src/app/app.module.ts index 34e18d4..ee9ab06 100644 --- a/apps/sample-platform/src/app/app.module.ts +++ b/apps/sample-platform/src/app/app.module.ts @@ -12,6 +12,7 @@ import { MatIconModule } from '@angular/material/icon'; import { MatButtonModule } from '@angular/material/button'; import { FormsModule } from '@angular/forms'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { MDBBootstrapModule } from 'angular-bootstrap-md'; @NgModule({ declarations: [AppComponent], @@ -27,6 +28,7 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; MatButtonModule, FormsModule, NgbModule, + MDBBootstrapModule.forRoot(), ], providers: [], bootstrap: [AppComponent], diff --git a/apps/sample-platform/src/app/routing.module.ts b/apps/sample-platform/src/app/routing.module.ts index 40e1a61..2dfe9ac 100644 --- a/apps/sample-platform/src/app/routing.module.ts +++ b/apps/sample-platform/src/app/routing.module.ts @@ -1,9 +1,5 @@ import { NgModule } from '@angular/core'; -import { - PreloadAllModules, - RouterModule, - Routes, -} from '@angular/router'; +import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; const routes: Routes = [ { @@ -11,15 +7,29 @@ const routes: Routes = [ loadChildren: () => import('@new-sample-platform/frontend/regression-test').then( (mod) => mod.FrontendRegressionTestModule - ) + ), }, { path: 'samples', loadChildren: () => import('@new-sample-platform/frontend/samples').then( (mod) => mod.FrontendSamplesModule - ) - } + ), + }, + { + path: 'test-entry', + loadChildren: () => + import('@new-sample-platform/frontend/test-entry').then( + (mod) => mod.FrontendTestEntryModule + ), + }, + { + path: 'test-runs', + loadChildren: () => + import('@new-sample-platform/frontend/test-runs').then( + (mod) => mod.FrontendTestRunsModule + ), + }, ]; @NgModule({ diff --git a/apps/sample-platform/src/styles.css b/apps/sample-platform/src/styles.scss similarity index 83% rename from apps/sample-platform/src/styles.css rename to apps/sample-platform/src/styles.scss index 23894ad..f45d671 100644 --- a/apps/sample-platform/src/styles.css +++ b/apps/sample-platform/src/styles.scss @@ -1,4 +1,4 @@ /* You can add global styles to this file, and also import other style files */ html, body { height: 100%; } -body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; background-color: aliceblue;} +body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; background-color: white;} diff --git a/config.ts b/config.ts index f349d03..c097f5d 100644 --- a/config.ts +++ b/config.ts @@ -5,5 +5,7 @@ export enum AppConfig { CCEXTRACTOR_REPO_NAME = "ccextractor", CCEXTRACTOR_REPO_OWNER = "zelzhan", MONGO_CONNECTION_STRING = "mongodb://mongo:27017/test", - PATH_TO_MOUNTED_BUCKET = "/path/to/bucket/" + PATH_TO_MOUNTED_BUCKET = "/path/to/bucket/", + EXTERNAL_IP = "http://192.168.0.1:2000", + VM_ZONE = "us-central1-c" } diff --git a/libs/api-implementation/models/file/file.models.ts b/libs/api-implementation/models/file/file.models.ts new file mode 100644 index 0000000..0e3296e --- /dev/null +++ b/libs/api-implementation/models/file/file.models.ts @@ -0,0 +1,4 @@ +import { model } from 'mongoose'; +import { IFileDocument } from './file.types'; +import FileSchema from './file.schema'; +export const FileModel: model = model('file', FileSchema); diff --git a/libs/api-implementation/models/file/file.schema.ts b/libs/api-implementation/models/file/file.schema.ts new file mode 100644 index 0000000..7c74bb6 --- /dev/null +++ b/libs/api-implementation/models/file/file.schema.ts @@ -0,0 +1,13 @@ +import { Schema } from 'mongoose'; + +const FileSchema = new Schema({ + filename: { + type: String, + required: true, + }, + buffer: { + type: Buffer, + required: true, + }, +}); +export default FileSchema; diff --git a/libs/api-implementation/models/file/file.types.ts b/libs/api-implementation/models/file/file.types.ts new file mode 100644 index 0000000..590f841 --- /dev/null +++ b/libs/api-implementation/models/file/file.types.ts @@ -0,0 +1,10 @@ +import { Document, Model } from 'mongoose'; + +export interface IFile { + filename: String; + dateOfEntry?: Date; + lastUpdated?: Date; +} + +export interface IFileDocument extends IFile, Document {} +export interface IFileModel extends Model {} diff --git a/libs/api-implementation/models/regression-tests/regression-test.models.ts b/libs/api-implementation/models/regression-tests/regression-test.models.ts index 122e0db..76acbe2 100644 --- a/libs/api-implementation/models/regression-tests/regression-test.models.ts +++ b/libs/api-implementation/models/regression-tests/regression-test.models.ts @@ -1,4 +1,7 @@ -import { model } from "mongoose"; -import { IRegressionTestDocument } from "./regression-test.types"; -import RegressionTestSchema from "./regression-test.schema"; -export const RegressionTestModel:model = model("regression-test", RegressionTestSchema); +import { model } from 'mongoose'; +import { IRegressionTestDocument } from './regression-test.types'; +import RegressionTestSchema from './regression-test.schema'; +export const RegressionTestModel: model = model( + 'regression-test', + RegressionTestSchema +); diff --git a/libs/api-implementation/models/samples/sample.models.ts b/libs/api-implementation/models/samples/sample.models.ts new file mode 100644 index 0000000..da4f86b --- /dev/null +++ b/libs/api-implementation/models/samples/sample.models.ts @@ -0,0 +1,7 @@ +import { model } from 'mongoose'; +import { ISampleDocument } from './sample.types'; +import SampleSchema from './sample.schema'; +export const SampleModel: model = model( + 'sample', + SampleSchema +); diff --git a/libs/api-implementation/models/samples/sample.schema.ts b/libs/api-implementation/models/samples/sample.schema.ts new file mode 100644 index 0000000..5128b26 --- /dev/null +++ b/libs/api-implementation/models/samples/sample.schema.ts @@ -0,0 +1,17 @@ +import { Schema } from 'mongoose'; + +const SampleSchema = new Schema({ + filename: { + type: String, + required: true, + }, + dateOfEntry: { + type: Date, + default: new Date(), + }, + lastUpdated: { + type: Date, + default: new Date(), + }, +}); +export default SampleSchema; diff --git a/libs/api-implementation/models/samples/sample.types.ts b/libs/api-implementation/models/samples/sample.types.ts new file mode 100644 index 0000000..14e9951 --- /dev/null +++ b/libs/api-implementation/models/samples/sample.types.ts @@ -0,0 +1,10 @@ +import { Document, Model } from "mongoose"; + +export interface ISample { + filename: String; + dateOfEntry?: Date; + lastUpdated?: Date; +} + +export interface ISampleDocument extends ISample, Document {} +export interface ISampleModel extends Model {} \ No newline at end of file diff --git a/libs/api-implementation/models/test-entries/test-entry.models.ts b/libs/api-implementation/models/test-entries/test-entry.models.ts new file mode 100644 index 0000000..0c348bf --- /dev/null +++ b/libs/api-implementation/models/test-entries/test-entry.models.ts @@ -0,0 +1,7 @@ +import { model } from 'mongoose'; +import { ITestEntryDocument } from './test-entry.types'; +import TestEntrySchema from './test-entry.schema'; +export const TestEntryModel: model = model( + 'test-entry', + TestEntrySchema +); diff --git a/libs/api-implementation/models/test-entries/test-entry.schema.ts b/libs/api-implementation/models/test-entries/test-entry.schema.ts new file mode 100644 index 0000000..431f97e --- /dev/null +++ b/libs/api-implementation/models/test-entries/test-entry.schema.ts @@ -0,0 +1,54 @@ +import * as mongoose from 'mongoose'; +import { Schema } from 'mongoose'; +import * as mongoose_sequence from 'mongoose-sequence'; + +const AutoIncrement = mongoose_sequence(mongoose); + +const TestEntrySchema = new Schema( + { + _id: Number, + category: { + type: String, + enum: [ + 'broken', + 'cea-708', + 'dvb', + 'dvd', + 'dvr-ms', + 'general', + 'hauppage', + 'mp4', + 'nocc', + 'options', + 'teletext', + 'wtv', + 'xds', + ], + required: true, + }, + correctFiles: { + type: [Object], + required: true, + }, + sample: { + type: String, + required: true, + }, + command: { + type: String, + required: true, + }, + dateOfEntry: { + type: Date, + default: new Date(), + }, + lastUpdated: { + type: Date, + default: new Date(), + }, + }, + { _id: false } +); + +TestEntrySchema.plugin(AutoIncrement); +export default TestEntrySchema; diff --git a/libs/api-implementation/models/test-entries/test-entry.types.ts b/libs/api-implementation/models/test-entries/test-entry.types.ts new file mode 100644 index 0000000..1f6e50e --- /dev/null +++ b/libs/api-implementation/models/test-entries/test-entry.types.ts @@ -0,0 +1,13 @@ +import { Document, Model } from "mongoose"; + +export interface ITestEntry { + category: string; + correctFiles: Object[]; + command: string; + sample: string; + dateOfEntry?: Date; + lastUpdated?: Date; +} + +export interface ITestEntryDocument extends ITestEntry, Document {} +export interface ITestEntryModel extends Model {} \ No newline at end of file diff --git a/libs/api-implementation/models/test-run/test-run.models.ts b/libs/api-implementation/models/test-run/test-run.models.ts new file mode 100644 index 0000000..479b670 --- /dev/null +++ b/libs/api-implementation/models/test-run/test-run.models.ts @@ -0,0 +1,7 @@ +import { model } from 'mongoose'; +import { ITestRunDocument } from './test-run.types'; +import TestRunSchema from './test-run.schema'; +export const TestRunModel: model = model( + 'test-run', + TestRunSchema +); diff --git a/libs/api-implementation/models/test-run/test-run.schema.ts b/libs/api-implementation/models/test-run/test-run.schema.ts new file mode 100644 index 0000000..d470808 --- /dev/null +++ b/libs/api-implementation/models/test-run/test-run.schema.ts @@ -0,0 +1,42 @@ +import { Schema } from 'mongoose'; + +const TestRunSchema = new Schema({ + githubNumber: { + type: String, + required: true, + }, + + type: { + type: String, + enum: ['Commit', 'PullRequest'], + required: true, + }, + + succeed: { + type: Boolean, + }, + results: [ + { + id: { + type: Number, + required: true, + }, + success: { + type: Boolean, + required: true, + }, + runTime: Number, + exitCode: Number, + }, + ], + dateOfEntry: { + type: Date, + default: new Date(), + }, + lastUpdated: { + type: Date, + default: new Date(), + }, +}); + +export default TestRunSchema; diff --git a/libs/api-implementation/models/test-run/test-run.types.ts b/libs/api-implementation/models/test-run/test-run.types.ts new file mode 100644 index 0000000..f34f47f --- /dev/null +++ b/libs/api-implementation/models/test-run/test-run.types.ts @@ -0,0 +1,12 @@ +import { Document, Model } from 'mongoose'; + +export interface ITestRun { + githubNumber: Number; + results: Object[]; + success: Boolean; + dateOfEntry?: Date; + lastUpdated?: Date; +} + +export interface ITestRunDocument extends ITestRun, Document {} +export interface ITestRunModel extends Model {} diff --git a/libs/api-implementation/orchestration/src/lib/dto/create-machine.dto.ts b/libs/api-implementation/orchestration/src/lib/dto/create-machine.dto.ts index 708c6e2..6d1069f 100644 --- a/libs/api-implementation/orchestration/src/lib/dto/create-machine.dto.ts +++ b/libs/api-implementation/orchestration/src/lib/dto/create-machine.dto.ts @@ -1,3 +1,13 @@ +import { IsEnum } from 'class-validator'; + +export enum Type { + PullRequest = 'PullRequest', + Commit = 'Commit', +} + export class CreateMachineDTO { name: string; + + @IsEnum(Type) + type: Type; } diff --git a/libs/api-implementation/orchestration/src/lib/interfaces/vm-orchestration-interface.ts b/libs/api-implementation/orchestration/src/lib/interfaces/vm-orchestration-interface.ts index 02303b8..930985f 100644 --- a/libs/api-implementation/orchestration/src/lib/interfaces/vm-orchestration-interface.ts +++ b/libs/api-implementation/orchestration/src/lib/interfaces/vm-orchestration-interface.ts @@ -1,23 +1,22 @@ -import { VMInterface } from "../../../../util/src/lib/interfaces/vm-interface"; +import { VMInterface } from '../../../../util/src/lib/interfaces/vm-interface'; +import { Type } from '../dto/create-machine.dto'; export interface VMOrchestrationInterface { - - createMachine(name: string): void; - + createMachine(name: string, type: Type): void; + reset(name: string): void; - + start(name: string): void; - + stop(name: string): void; - + deleteMachine(name: string): void; - - getNumberOfRunningInstances(): number - getNumberOfTotalInstances(): number + getNumberOfRunningInstances(): number; + + getNumberOfTotalInstances(): number; - getRunningInstances(): VMInterface[] + getRunningInstances(): VMInterface[]; - getAllInstances(): VMInterface[] -} - \ No newline at end of file + getAllInstances(): VMInterface[]; +} diff --git a/libs/api-implementation/orchestration/src/lib/orchestration.controller.ts b/libs/api-implementation/orchestration/src/lib/orchestration.controller.ts index 21d95f8..94158d5 100644 --- a/libs/api-implementation/orchestration/src/lib/orchestration.controller.ts +++ b/libs/api-implementation/orchestration/src/lib/orchestration.controller.ts @@ -9,7 +9,10 @@ export class VMOrchestrationController { @Post('create') async createMachine(@Body() createMachineDTO: CreateMachineDTO) { try { - await this.orchestrationService.createMachine(createMachineDTO.name); + await this.orchestrationService.createMachine( + createMachineDTO.name, + createMachineDTO.type + ); return `Machine ${createMachineDTO.name} successfuly created`; } catch (error) { return `Error while creating the machine`; diff --git a/libs/api-implementation/orchestration/src/lib/services/orchestration.service.spec.ts b/libs/api-implementation/orchestration/src/lib/services/orchestration.service.spec.ts index 6b86b2a..9d0b1f7 100644 --- a/libs/api-implementation/orchestration/src/lib/services/orchestration.service.spec.ts +++ b/libs/api-implementation/orchestration/src/lib/services/orchestration.service.spec.ts @@ -1,32 +1,32 @@ -import { VMOrchestrationService } from './orchestration.service' -import { CreateMachineDTO } from '../dto/create-machine.dto'; -import { instantiateMocked } from '../../../../../testing/src/lib/testing.util' +import { VMOrchestrationService } from './orchestration.service'; +import { CreateMachineDTO, Type } from '../dto/create-machine.dto'; +import { instantiateMocked } from '../../../../../testing/src/lib/testing.util'; import { Compute } from './compute.service'; - describe('Orchestration service', () => { - const compute = instantiateMocked(Compute) + const compute = instantiateMocked(Compute); let vmOrchestrationService: VMOrchestrationService; beforeEach(() => { vmOrchestrationService = new VMOrchestrationService(compute); - }) - + }); + describe('createMachine', () => { it('should be created', () => { expect(vmOrchestrationService).toBeTruthy(); }); it('should successfully create a machine', async () => { - const createMachineDTO = new CreateMachineDTO(); - createMachineDTO.name = "test"; - - jest.spyOn(vmOrchestrationService, 'createVM').mockImplementation((name): any => { - return ["", ""] - }) - await vmOrchestrationService.createMachine('test'); + createMachineDTO.name = 'test'; + + jest + .spyOn(vmOrchestrationService, 'createVM') + .mockImplementation((name): any => { + return ['', '']; + }); + await vmOrchestrationService.createMachine('test', Type.Commit); expect(vmOrchestrationService.createVM).toHaveBeenCalledTimes(1); expect(vmOrchestrationService.getNumberOfRunningInstances()).toEqual(1); diff --git a/libs/api-implementation/orchestration/src/lib/services/orchestration.service.ts b/libs/api-implementation/orchestration/src/lib/services/orchestration.service.ts index e684743..591f83b 100644 --- a/libs/api-implementation/orchestration/src/lib/services/orchestration.service.ts +++ b/libs/api-implementation/orchestration/src/lib/services/orchestration.service.ts @@ -5,10 +5,11 @@ import { Injectable } from '@nestjs/common'; import { HashTable } from '../../../../util/src/lib/interfaces/hashtable-interface'; import { VM } from '../../../../util/src/lib/vm.impl'; import { Status } from '../../../../util/src/lib/interfaces/status-enum'; -import { AppConfig } from '../../../../../../config' +import { AppConfig } from '../../../../../../config'; import * as fs from 'fs'; import * as doAsync from 'doasync'; -import * as path from 'path'; +import * as path from 'path'; +import { Type } from '../dto/create-machine.dto'; @Injectable() export class VMOrchestrationService implements VMOrchestrationInterface { @@ -20,39 +21,48 @@ export class VMOrchestrationService implements VMOrchestrationInterface { constructor(compute: Compute) { this.compute = compute; - this.zone = this.compute.zone('us-central1-c'); + //TODO: put the zone in config file + this.zone = this.compute.zone(AppConfig.VM_ZONE); this.numOfTotalInstances = 0; this.runningMachines = []; this.machines = {}; } - async createMachine(name: string) { + async createMachine(name: string, type: Type) { try { - const [vm, operation] = await this.createVM(name); + const [vm, operation] = await this.createVM(name, type); this.runningMachines.push(vm); this.numOfTotalInstances++; } catch (error) { - console.error("Error while machine creation:") - console.debug(error.stack) - throw(error) + console.error('Error while machine creation:'); + console.debug(error.stack); + throw error; } } - async createVM(name: string) { + async createVM(name: string, type: Type) { let vm, operation; - const config = await this.getConfigFile(); + const config = await this.getConfigFile(name, type); [vm, operation] = await this.zone.createVM(name, config); this.machines[name] = new VM(name, Status.Running, vm); return [this.machines[name], operation]; } - private async getConfigFile() { - - const script = await doAsync(fs).readFile( + private async getConfigFile(name: string, type: Type) { + let script = await doAsync(fs).readFile( //TODO make it more flexible path.resolve(__dirname, `../../../${AppConfig.EXECUTABLE_SCRIPT}`) ); + script = script.toString() + + script = script.replace(/EXTERNAL_IP/g, AppConfig.EXTERNAL_IP) + script = script.replace(/GITHUB_EVENT/g, type) + script = script.replace(/EVENT_IDENTIFICATOR/g, name) + + console.log("HIBLJDAD" + script); + + return return { os: 'ubuntu-1804', http: true, @@ -69,12 +79,11 @@ export class VMOrchestrationService implements VMOrchestrationInterface { async reset(name: string) { try { - const response = await this.machines[name].getInstance().reset(); - console.log(response); + await this.machines[name].getInstance().reset(); } catch (error) { - console.error(`Error occured while reseting the machine ${name}`) - console.debug(error.stack) - throw(error) + console.error(`Error occured while reseting the machine ${name}`); + console.debug(error.stack); + throw error; } } @@ -83,9 +92,9 @@ export class VMOrchestrationService implements VMOrchestrationInterface { await this.machines[name].getInstance().start(); this.runningMachines.push(this.machines[name]); } catch (error) { - console.error(`Error occured while starting the machine ${name}`) - console.debug(error.stack) - throw(error) + console.error(`Error occured while starting the machine ${name}`); + console.debug(error.stack); + throw error; } } @@ -100,8 +109,8 @@ export class VMOrchestrationService implements VMOrchestrationInterface { } } catch (error) { console.error(`Error occured while stopping machine`); - console.debug(error.stack) - throw(error) + console.debug(error.stack); + throw error; } } @@ -117,11 +126,11 @@ export class VMOrchestrationService implements VMOrchestrationInterface { await this.machines[name].getInstance().delete(); } catch (error) { console.error(`Error occured while deleting the machine ${name}`); - console.debug(error.stack) - throw(error) + console.debug(error.stack); + throw error; } } - + getNumberOfRunningInstances(): number { return this.runningMachines.length; } diff --git a/libs/api-implementation/report/README.md b/libs/api-implementation/report/README.md new file mode 100644 index 0000000..59bcfea --- /dev/null +++ b/libs/api-implementation/report/README.md @@ -0,0 +1,7 @@ +# api-implementation-report + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `ng test api-implementation-report` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/api-implementation/report/jest.config.js b/libs/api-implementation/report/jest.config.js new file mode 100644 index 0000000..90b2f0e --- /dev/null +++ b/libs/api-implementation/report/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'api-implementation-report', + preset: '../../../jest.config.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], + coverageDirectory: '../../../coverage/libs/api-implementation/report', +}; diff --git a/libs/api-implementation/report/src/index.ts b/libs/api-implementation/report/src/index.ts new file mode 100644 index 0000000..cffb105 --- /dev/null +++ b/libs/api-implementation/report/src/index.ts @@ -0,0 +1 @@ +export * from './lib/api-implementation-report.module'; diff --git a/libs/api-implementation/report/src/lib/api-implementation-report.module.ts b/libs/api-implementation/report/src/lib/api-implementation-report.module.ts new file mode 100644 index 0000000..07bb0bd --- /dev/null +++ b/libs/api-implementation/report/src/lib/api-implementation-report.module.ts @@ -0,0 +1,14 @@ +import { Module, HttpModule } from '@nestjs/common'; +import { ReportController } from './report.controller'; + +import { HttpAdapterHost } from '@nestjs/core'; +import { ReportService } from './services/report.service'; +import { ApiImplementationDatabaseModule } from '@new-sample-platform/api-implementation/database' + +@Module({ + imports: [HttpAdapterHost, ApiImplementationDatabaseModule], + controllers: [ReportController], + providers: [ReportService], + exports: [], +}) +export class ApiImplementationReportModule {} diff --git a/libs/api-implementation/report/src/lib/report.controller.ts b/libs/api-implementation/report/src/lib/report.controller.ts new file mode 100644 index 0000000..d017779 --- /dev/null +++ b/libs/api-implementation/report/src/lib/report.controller.ts @@ -0,0 +1,48 @@ +import { + Controller, + Post, + UseInterceptors, + UploadedFiles, + Body, + Query, +} from '@nestjs/common'; + +import { AnyFilesInterceptor } from '@nestjs/platform-express'; +import { ReportService } from './services/report.service'; + +@Controller('report') +export class ReportController { + constructor(private service: ReportService) {} + + @Post() + @UseInterceptors(AnyFilesInterceptor()) + async processReport( + @UploadedFiles() files: any[], + @Query() query, + @Body() body + ) { + try { + if (body.type === 'upload') { + const isSuccess = await this.service.fileIsCorrect( + files[0], + body.test_id + ); + await this.service.createResult( + Number(body.test_id), + isSuccess, + query.id, + query.type + ); + } else if (body.type === 'finish') { + await this.service.updateResult( + Number(body.test_id), + Number(body.runTime), + Number(body.exitCode), + query.id + ); + } + } catch (error) { + return 'Error while processing the report'; + } + } +} diff --git a/libs/api-implementation/report/src/lib/services/report.service.ts b/libs/api-implementation/report/src/lib/services/report.service.ts new file mode 100644 index 0000000..1d80470 --- /dev/null +++ b/libs/api-implementation/report/src/lib/services/report.service.ts @@ -0,0 +1,125 @@ +import { Injectable } from '@nestjs/common'; +import { TestEntryModel } from '../../../../models/test-entries/test-entry.models'; +import { TestRunModel } from '../../../../models/test-run/test-run.models'; +import * as crypto from 'crypto'; + +@Injectable() +export class ReportService { + private sha256(data: string | Buffer | DataView) { + return crypto.createHash('sha256').update(data, 'utf8').digest('base64'); + } + + async fileIsCorrect(file: { buffer: Buffer }, test_id: string) { + try { + const testEntry = await TestEntryModel.findOne({ + _id: test_id, + }); + + const fileHash = this.sha256(file.buffer); + + for (const file of testEntry.correctFiles) { + if (fileHash === this.sha256(file.buffer.buffer)) { + return true; + } + } + + return false; + } catch (error) { + console.error('Error while comparing the hash of files'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + throw error; + } + } + + async createResult( + test_id: number, + isSuccess: boolean, + githubNumber: string, + type: string + ) { + try { + const currentTestRun = await this.getTestRun(githubNumber); + if (currentTestRun) { + await this.addToTestRun(currentTestRun, test_id, isSuccess); + } else { + await this.createTestRun(githubNumber, test_id, isSuccess, type); + } + } catch (error) { + console.error('Error while creating the rest run instance'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + throw error; + } + } + + async updateResult( + test_id: number, + runTime: number, + exitCode: number, + githubNumber: string + ) { + try { + const currentTestRun = await this.getTestRun(githubNumber); + const indexOfTest = currentTestRun.results.findIndex( + (result) => result.id === test_id + ); + + currentTestRun.results[indexOfTest].runTime = runTime; + currentTestRun.results[indexOfTest].exitCode = exitCode; + await this.updateTestRun(githubNumber, currentTestRun); + } catch (error) { + console.error('Error while updating the test run instance'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + throw error; + } + } + + private async updateTestRun(githubNumber, testRun) { + await TestRunModel.findOneAndUpdate( + { githubNumber: githubNumber }, + testRun, + { upsert: true } + ); + } + + private async addToTestRun(currentTestRun, test_id, isSuccess) { + currentTestRun.results.push({ + id: test_id, + success: isSuccess, + }); + await TestRunModel.findOneAndUpdate( + { + githubNumber: currentTestRun.githubNumber, + }, + { + results: currentTestRun.results, + } + ); + } + + private async createTestRun( + githubNumber: string, + test_id: number, + isSuccess: boolean, + type: string + ) { + await TestRunModel.create({ + githubNumber: githubNumber, + type: type, + results: [ + { + success: isSuccess, + id: test_id, + }, + ], + }); + } + + private async getTestRun(githubNumber) { + return await TestRunModel.findOne({ + githubNumber: githubNumber, + }); + } +} diff --git a/libs/api-implementation/report/tsconfig.json b/libs/api-implementation/report/tsconfig.json new file mode 100644 index 0000000..e65708f --- /dev/null +++ b/libs/api-implementation/report/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "types": ["node", "jest"], + "target": "es6" + }, + "include": ["**/*.ts"] +} diff --git a/libs/api-implementation/report/tsconfig.lib.json b/libs/api-implementation/report/tsconfig.lib.json new file mode 100644 index 0000000..9c463b5 --- /dev/null +++ b/libs/api-implementation/report/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "rootDir": "./src", + "types": ["node"] + }, + "exclude": ["**/*.spec.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/api-implementation/report/tsconfig.spec.json b/libs/api-implementation/report/tsconfig.spec.json new file mode 100644 index 0000000..1798b37 --- /dev/null +++ b/libs/api-implementation/report/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/api-implementation/report/tslint.json b/libs/api-implementation/report/tslint.json new file mode 100644 index 0000000..2cdd298 --- /dev/null +++ b/libs/api-implementation/report/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "../../../tslint.json", + "linterOptions": { "exclude": ["!**/*"] }, + "rules": {} +} diff --git a/libs/api-implementation/samples/src/lib/api-implementation-samples.module.ts b/libs/api-implementation/samples/src/lib/api-implementation-samples.module.ts index 6d1cc39..680bf0f 100644 --- a/libs/api-implementation/samples/src/lib/api-implementation-samples.module.ts +++ b/libs/api-implementation/samples/src/lib/api-implementation-samples.module.ts @@ -1,9 +1,11 @@ import { Module } from '@nestjs/common'; -import { SamplesController } from './samples.controller' +import { SamplesController } from './samples.controller'; import { SamplesService } from './services/samples.service'; +import { ApiImplementationDatabaseModule } from '@new-sample-platform/api-implementation/database'; @Module({ + imports: [ApiImplementationDatabaseModule], controllers: [SamplesController], providers: [SamplesService], exports: [], diff --git a/libs/api-implementation/samples/src/lib/samples.controller.ts b/libs/api-implementation/samples/src/lib/samples.controller.ts index 8f9c207..e98a0b2 100644 --- a/libs/api-implementation/samples/src/lib/samples.controller.ts +++ b/libs/api-implementation/samples/src/lib/samples.controller.ts @@ -3,6 +3,7 @@ import { Post, UseInterceptors, UploadedFile, + Get, } from '@nestjs/common'; import { FileInterceptor } from '@nestjs/platform-express'; import { SamplesService } from './services/samples.service'; @@ -17,8 +18,17 @@ export class SamplesController { try { this.service.writeToBucket(file); } catch (error) { - return 'Error while writing the file to the bucket' + return 'Error while writing the file to the bucket'; + } + return 200; + } + + @Get() + getAllSampleNames() { + try { + return this.service.getAllSampleNames(); + } catch (error) { + return 'Error while fetching sample names'; } - return 200 } } diff --git a/libs/api-implementation/samples/src/lib/services/samples.service.ts b/libs/api-implementation/samples/src/lib/services/samples.service.ts index 1007e69..6d0e326 100644 --- a/libs/api-implementation/samples/src/lib/services/samples.service.ts +++ b/libs/api-implementation/samples/src/lib/services/samples.service.ts @@ -1,6 +1,8 @@ import { Injectable } from '@nestjs/common'; import { writeFileSync } from 'fs'; import { AppConfig } from '../../../../../../config'; +import { SampleModel } from '../../../../models/samples/sample.models'; + @Injectable() export class SamplesService { async writeToBucket(file) { @@ -9,10 +11,29 @@ export class SamplesService { AppConfig.PATH_TO_MOUNTED_BUCKET + file.originalname, file.buffer ); + await this.addSampleToDB(file.originalname); } catch (error) { console.error(`Error occured while writing the file to the bucket`); + // tslint:disable-next-line: no-console console.debug(error.stack); throw error; } } + + async getAllSampleNames() { + try { + return await SampleModel.find({}); + } catch (error) { + console.error('Error occured while fetching the sample names'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + throw error; + } + } + + private async addSampleToDB(filename: string) { + await SampleModel.create({ + filename: filename, + }); + } } diff --git a/libs/api-implementation/test-entry/README.md b/libs/api-implementation/test-entry/README.md new file mode 100644 index 0000000..67a6a47 --- /dev/null +++ b/libs/api-implementation/test-entry/README.md @@ -0,0 +1,7 @@ +# api-implementation-test-entry + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `ng test api-implementation-test-entry` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/api-implementation/test-entry/jest.config.js b/libs/api-implementation/test-entry/jest.config.js new file mode 100644 index 0000000..dcf318c --- /dev/null +++ b/libs/api-implementation/test-entry/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'api-implementation-test-entry', + preset: '../../../jest.config.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], + coverageDirectory: '../../../coverage/libs/api-implementation/test-entry', +}; diff --git a/libs/api-implementation/test-entry/src/index.ts b/libs/api-implementation/test-entry/src/index.ts new file mode 100644 index 0000000..d57d3fe --- /dev/null +++ b/libs/api-implementation/test-entry/src/index.ts @@ -0,0 +1 @@ +export * from './lib/api-implementation-test-entry.module'; diff --git a/libs/api-implementation/test-entry/src/lib/api-implementation-test-entry.module.ts b/libs/api-implementation/test-entry/src/lib/api-implementation-test-entry.module.ts new file mode 100644 index 0000000..facb66f --- /dev/null +++ b/libs/api-implementation/test-entry/src/lib/api-implementation-test-entry.module.ts @@ -0,0 +1,13 @@ +import { Module } from '@nestjs/common'; +import { ApiImplementationDatabaseModule } from '@new-sample-platform/api-implementation/database'; +import { TestEntryController } from './test-entry.controller'; +import { TestEntryService } from './services/test-entry.service'; +import { ApiImplementationXmlModule } from '@new-sample-platform/api-implementation/xml'; + +@Module({ + imports: [ApiImplementationDatabaseModule, ApiImplementationXmlModule], + controllers: [TestEntryController], + providers: [TestEntryService], + exports: [], +}) +export class ApiImplementationTestEntryModule {} diff --git a/libs/api-implementation/test-entry/src/lib/dto/test-entry.dto.ts b/libs/api-implementation/test-entry/src/lib/dto/test-entry.dto.ts new file mode 100644 index 0000000..2fccadd --- /dev/null +++ b/libs/api-implementation/test-entry/src/lib/dto/test-entry.dto.ts @@ -0,0 +1,5 @@ +export class TestEntryDTO { + category: string; + command: string; + sample: string; +} diff --git a/libs/api-implementation/test-entry/src/lib/services/test-entry.service.ts b/libs/api-implementation/test-entry/src/lib/services/test-entry.service.ts new file mode 100644 index 0000000..d231ded --- /dev/null +++ b/libs/api-implementation/test-entry/src/lib/services/test-entry.service.ts @@ -0,0 +1,46 @@ +import { Injectable } from '@nestjs/common'; +import { TestEntryModel } from '../../../../models/test-entries/test-entry.models'; + +@Injectable() +export class TestEntryService { + + async getAll() { + try { + return await TestEntryModel.find({}); + } catch (error) { + console.error('Error while fetching the test entries'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + } + } + + async create( + category: string, + new_command: string, + sample: string, + files: any[] + ) { + const correctFiles = [] + + files.forEach(file => { + correctFiles.push({ + filename: file.originalname, + buffer: file.buffer + }) + }) + + try { + return await TestEntryModel.create({ + command: new_command, + category: category, + sample: sample, + correctFiles: correctFiles, + }); + } catch (error) { + console.error('Error while creating the test entry'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + throw error; + } + } +} diff --git a/libs/api-implementation/test-entry/src/lib/test-entry.controller.ts b/libs/api-implementation/test-entry/src/lib/test-entry.controller.ts new file mode 100644 index 0000000..ee91ac2 --- /dev/null +++ b/libs/api-implementation/test-entry/src/lib/test-entry.controller.ts @@ -0,0 +1,48 @@ +import { + Controller, + Post, + Body, + Get, + UseInterceptors, + UploadedFiles, +} from '@nestjs/common'; +import { TestEntryDTO } from './dto/test-entry.dto'; +import { TestEntryService } from './services/test-entry.service'; +import { AnyFilesInterceptor } from '@nestjs/platform-express'; +import { XmlGenerationService } from '@new-sample-platform/api-implementation/xml'; + +@Controller('test-entry') +export class TestEntryController { + constructor( + private service: TestEntryService, + private xmlService: XmlGenerationService + ) {} + + @UseInterceptors(AnyFilesInterceptor()) + @Post() + async createTestEntry( + @UploadedFiles() files, + @Body() testEntryDTO: TestEntryDTO + ) { + try { + await this.service.create( + testEntryDTO.category, + testEntryDTO.command, + testEntryDTO.sample, + files + ); + await this.xmlService.generateXML(); + } catch (error) { + return `Error creating the test entry`; + } + } + + @Get() + async getAllTestEntries() { + try { + return await this.service.getAll(); + } catch (error) { + return `Error while fetching the regression tests`; + } + } +} diff --git a/libs/api-implementation/test-entry/tsconfig.json b/libs/api-implementation/test-entry/tsconfig.json new file mode 100644 index 0000000..e65708f --- /dev/null +++ b/libs/api-implementation/test-entry/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "types": ["node", "jest"], + "target": "es6" + }, + "include": ["**/*.ts"] +} diff --git a/libs/api-implementation/test-entry/tsconfig.lib.json b/libs/api-implementation/test-entry/tsconfig.lib.json new file mode 100644 index 0000000..9c463b5 --- /dev/null +++ b/libs/api-implementation/test-entry/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "rootDir": "./src", + "types": ["node"] + }, + "exclude": ["**/*.spec.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/api-implementation/test-entry/tsconfig.spec.json b/libs/api-implementation/test-entry/tsconfig.spec.json new file mode 100644 index 0000000..1798b37 --- /dev/null +++ b/libs/api-implementation/test-entry/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/api-implementation/test-entry/tslint.json b/libs/api-implementation/test-entry/tslint.json new file mode 100644 index 0000000..2cdd298 --- /dev/null +++ b/libs/api-implementation/test-entry/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "../../../tslint.json", + "linterOptions": { "exclude": ["!**/*"] }, + "rules": {} +} diff --git a/libs/api-implementation/test-run/README.md b/libs/api-implementation/test-run/README.md new file mode 100644 index 0000000..3f48193 --- /dev/null +++ b/libs/api-implementation/test-run/README.md @@ -0,0 +1,7 @@ +# api-implementation-test-run + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `ng test api-implementation-test-run` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/api-implementation/test-run/jest.config.js b/libs/api-implementation/test-run/jest.config.js new file mode 100644 index 0000000..77222f7 --- /dev/null +++ b/libs/api-implementation/test-run/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'api-implementation-test-run', + preset: '../../../jest.config.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], + coverageDirectory: '../../../coverage/libs/api-implementation/test-run', +}; diff --git a/libs/api-implementation/test-run/src/index.ts b/libs/api-implementation/test-run/src/index.ts new file mode 100644 index 0000000..d000d5d --- /dev/null +++ b/libs/api-implementation/test-run/src/index.ts @@ -0,0 +1 @@ +export * from './lib/api-implementation-test-run.module'; diff --git a/libs/api-implementation/test-run/src/lib/api-implementation-test-run.module.ts b/libs/api-implementation/test-run/src/lib/api-implementation-test-run.module.ts new file mode 100644 index 0000000..6432d36 --- /dev/null +++ b/libs/api-implementation/test-run/src/lib/api-implementation-test-run.module.ts @@ -0,0 +1,12 @@ +import { Module } from '@nestjs/common'; +import { ApiImplementationDatabaseModule } from '@new-sample-platform/api-implementation/database'; +import { TestRunController } from './test-run.controller'; +import { TestRunService } from './services/test-run.service'; + +@Module({ + imports: [ApiImplementationDatabaseModule], + controllers: [TestRunController], + providers: [TestRunService], + exports: [], +}) +export class ApiImplementationTestRunModule {} diff --git a/libs/api-implementation/test-run/src/lib/services/test-run.service.ts b/libs/api-implementation/test-run/src/lib/services/test-run.service.ts new file mode 100644 index 0000000..5e1c656 --- /dev/null +++ b/libs/api-implementation/test-run/src/lib/services/test-run.service.ts @@ -0,0 +1,15 @@ +import { Injectable } from '@nestjs/common'; +import { TestRunModel } from '../../../../models/test-run/test-run.models'; + +@Injectable() +export class TestRunService { + async getAll() { + try { + return await TestRunModel.find({}); + } catch (error) { + console.error('Error while fetching the test entries'); + // tslint:disable-next-line: no-console + console.debug(error.stack); + } + } +} diff --git a/libs/api-implementation/test-run/src/lib/test-run.controller.ts b/libs/api-implementation/test-run/src/lib/test-run.controller.ts new file mode 100644 index 0000000..6003600 --- /dev/null +++ b/libs/api-implementation/test-run/src/lib/test-run.controller.ts @@ -0,0 +1,16 @@ +import { Controller, Get } from '@nestjs/common'; +import { TestRunService } from './services/test-run.service'; + +@Controller('test-run') +export class TestRunController { + constructor(private service: TestRunService) {} + + @Get() + async getAllTestRuns() { + try { + return await this.service.getAll(); + } catch (error) { + return `Error while fetching the regression tests`; + } + } +} diff --git a/libs/api-implementation/test-run/tsconfig.json b/libs/api-implementation/test-run/tsconfig.json new file mode 100644 index 0000000..e65708f --- /dev/null +++ b/libs/api-implementation/test-run/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "types": ["node", "jest"], + "target": "es6" + }, + "include": ["**/*.ts"] +} diff --git a/libs/api-implementation/test-run/tsconfig.lib.json b/libs/api-implementation/test-run/tsconfig.lib.json new file mode 100644 index 0000000..9c463b5 --- /dev/null +++ b/libs/api-implementation/test-run/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "../../../dist/out-tsc", + "declaration": true, + "rootDir": "./src", + "types": ["node"] + }, + "exclude": ["**/*.spec.ts"], + "include": ["**/*.ts"] +} diff --git a/libs/api-implementation/test-run/tsconfig.spec.json b/libs/api-implementation/test-run/tsconfig.spec.json new file mode 100644 index 0000000..1798b37 --- /dev/null +++ b/libs/api-implementation/test-run/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.spec.ts", + "**/*.spec.tsx", + "**/*.spec.js", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/api-implementation/test-run/tslint.json b/libs/api-implementation/test-run/tslint.json new file mode 100644 index 0000000..2cdd298 --- /dev/null +++ b/libs/api-implementation/test-run/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "../../../tslint.json", + "linterOptions": { "exclude": ["!**/*"] }, + "rules": {} +} diff --git a/libs/api-implementation/xml/src/index.ts b/libs/api-implementation/xml/src/index.ts index 2272a0e..ba1916c 100644 --- a/libs/api-implementation/xml/src/index.ts +++ b/libs/api-implementation/xml/src/index.ts @@ -1 +1,2 @@ export * from './lib/api-implementation-xml.module'; +export * from './lib/services/xml-generation.service' \ No newline at end of file diff --git a/libs/api-implementation/xml/src/lib/api-implementation-xml.module.ts b/libs/api-implementation/xml/src/lib/api-implementation-xml.module.ts index 5ccd23e..7c37d2b 100644 --- a/libs/api-implementation/xml/src/lib/api-implementation-xml.module.ts +++ b/libs/api-implementation/xml/src/lib/api-implementation-xml.module.ts @@ -1,8 +1,12 @@ import { Module } from '@nestjs/common'; +import { ApiImplementationDatabaseModule } from '@new-sample-platform/api-implementation/database'; +import { XMLController } from './xml.controller'; +import { XmlGenerationService } from './services/xml-generation.service'; @Module({ - controllers: [], - providers: [], - exports: [], + imports: [ApiImplementationDatabaseModule], + controllers: [XMLController], + providers: [XmlGenerationService], + exports: [XmlGenerationService], }) export class ApiImplementationXmlModule {} diff --git a/libs/api-implementation/xml/src/lib/services/xml-generation.service.ts b/libs/api-implementation/xml/src/lib/services/xml-generation.service.ts index e44352d..b2a7d61 100644 --- a/libs/api-implementation/xml/src/lib/services/xml-generation.service.ts +++ b/libs/api-implementation/xml/src/lib/services/xml-generation.service.ts @@ -1,10 +1,97 @@ -import { } from 'xmlbuilder' +import * as builder from 'xmlbuilder'; import { Injectable } from '@nestjs/common'; +import { writeFileSync } from 'fs'; + +import { TestEntryModel } from '../../../../models/test-entries/test-entry.models'; +import { AppConfig } from 'config'; +import * as xmlbuilder from 'xmlbuilder'; @Injectable() export class XmlGenerationService { - - constructor() { + private categories = [ + 'broken', + 'cea-708', + 'dvb', + 'dvd', + 'dvr-ms', + 'general', + 'hauppage', + 'mp4', + 'nocc', + 'options', + 'teletext', + 'wtv', + 'xds', + ]; + + constructor() {} + + async generateXML() { + let multitest: any = { + multitest: { + testfile: [], + }, + }; + await Promise.all( + this.categories.map(async (category) => { + const numOfEntries = await this.buildXML(category); + + if (numOfEntries > 0) { + multitest.multitest.testfile.push({ + location: category + '.xml', + }); + } + }) + ); + multitest = builder.create(multitest, { encoding: 'utf-8' }); + writeFileSync( + AppConfig.PATH_TO_MOUNTED_BUCKET + '/xml/tests.xml', + multitest.end({ pretty: true }) + ); } + private async buildXML(category: string) { + let xml: any = { + tests: { + entry: [], + }, + }; + let entries: any[]; + + entries = await TestEntryModel.find({ + category: category, + }); + + for (const entry of entries) { + xml.tests.entry.push({ + '@id': entry._id, + command: entry.command, + input: { + '@type': 'file', + '#text': entry.sample, + }, + output: 'file', + compare: { + file: { + '@ignore': 'false', + '@id': entry._id, + correct: 'wrong.txt', + expected: + entry.sample.split('.')[0] + + '.' + + entry.correctFiles[0].filename.split('.')[1], + }, + }, + }); + } + + xml = builder.create(xml, { encoding: 'utf-8' }); + + writeFileSync( + AppConfig.PATH_TO_MOUNTED_BUCKET + '/xml/' + category + '.xml', + xml.end({ pretty: true }) + ); + + return entries.length; + } } diff --git a/libs/api-implementation/xml/src/lib/xml.controller.ts b/libs/api-implementation/xml/src/lib/xml.controller.ts new file mode 100644 index 0000000..29446f1 --- /dev/null +++ b/libs/api-implementation/xml/src/lib/xml.controller.ts @@ -0,0 +1,19 @@ +import { + Controller, + Get, +} from '@nestjs/common'; +import { XmlGenerationService } from './services/xml-generation.service'; + +@Controller('xml') +export class XMLController { + constructor(private service: XmlGenerationService) {} + + @Get() + getAllSampleNames() { + try { + this.service.generateXML(); + } catch (error) { + return 'Error while fetching sample names'; + } + } +} diff --git a/libs/frontend/regression-test/src/lib/frontend-regression-test.module.spec.ts b/libs/frontend/regression-test/src/lib/frontend-regression-test.module.spec.ts deleted file mode 100644 index 92a1da6..0000000 --- a/libs/frontend/regression-test/src/lib/frontend-regression-test.module.spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { async, TestBed } from '@angular/core/testing'; -import { FrontendRegressionTestModule } from './frontend-regression-test.module'; - -describe('FrontendRegressionTestModule', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [FrontendRegressionTestModule], - }).compileComponents(); - })); - - it('should create', () => { - expect(FrontendRegressionTestModule).toBeDefined(); - }); -}); diff --git a/libs/frontend/regression-test/tsconfig.lib.json b/libs/frontend/regression-test/tsconfig.lib.json index f0e13d4..fed3242 100644 --- a/libs/frontend/regression-test/tsconfig.lib.json +++ b/libs/frontend/regression-test/tsconfig.lib.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../../dist/out-tsc", - "target": "es2015", + "target": "es6", "declaration": true, "inlineSources": true, "types": [], diff --git a/libs/frontend/samples/src/lib/containers/upload/upload.component.html b/libs/frontend/samples/src/lib/containers/upload/upload.component.html index 07898ba..69e46a0 100644 --- a/libs/frontend/samples/src/lib/containers/upload/upload.component.html +++ b/libs/frontend/samples/src/lib/containers/upload/upload.component.html @@ -1 +1,5 @@ - \ No newline at end of file +
+ + Please select samples and wait until the upload is complete + +
diff --git a/libs/frontend/samples/src/lib/containers/upload/upload.component.scss b/libs/frontend/samples/src/lib/containers/upload/upload.component.scss index e69de29..62a0dc4 100644 --- a/libs/frontend/samples/src/lib/containers/upload/upload.component.scss +++ b/libs/frontend/samples/src/lib/containers/upload/upload.component.scss @@ -0,0 +1,6 @@ +.main-div{ + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + } \ No newline at end of file diff --git a/libs/frontend/samples/src/lib/frontend-samples.module.ts b/libs/frontend/samples/src/lib/frontend-samples.module.ts index f7931b1..5315291 100644 --- a/libs/frontend/samples/src/lib/frontend-samples.module.ts +++ b/libs/frontend/samples/src/lib/frontend-samples.module.ts @@ -9,10 +9,12 @@ import { MatListModule } from '@angular/material/list'; import { FlexLayoutModule } from '@angular/flex-layout'; import { DialogComponent } from './components/dialog/dialog.component'; import { UploadService } from './services/upload.service'; +import { MatCardModule } from '@angular/material/card'; @NgModule({ imports: [ CommonModule, + MatCardModule, RoutingModule, MatButtonModule, MatDialogModule, @@ -21,6 +23,6 @@ import { UploadService } from './services/upload.service'; MatProgressBarModule, ], declarations: [UploadComponent, DialogComponent], - providers: [UploadService] + providers: [UploadService], }) export class FrontendSamplesModule {} diff --git a/libs/frontend/samples/tsconfig.lib.json b/libs/frontend/samples/tsconfig.lib.json index f0e13d4..fed3242 100644 --- a/libs/frontend/samples/tsconfig.lib.json +++ b/libs/frontend/samples/tsconfig.lib.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../../dist/out-tsc", - "target": "es2015", + "target": "es6", "declaration": true, "inlineSources": true, "types": [], diff --git a/libs/frontend/test-entry/README.md b/libs/frontend/test-entry/README.md new file mode 100644 index 0000000..dcfedca --- /dev/null +++ b/libs/frontend/test-entry/README.md @@ -0,0 +1,7 @@ +# frontend-test-entry + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test frontend-test-entry` to execute the unit tests. diff --git a/libs/frontend/test-entry/jest.config.js b/libs/frontend/test-entry/jest.config.js new file mode 100644 index 0000000..7097fdb --- /dev/null +++ b/libs/frontend/test-entry/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'frontend-test-entry', + preset: '../../../jest.config.js', + coverageDirectory: '../../../coverage/libs/frontend/test-entry', + snapshotSerializers: [ + 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', + 'jest-preset-angular/build/AngularSnapshotSerializer.js', + 'jest-preset-angular/build/HTMLCommentSerializer.js', + ], +}; diff --git a/libs/frontend/test-entry/src/index.ts b/libs/frontend/test-entry/src/index.ts new file mode 100644 index 0000000..68ace84 --- /dev/null +++ b/libs/frontend/test-entry/src/index.ts @@ -0,0 +1 @@ +export * from './lib/frontend-test-entry.module'; diff --git a/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.html b/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.html new file mode 100644 index 0000000..19f8881 --- /dev/null +++ b/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.html @@ -0,0 +1,69 @@ +

Create Test Entry

+ +
+
+ + +
+
Command is required.
+
+ Command should be 3 character. +
+
+
+ + + +
+ + Category + + + {{category.viewValue}} + + + + +
+ +
+ + + + + + {{option}} + + + +
+
+
Sample is required.
+
+
+
{{f.name}}
+ + + +
+ + +
\ No newline at end of file diff --git a/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.scss b/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.scss new file mode 100644 index 0000000..dc3cd90 --- /dev/null +++ b/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.scss @@ -0,0 +1,10 @@ +.mat-success { + background-color: green; + color: #fff; +} + + +.category { + background-color: black; + border-radius: 10px; +} diff --git a/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.ts b/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.ts new file mode 100644 index 0000000..e02baeb --- /dev/null +++ b/libs/frontend/test-entry/src/lib/components/create-test-entry/create-test-entry.component.ts @@ -0,0 +1,105 @@ +import { Component, OnInit } from '@angular/core'; +import { FormGroup, FormControl, Validators } from '@angular/forms'; +import { UploadService } from '../../services/upload.service'; +import { Observable } from 'rxjs'; +import { map, startWith } from 'rxjs/operators'; + +@Component({ + selector: 'frontend-create-test-entry', + templateUrl: './create-test-entry.component.html', + styleUrls: ['./create-test-entry.component.scss'], +}) +export class CreateTestEntryComponent implements OnInit { + myForm = new FormGroup({ + command: new FormControl('', [ + Validators.required, + Validators.minLength(3), + ]), + category: new FormControl('', [Validators.required]), + sample: new FormControl('', [Validators.required]), + }); + + public selectedValue: string; + //TODO: it should not be hardcoded! + public categories = [ + { value: 'broken', viewValue: 'Broken' }, + { value: 'cea-708', viewValue: 'CEA-708' }, + { value: 'dvb', viewValue: 'DVB' }, + { value: 'dvd', viewValue: 'DVR-MS' }, + { value: 'general', viewValue: 'General' }, + { value: 'hauppage', viewValue: 'Hauppage' }, + { value: 'mp4', viewValue: 'MP4' }, + { value: 'nocc', viewValue: 'NoCC' }, + { value: 'options', viewValue: 'Options' }, + { value: 'teletext', viewValue: 'Teletext' }, + { value: 'wtv', viewValue: 'WTV' }, + { value: 'xds', viewValue: 'XDS' }, + ]; + + public options: string[] = []; + public filteredOptions: Observable; + + public selectedFiles: File[] = []; + private formD: FormData; + + constructor(private service: UploadService) {} + + ngOnInit() { + this.service.getSamples().subscribe((samples: any[]) => { + this.options = samples.map((sample) => sample.filename); + this.filteredOptions = this.myForm.valueChanges.pipe( + startWith(''), + map((value) => { + return this._filter(value); + }) + ); + }); + + + } + + private _filter(value: unknown): string[] { + const filterValue = (value as string).toLowerCase(); + + return this.options.filter( + (option) => option.toLowerCase().indexOf(filterValue) === 0 + ); + } + + openInput() { + document.getElementById('uploadFile').click(); + } + + fileAdded(event) { + if (event.target.files.length) { + for (let i = 0; i < event.target.files.length; i++) { + this.selectedFiles.push(event.target.files[i]); + } + } + } + + private upload() { + this.formD = new FormData(); + this.formD.append('command', this.myForm.value.command); + this.formD.append('sample', this.myForm.value.sample); + this.formD.append('category', this.selectedValue); + + if (this.selectedFiles.length) { + for (let i = 0; i < this.selectedFiles.length; i++) + this.formD.append( + 'files[]', + this.selectedFiles[i], + this.selectedFiles[i].name + ); + } + } + + get f() { + return this.myForm.controls; + } + + submitToService() { + this.upload(); + this.service.upload(this.formD); + } +} diff --git a/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.html b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.html new file mode 100644 index 0000000..264ceca --- /dev/null +++ b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.html @@ -0,0 +1,4 @@ + + diff --git a/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.scss b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.scss new file mode 100644 index 0000000..4f33869 --- /dev/null +++ b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.scss @@ -0,0 +1,5 @@ +mat-card { + width: 50%; + margin-left: auto; + margin-right: auto; +} \ No newline at end of file diff --git a/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.spec.ts b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.spec.ts new file mode 100644 index 0000000..9549e1a --- /dev/null +++ b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UploadPageComponent } from './upload-page.component'; + +describe('UploadPageComponent', () => { + let component: UploadPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UploadPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UploadPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.ts b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.ts new file mode 100644 index 0000000..5cbc5ed --- /dev/null +++ b/libs/frontend/test-entry/src/lib/containers/upload-page/upload-page.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'frontend-upload-page', + templateUrl: './upload-page.component.html', + styleUrls: ['./upload-page.component.scss'] +}) +export class UploadPageComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/libs/frontend/test-entry/src/lib/frontend-test-entry.module.ts b/libs/frontend/test-entry/src/lib/frontend-test-entry.module.ts new file mode 100644 index 0000000..83ce0c7 --- /dev/null +++ b/libs/frontend/test-entry/src/lib/frontend-test-entry.module.ts @@ -0,0 +1,37 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { UploadPageComponent } from './containers/upload-page/upload-page.component'; +import { CreateTestEntryComponent } from './components/create-test-entry/create-test-entry.component'; +import { HttpClientModule } from '@angular/common/http'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { RoutingModule } from './routing.module'; +import { UploadService } from './services/upload.service'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon' +import { MaterialFileInputModule } from 'ngx-material-file-input'; +import { MatSelectModule } from '@angular/material/select' +import { MatAutocompleteModule } from '@angular/material/autocomplete' + +import { MatCardModule } from '@angular/material/card' + +@NgModule({ + imports: [ + MatCardModule, + MatAutocompleteModule, + MatSelectModule, + MatIconModule, + MaterialFileInputModule, + MatFormFieldModule, + MatButtonModule, + RoutingModule, + CommonModule, + HttpClientModule, + FormsModule, + ReactiveFormsModule, + ], + declarations: [UploadPageComponent, CreateTestEntryComponent], + + providers: [UploadService], +}) +export class FrontendTestEntryModule {} diff --git a/libs/frontend/test-entry/src/lib/routing.module.ts b/libs/frontend/test-entry/src/lib/routing.module.ts new file mode 100644 index 0000000..2809712 --- /dev/null +++ b/libs/frontend/test-entry/src/lib/routing.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { CreateTestEntryComponent } from './components/create-test-entry/create-test-entry.component'; +import { UploadService } from './services/upload.service'; +import { UploadPageComponent } from './containers/upload-page/upload-page.component'; + +const routes: Routes = [ + { path: 'create', component: UploadPageComponent }, +]; +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] + +}) +export class RoutingModule {} diff --git a/libs/frontend/test-entry/src/lib/services/upload.service.ts b/libs/frontend/test-entry/src/lib/services/upload.service.ts new file mode 100644 index 0000000..36d7e02 --- /dev/null +++ b/libs/frontend/test-entry/src/lib/services/upload.service.ts @@ -0,0 +1,15 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Injectable({ providedIn: 'root' }) +export class UploadService { + constructor(private http: HttpClient) {} + + public upload(form: FormData) { + this.http.post('api/test-entry', form).subscribe(); + } + + public getSamples() { + return this.http.get('api/samples'); + } +} diff --git a/libs/frontend/test-entry/src/test-setup.ts b/libs/frontend/test-entry/src/test-setup.ts new file mode 100644 index 0000000..8d88704 --- /dev/null +++ b/libs/frontend/test-entry/src/test-setup.ts @@ -0,0 +1 @@ +import 'jest-preset-angular'; diff --git a/libs/frontend/test-entry/tsconfig.json b/libs/frontend/test-entry/tsconfig.json new file mode 100644 index 0000000..08c7db8 --- /dev/null +++ b/libs/frontend/test-entry/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "types": ["node", "jest"] + }, + "include": ["**/*.ts"] +} diff --git a/libs/frontend/test-entry/tsconfig.lib.json b/libs/frontend/test-entry/tsconfig.lib.json new file mode 100644 index 0000000..fed3242 --- /dev/null +++ b/libs/frontend/test-entry/tsconfig.lib.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "target": "es6", + "declaration": true, + "inlineSources": true, + "types": [], + "lib": ["dom", "es2018"] + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "enableResourceInlining": true + }, + "exclude": ["src/test-setup.ts", "**/*.spec.ts"] +} diff --git a/libs/frontend/test-entry/tsconfig.spec.json b/libs/frontend/test-entry/tsconfig.spec.json new file mode 100644 index 0000000..fd405a6 --- /dev/null +++ b/libs/frontend/test-entry/tsconfig.spec.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/libs/frontend/test-entry/tslint.json b/libs/frontend/test-entry/tslint.json new file mode 100644 index 0000000..b205ad0 --- /dev/null +++ b/libs/frontend/test-entry/tslint.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tslint.json", + "rules": { + "directive-selector": [true, "attribute", "frontend", "camelCase"], + "component-selector": [true, "element", "frontend", "kebab-case"] + }, + "linterOptions": { + "exclude": ["!**/*"] + } +} diff --git a/libs/frontend/test-runs/README.md b/libs/frontend/test-runs/README.md new file mode 100644 index 0000000..a4f7002 --- /dev/null +++ b/libs/frontend/test-runs/README.md @@ -0,0 +1,7 @@ +# frontend-test-runs + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test frontend-test-runs` to execute the unit tests. diff --git a/libs/frontend/test-runs/jest.config.js b/libs/frontend/test-runs/jest.config.js new file mode 100644 index 0000000..d0e98a8 --- /dev/null +++ b/libs/frontend/test-runs/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + name: 'frontend-test-runs', + preset: '../../../jest.config.js', + coverageDirectory: '../../../coverage/libs/frontend/test-runs', + snapshotSerializers: [ + 'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js', + 'jest-preset-angular/build/AngularSnapshotSerializer.js', + 'jest-preset-angular/build/HTMLCommentSerializer.js', + ], +}; diff --git a/libs/frontend/test-runs/src/index.ts b/libs/frontend/test-runs/src/index.ts new file mode 100644 index 0000000..dedf69b --- /dev/null +++ b/libs/frontend/test-runs/src/index.ts @@ -0,0 +1 @@ +export * from './lib/frontend-test-runs.module'; diff --git a/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.html b/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.html new file mode 100644 index 0000000..8a5a731 --- /dev/null +++ b/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.html @@ -0,0 +1,44 @@ + + + + PR/Commit + {{ element.type }} + + + + + Success + {{ element.success }} + + + + + + Date of Entry + + + + {{ element.dateOfEntry }} + + + + + + Number of used tests + + {{ element.results.length }} + + + + + + diff --git a/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.scss b/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.scss new file mode 100644 index 0000000..c9c1d67 --- /dev/null +++ b/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.scss @@ -0,0 +1,4 @@ +mat-table { + width: 100%; + align-content: center; +} \ No newline at end of file diff --git a/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.ts b/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.ts new file mode 100644 index 0000000..2c036d6 --- /dev/null +++ b/libs/frontend/test-runs/src/lib/containers/list-test-runs/list-test-runs.component.ts @@ -0,0 +1,28 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; + +@Component({ + selector: 'frontend-list-test-runs', + templateUrl: './list-test-runs.component.html', + styleUrls: ['./list-test-runs.component.scss'], +}) +export class ListTestRunsComponent implements OnInit { + displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; + dataSource = []; + + constructor(private http: HttpClient) { + this.getData().subscribe((data: any) => { + data = data.map((entry) => { + entry.success = entry.results.every((obj) => obj.success); + return entry; + }); + this.dataSource = data; + }); + } + + ngOnInit(): void {} + + getData() { + return this.http.get('/api/test-run'); + } +} diff --git a/libs/frontend/test-runs/src/lib/frontend-test-runs.module.ts b/libs/frontend/test-runs/src/lib/frontend-test-runs.module.ts new file mode 100644 index 0000000..562ca9f --- /dev/null +++ b/libs/frontend/test-runs/src/lib/frontend-test-runs.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ListTestRunsComponent } from './containers/list-test-runs/list-test-runs.component'; +import { RoutingModule } from './routing.module'; +import { MatTableModule } from '@angular/material/table'; +import { MatInputModule } from '@angular/material/input'; +import { MatIconModule } from '@angular/material/icon'; +import { MatButtonModule } from '@angular/material/button'; +import { FormsModule } from '@angular/forms'; +import { ReactiveFormsModule } from '@angular/forms'; + +@NgModule({ + imports: [ + CommonModule, + RoutingModule, + MatTableModule, + MatInputModule, + MatIconModule, + MatButtonModule, + FormsModule, + ReactiveFormsModule, + ], + declarations: [ListTestRunsComponent], +}) +export class FrontendTestRunsModule {} diff --git a/libs/frontend/test-runs/src/lib/routing.module.ts b/libs/frontend/test-runs/src/lib/routing.module.ts new file mode 100644 index 0000000..69886f0 --- /dev/null +++ b/libs/frontend/test-runs/src/lib/routing.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { ListTestRunsComponent } from './containers/list-test-runs/list-test-runs.component'; + +const routes: Routes = [{ path: 'list', component: ListTestRunsComponent }]; +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class RoutingModule {} diff --git a/libs/frontend/test-runs/src/test-setup.ts b/libs/frontend/test-runs/src/test-setup.ts new file mode 100644 index 0000000..8d88704 --- /dev/null +++ b/libs/frontend/test-runs/src/test-setup.ts @@ -0,0 +1 @@ +import 'jest-preset-angular'; diff --git a/libs/frontend/test-runs/tsconfig.json b/libs/frontend/test-runs/tsconfig.json new file mode 100644 index 0000000..08c7db8 --- /dev/null +++ b/libs/frontend/test-runs/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "types": ["node", "jest"] + }, + "include": ["**/*.ts"] +} diff --git a/libs/frontend/test-runs/tsconfig.lib.json b/libs/frontend/test-runs/tsconfig.lib.json new file mode 100644 index 0000000..f0e13d4 --- /dev/null +++ b/libs/frontend/test-runs/tsconfig.lib.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "target": "es2015", + "declaration": true, + "inlineSources": true, + "types": [], + "lib": ["dom", "es2018"] + }, + "angularCompilerOptions": { + "skipTemplateCodegen": true, + "strictMetadataEmit": true, + "enableResourceInlining": true + }, + "exclude": ["src/test-setup.ts", "**/*.spec.ts"] +} diff --git a/libs/frontend/test-runs/tsconfig.spec.json b/libs/frontend/test-runs/tsconfig.spec.json new file mode 100644 index 0000000..fd405a6 --- /dev/null +++ b/libs/frontend/test-runs/tsconfig.spec.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/libs/frontend/test-runs/tslint.json b/libs/frontend/test-runs/tslint.json new file mode 100644 index 0000000..b205ad0 --- /dev/null +++ b/libs/frontend/test-runs/tslint.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tslint.json", + "rules": { + "directive-selector": [true, "attribute", "frontend", "camelCase"], + "component-selector": [true, "element", "frontend", "kebab-case"] + }, + "linterOptions": { + "exclude": ["!**/*"] + } +} diff --git a/libs/testing/tsconfig.lib.json b/libs/testing/tsconfig.lib.json index 0bb76e3..9b7ad62 100644 --- a/libs/testing/tsconfig.lib.json +++ b/libs/testing/tsconfig.lib.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../dist/out-tsc", - "target": "es2015", + "target": "es6", "declaration": true, "inlineSources": true, "types": [], diff --git a/nx.json b/nx.json index 63a5b94..deb650b 100644 --- a/nx.json +++ b/nx.json @@ -67,6 +67,21 @@ }, "frontend-samples": { "tags": [] + }, + "api-implementation-report": { + "tags": [] + }, + "api-implementation-test-entry": { + "tags": [] + }, + "frontend-test-entry": { + "tags": [] + }, + "api-implementation-test-run": { + "tags": [] + }, + "frontend-test-runs": { + "tags": [] } } } diff --git a/package-lock.json b/package-lock.json index 44780d8..5d908dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2509,6 +2509,11 @@ } } }, + "@fortawesome/fontawesome-free": { + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.14.0.tgz", + "integrity": "sha512-OfdMsF+ZQgdKHP9jUbmDcRrP0eX90XXrsXIdyjLbkmSBzmMXPABB8eobUJtivaupucYaByz6WNe1PI1JuYm3qA==" + }, "@google-cloud/common": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-2.4.0.tgz", @@ -4243,11 +4248,25 @@ "integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w==", "dev": true }, + "@types/chart.js": { + "version": "2.9.24", + "resolved": "https://registry.npmjs.org/@types/chart.js/-/chart.js-2.9.24.tgz", + "integrity": "sha512-AQI7X+ow3SaONl44JrHoL/5B+lCsJyG31UHZ5RP98Uh15hI/zjEkDsAb4EIm4P9TGfNhZLXw/nMc5w0u10+/fQ==", + "requires": { + "moment": "^2.10.2" + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" }, + "@types/core-js": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/@types/core-js/-/core-js-2.5.3.tgz", + "integrity": "sha512-F9RHpjuPSit4dCCRXgi7XcqA01DAjy9QY+v9yICoxXsjXD9cgQpyZyL2eSZnTkBGXGaQnea8waZOZTogLDB+rA==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -4426,6 +4445,11 @@ "integrity": "sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A==", "dev": true }, + "@types/validator": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.0.0.tgz", + "integrity": "sha512-WAy5txG7aFX8Vw3sloEKp5p/t/Xt8jD3GRD9DacnFv6Vo8ubudAsRTXgxpQwU0mpzY/H8U4db3roDuCMjShBmw==" + }, "@types/webpack-sources": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.8.tgz", @@ -4762,6 +4786,16 @@ "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", "dev": true }, + "angular-bootstrap-md": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/angular-bootstrap-md/-/angular-bootstrap-md-9.3.1.tgz", + "integrity": "sha512-wQ7BzIce8HLs5tMjUXliHA+ePZFshs+5My/dYZ3imbKMKVbn6OMjEUNGc1q7iInHq+Rr5RHSz7ev8+J+NU/GYw==" + }, + "animate.css": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/animate.css/-/animate.css-4.1.0.tgz", + "integrity": "sha512-0aVcfWDeU9ykV6vjn1P67ZSs01jxoUQZCGaYbkk0SIIelIG8kUdLrIkua1+VabHfTtsSivDRMMn0ILPvZum2gw==" + }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -4998,7 +5032,6 @@ "version": "2.6.3", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", - "dev": true, "requires": { "lodash": "^4.17.14" } @@ -5889,6 +5922,47 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, + "chart.js": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.5.0.tgz", + "integrity": "sha1-/m51Gok3afVucr7lrZEgfhxZKVc=", + "requires": { + "chartjs-color": "^2.0.0", + "moment": "^2.10.6" + } + }, + "chartjs-color": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz", + "integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==", + "requires": { + "chartjs-color-string": "^0.6.0", + "color-convert": "^1.9.3" + }, + "dependencies": { + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + } + } + }, + "chartjs-color-string": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz", + "integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==", + "requires": { + "color-name": "^1.0.0" + } + }, "check-more-types": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", @@ -5968,6 +6042,17 @@ } } }, + "class-validator": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.12.2.tgz", + "integrity": "sha512-TDzPzp8BmpsbPhQpccB3jMUE/3pK0TyqamrK0kcx+ZeFytMA+O6q87JZZGObHHnoo9GM8vl/JppIyKWeEA/EVw==", + "requires": { + "@types/validator": "13.0.0", + "google-libphonenumber": "^3.2.8", + "tslib": ">=1.9.0", + "validator": "13.0.0" + } + }, "clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -6465,6 +6550,18 @@ "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", "dev": true }, + "connect-multiparty": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/connect-multiparty/-/connect-multiparty-2.2.0.tgz", + "integrity": "sha512-zKcpA7cuXGEhuw9Pz7JmVCFmp85jzGLGm/iiagXTwyEAJp4ypLPtRS/V4IGuGb9KjjrgHBs6P/gDCpZHnFzksA==", + "requires": { + "http-errors": "~1.7.0", + "multiparty": "~4.2.1", + "on-finished": "~2.3.0", + "qs": "~6.5.2", + "type-is": "~1.6.16" + } + }, "consola": { "version": "2.12.2", "resolved": "https://registry.npmjs.org/consola/-/consola-2.12.2.tgz", @@ -8359,6 +8456,32 @@ } } }, + "express-fileupload": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/express-fileupload/-/express-fileupload-1.2.0.tgz", + "integrity": "sha512-oe4WpKcSppXnl5peornawWUa6tKmIc1/kJxMNRGJR1A0v4zyLL6VsFR6wZ8P2a4Iq3aGx8xae3Vlr+MOMQhFPw==", + "requires": { + "busboy": "^0.3.1" + }, + "dependencies": { + "busboy": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz", + "integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==", + "requires": { + "dicer": "0.3.0" + } + }, + "dicer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz", + "integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==", + "requires": { + "streamsearch": "0.1.2" + } + } + } + }, "ext": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", @@ -9069,6 +9192,11 @@ } } }, + "google-libphonenumber": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/google-libphonenumber/-/google-libphonenumber-3.2.12.tgz", + "integrity": "sha512-vuDYnYNlCDQpIo5j7QDJTz2FNVAAuJZtbQ/khZgT6UBuRJV5GVQIQbOAdjTgu2uH4OFVChKAHQl8a2rgMnezOQ==" + }, "google-p12-pem": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-2.0.4.tgz", @@ -9107,6 +9235,11 @@ } } }, + "hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=" + }, "handle-thing": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", @@ -12417,8 +12550,7 @@ "moment": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==", - "dev": true + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" }, "mongodb": { "version": "3.5.8", @@ -12476,6 +12608,15 @@ "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" }, + "mongoose-sequence": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/mongoose-sequence/-/mongoose-sequence-5.2.2.tgz", + "integrity": "sha512-gtN33C4fXVgOH8SSQvwSf8+DcFtxw1n/Wk1RHEs+W3A/cqYgLjvjMalq/0q/TDboeapNi6RBymBnyw3fDoaDlg==", + "requires": { + "async": "^2.5.0", + "lodash": "^4.17.11" + } + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -12591,6 +12732,40 @@ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "dev": true }, + "multiparty": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz", + "integrity": "sha512-NtZLjlvsjcoGrzojtwQwn/Tm90aWJ6XXtPppYF4WmOk/6ncdwMMKggFY2NlRRN9yiCEIVxpOfPWahVEG2HAG8Q==", + "requires": { + "http-errors": "~1.8.0", + "safe-buffer": "5.2.1", + "uid-safe": "2.1.5" + }, + "dependencies": { + "http-errors": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.0.tgz", + "integrity": "sha512-4I8r0C5JDhT5VkvI47QktDW75rNlGVsUf/8hzjCC/wkWI/jdTRmBb9aI7erSG82r1bjKY3F6k28WnsVxB1C73A==", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.0" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + } + } + }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -12636,6 +12811,11 @@ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, + "ngx-material-file-input": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ngx-material-file-input/-/ngx-material-file-input-2.1.1.tgz", + "integrity": "sha512-FbaIjiJnL6BZtZYWLvMSn9aSaM62AZaJegloTUphmLz5jopXPzE5W+3aC+dsf9h1IIqHSCLcyv0w+qH0ypBhMA==" + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -14501,6 +14681,11 @@ "integrity": "sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==", "dev": true }, + "random-bytes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz", + "integrity": "sha1-T2ih3Arli9P7lYSMMDJNt11kNgs=" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -17171,6 +17356,14 @@ "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", "dev": true }, + "uid-safe": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", + "integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==", + "requires": { + "random-bytes": "~1.0.0" + } + }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", @@ -17481,6 +17674,11 @@ "builtins": "^1.0.3" } }, + "validator": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.0.0.tgz", + "integrity": "sha512-anYx5fURbgF04lQV18nEQWZ/3wHGnxiKdG4aL8J+jEDsm98n/sU/bey+tYk6tnGJzm7ioh5FoqrAiQ6m03IgaA==" + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/package.json b/package.json index a2b2332..250dd22 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@angular/platform-browser-dynamic": "^9.1.0", "@angular/router": "^9.1.0", "@commitlint/config-conventional": "^8.3.4", + "@fortawesome/fontawesome-free": "^5.14.0", "@google-cloud/compute": "^1.2.0", "@nestjs/common": "^6.8.3", "@nestjs/core": "^6.8.3", @@ -49,12 +50,24 @@ "@ng-bootstrap/ng-bootstrap": "^6.2.0", "@nrwl/angular": "9.3.0", "@octokit/auth-app": "^2.4.7", + "@types/chart.js": "^2.9.24", + "angular-bootstrap-md": "^9.3.1", + "animate.css": "^4.1.0", "bootstrap": "^4.4.0", + "chart.js": "^2.5.0", + "class-validator": "^0.12.2", + "connect-multiparty": "^2.2.0", "core-js": "^2.5.4", + "crypto": "^1.0.1", "doasync": "^2.0.1", + "express-fileupload": "^1.2.0", "formidable": "^1.2.2", + "hammerjs": "^2.0.8", + "hash-files": "^1.1.1", "mongodb": "^3.5.8", "mongoose": "^5.9.26", + "mongoose-sequence": "^5.2.2", + "ngx-material-file-input": "^2.1.1", "reflect-metadata": "^0.1.13", "request": "^2.88.2", "request-promise": "^4.2.5", @@ -74,6 +87,7 @@ "@nrwl/nest": "9.3.0", "@nrwl/node": "9.3.0", "@nrwl/workspace": "9.3.0", + "@types/core-js": "^2.5.3", "@types/jest": "25.1.4", "@types/node": "~8.9.4", "@types/request-promise": "^4.1.46", diff --git a/script.sh b/script.sh index 08f73fe..d88942f 100755 --- a/script.sh +++ b/script.sh @@ -68,5 +68,6 @@ mkdir results mkdir report cd /root/tester -sudo /root/tester/ccextractortester --entries "/root/bucket/tests.xml" --executable "/root/ccextractor" --tempfolder "/root/tmpFiles" --timeout 3000 --resultfolder "/root/results" --samplefolder "/root/bucket/samples" --reportfolder "/root/report" +sudo /root/tester/ccextractortester --method Server --entries "/root/bucket/tests.xml" --executable "/root/ccextractor" --tempfolder "/root/tmpFiles" --timeout 3000 --resultfolder "/root/results" --samplefolder "/root/bucket/samples" --reportfolder "/root/report" -u "EXTERNAL_IP/api/report?type=GITHUB_EVENT&id=EVENT_IDENTIFICATOR" + diff --git a/tools/tsconfig.tools.json b/tools/tsconfig.tools.json index 82bd1f0..4a53476 100644 --- a/tools/tsconfig.tools.json +++ b/tools/tsconfig.tools.json @@ -4,7 +4,7 @@ "outDir": "../dist/out-tsc/tools", "rootDir": ".", "module": "commonjs", - "target": "es5", + "target": "es6", "types": ["node"] }, "include": ["**/*.ts"] diff --git a/tsconfig.json b/tsconfig.json index 36428ce..04332e9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,7 +8,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "importHelpers": true, - "target": "es2015", + "target": "es6", "module": "esnext", "typeRoots": ["node_modules/@types"], "lib": ["es2017", "dom"], @@ -43,6 +43,21 @@ ], "@new-sample-platform/frontend/samples": [ "libs/frontend/samples/src/index.ts" + ], + "@new-sample-platform/api-implementation/report": [ + "libs/api-implementation/report/src/index.ts" + ], + "@new-sample-platform/api-implementation/test-entry": [ + "libs/api-implementation/test-entry/src/index.ts" + ], + "@new-sample-platform/frontend/test-entry": [ + "libs/frontend/test-entry/src/index.ts" + ], + "@new-sample-platform/api-implementation/test-run": [ + "libs/api-implementation/test-run/src/index.ts" + ], + "@new-sample-platform/frontend/test-runs": [ + "libs/frontend/test-runs/src/index.ts" ] } }, diff --git a/typings.json b/typings.json new file mode 100644 index 0000000..58a647e --- /dev/null +++ b/typings.json @@ -0,0 +1,6 @@ +{ + "globalDependencies": { + "es6-collections": "registry:dt/es6-collections#0.5.1+20160510002910", + "es6-promise": "registry:dt/es6-promise#0.0.0+20160726191732" + } +}