diff --git a/.gitignore b/.gitignore
index 9d3beff084b0bd83f5c95826cc5abfef00dfabc0..9d884336a8f643ae507723e0071462be1e939992 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
# dependencies
/node_modules
+node_modules/
# profiling files
chrome-profiler-events*.json
@@ -25,6 +26,7 @@ speed-measure-plugin*.json
# IDE - VSCode
.vscode/*
+.vs/
!.vscode/tasks.json
!.vscode/launch.json
diff --git a/appsrc/src/app/core/models/artifact.ts b/appsrc/src/app/core/models/artifact.ts
index 3b936e350161e6f6189c52a22ba2fcdaadc0f058..cca7a899de93131a8841c9c3e64746a83d8ea355 100644
--- a/appsrc/src/app/core/models/artifact.ts
+++ b/appsrc/src/app/core/models/artifact.ts
@@ -1,4 +1,4 @@
-export type ArtifactType = 'Diagram' | 'Code' | 'Doc' | 'Annotation' | 'Log' | 'Comment';
+export type ArtifactType = 'Diagram' | 'Code' | 'Doc' | 'Annotation' | 'Log' | 'Comment' | 'TESTAR_State_Model';
export type StatusType = 'Status1' | 'Status2' | 'Status3';
// TODO: Artifact object is been deprecated and will be removed by the end of the integration
diff --git a/appsrc/src/app/plugins/plugins.config.ts b/appsrc/src/app/plugins/plugins.config.ts
index ce71455dc5ee4409190153062a09b36b0d577e2e..c8d79736032547ea58c228bf14b5f4336e4bdbb7 100644
--- a/appsrc/src/app/plugins/plugins.config.ts
+++ b/appsrc/src/app/plugins/plugins.config.ts
@@ -65,5 +65,10 @@ export const rendererPlugins: any = {
componentName: 'AnnotationRendererComponent',
importFunction: () =>
import('./renderers/annotation-renderer/annotation-renderer.component')
+ },
+ web_testar_statemodel: {
+ componentName: 'StateModelVisualizerComponent',
+ importFunction: () =>
+ import('src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component')
}
};
diff --git a/appsrc/src/app/plugins/project/components/artifact-visualizer/artifact-visualizer.component.ts b/appsrc/src/app/plugins/project/components/artifact-visualizer/artifact-visualizer.component.ts
index c50ba95d23bb2025f00affbb178d8cbc16c3ca95..a1bc3a3cc4a84ee7ec3675f9222e1baa0e9bb26b 100644
--- a/appsrc/src/app/plugins/project/components/artifact-visualizer/artifact-visualizer.component.ts
+++ b/appsrc/src/app/plugins/project/components/artifact-visualizer/artifact-visualizer.component.ts
@@ -101,6 +101,15 @@ export class ArtifactVisualizerComponent implements OnInit {
};
break;
}
+ case 'TESTAR_State_Model': {
+ return {
+ artifact: this.selectedArtifact,
+ extension: 'web_testar_statemodel',
+ content: '',
+ originalUrl: '',
+ };
+ break;
+ }
default: {
return {
artifact: this.selectedArtifact,
diff --git a/appsrc/src/app/plugins/project/components/related-artifacts/related-artifacts.component.spec.ts b/appsrc/src/app/plugins/project/components/related-artifacts/related-artifacts.component.spec.ts
index 87fbce5f2382c30ad86a84033b204fec3c1bc21f..724188db4e37b1de8c71ac1cc7a4618c5c8609e9 100644
--- a/appsrc/src/app/plugins/project/components/related-artifacts/related-artifacts.component.spec.ts
+++ b/appsrc/src/app/plugins/project/components/related-artifacts/related-artifacts.component.spec.ts
@@ -40,12 +40,14 @@ describe('RelatedArtifactsComponent', () => {
const artifactTypeCode: ArtifactType = 'Code';
const artifactTypeDoc: ArtifactType = 'Doc';
const artifactTypeAnnot: ArtifactType = 'Annotation';
+ const artifactTypeTestar: ArtifactType = 'TESTAR_State_Model';
expect(component.getIcon(artifactTypeDiagram)).toBe(
constants.icons.DIAGRAM
);
expect(component.getIcon(artifactTypeCode)).toBe(constants.icons.CODE);
expect(component.getIcon(artifactTypeDoc)).toBe(constants.icons.DOC);
+ expect(component.getIcon(artifactTypeTestar)).toBe(constants.icons.DIAGRAM);
expect(component.getIcon(artifactTypeAnnot)).toBe(
constants.icons.ANNOTATION
);
diff --git a/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.html b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.html
new file mode 100644
index 0000000000000000000000000000000000000000..30872c386d066aaaeb62536e8735c11eebfd7c4f
--- /dev/null
+++ b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.html
@@ -0,0 +1,4 @@
+
diff --git a/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.scss b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.scss
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.spec.ts b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..dde8110bc69f35a9dac466e7f7f070ba7f690bcd
--- /dev/null
+++ b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { StateModelVisualizerComponent } from './statemodel-visualizer.component';
+
+describe('StateModelVisualizerComponent', () => {
+ let component: StateModelVisualizerComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ StateModelVisualizerComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(StateModelVisualizerComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.ts b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9e5ceb650b55b3130b9fae3b8a94df80aceed95c
--- /dev/null
+++ b/appsrc/src/app/plugins/project/components/statemodel-visualizer/statemodel-visualizer.component.ts
@@ -0,0 +1,18 @@
+import { Component, OnInit } from '@angular/core';
+import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
+
+@Component({
+ selector: 'app-statemodel-visualizer',
+ templateUrl: './statemodel-visualizer.component.html',
+ styleUrls: ['./statemodel-visualizer.component.scss'],
+})
+export class StateModelVisualizerComponent implements OnInit {
+ htmlUrl: SafeUrl;
+
+ constructor(private sanitizer: DomSanitizer) {}
+
+ ngOnInit(): void {
+ this.htmlUrl = this.sanitizer.bypassSecurityTrustResourceUrl('http://81.200.36.109:8090/models');
+ //this.htmlUrl = this.sanitizer.bypassSecurityTrustResourceUrl('http://127.0.0.1:8090/models');
+ }
+}
diff --git a/appsrc/src/app/plugins/project/containers/artifact-navigation/artifact-navigation.component.ts b/appsrc/src/app/plugins/project/containers/artifact-navigation/artifact-navigation.component.ts
index 588649e79be2eca4a952e8486a7b30c8d77e3a14..bd1e7cf6340a286fc63112cbf6e1884840a3852e 100644
--- a/appsrc/src/app/plugins/project/containers/artifact-navigation/artifact-navigation.component.ts
+++ b/appsrc/src/app/plugins/project/containers/artifact-navigation/artifact-navigation.component.ts
@@ -73,6 +73,7 @@ export class ArtifactNavigationComponent implements OnInit {
this.artifactsRetriever.getPKMDocsFromAProject(this.projectInfo.name),
this.artifactsRetriever.getPKMLogsFromAProject(this.projectInfo.name),
this.artifactsRetriever.getPKMDiagramsFromAProject(this.projectInfo.name),
+ this.artifactsRetriever.getPKMTESTARStateModelFromAProject(this.projectInfo.name),
]
).subscribe((result: any) => {
this.pkmArtifacts = this.filterErrorResultsFromRequest(result.flat(1));
@@ -135,6 +136,7 @@ export class ArtifactNavigationComponent implements OnInit {
this.artifactsRetriever.getPKMDocsFromAProject(this.projectInfo.name),
this.artifactsRetriever.getPKMLogsFromAProject(this.projectInfo.name),
this.artifactsRetriever.getPKMDiagramsFromAProject(this.projectInfo.name),
+ this.artifactsRetriever.getPKMTESTARStateModelFromAProject(this.projectInfo.name),
]
).subscribe((result: any) => {
this.pkmArtifacts = this.filterErrorResultsFromRequest(result.flat(1));
@@ -199,6 +201,11 @@ export class ArtifactNavigationComponent implements OnInit {
artifact.id = `${artifact.name}`;
break;
}
+ case 'TESTAR_State_Model': {
+ artifact.name = `${artifact.stateModelDataStoreDB}`;
+ artifact.id = `${artifact._id}`;
+ break;
+ }
default: {
artifact.name = `${artifact.rel_path}`;
artifact.id = `${artifact.rel_path}`;
@@ -247,6 +254,25 @@ export class ArtifactNavigationComponent implements OnInit {
this.goToSelectedArtifact(artifactNodeInformation.id);
break;
}
+ case 'TESTAR_State_Model': {
+ this.artifactsRetriever
+ .getPKMTESTARStateModelFromAProjectByID(this.projectInfo.name, artifactNodeInformation.id)
+ .subscribe((element: any) => {
+ this.selectedArtifact = {
+ content: element,
+ type: element.type,
+ name: element.stateModelDataStoreDB,
+ id: element._id,
+ rel_path: '',
+ format: '',
+ encoding: '',
+ gitRepoUrl: '',
+ gitCommitId: '',
+ };
+ });
+ this.goToSelectedArtifact(artifactNodeInformation.id);
+ break;
+ }
case 'Comment': {
this.artifactsRetriever
.getPKMCommentsFromAProjectByID(this.projectInfo.name, artifactNodeInformation.id)
diff --git a/appsrc/src/app/plugins/project/services/artifacts-retriever/artifacts-retriever.service.ts b/appsrc/src/app/plugins/project/services/artifacts-retriever/artifacts-retriever.service.ts
index bf3007950b8450549357252f0cd53734728a3087..94bef5af7720432b6079184c80887954533bd556 100644
--- a/appsrc/src/app/plugins/project/services/artifacts-retriever/artifacts-retriever.service.ts
+++ b/appsrc/src/app/plugins/project/services/artifacts-retriever/artifacts-retriever.service.ts
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { PKMArtifact } from 'src/app/core/models/artifact';
import { Observable, of } from 'rxjs';
-import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { HttpClient, HttpHeaders, HttpClientModule, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { catchError } from 'rxjs/operators';
import { urlEncodeArtifactName } from '../../../../utils/utils';
@@ -138,4 +138,32 @@ export class ArtifactsRetrieverService {
.get(url)
.pipe(catchError((err: any) => of({isError: true, error: err})));
}
+
+ getPKMTESTARStateModelFromAProject(projectId: string): Observable {
+ // Activate TESTAR State Model web feature sending a GET request
+ const testarHeaders: HttpHeaders = new HttpHeaders({
+ 'Content-Type': 'application/json',
+ 'OrientDBaddress': '127.0.0.1',
+ 'OrientDBpassword': 'testar',
+ 'OrientDBuser': 'testar'
+ });
+
+ this.http.get(
+ 'https://decoder-tool.ow2.org/testar/testar/analysis/MyThaiStar',
+ {
+ headers: testarHeaders,
+ }).subscribe(x => console.log(x));
+
+ const url: string = `${PROJECT_BASE_URL}/testar/state_model/${projectId}`;
+ return this.http
+ .get(url)
+ .pipe(catchError((err: any) => of({isError: true, error: err})));
+ }
+
+ getPKMTESTARStateModelFromAProjectByID(projectId: string, artifactId: string): Observable {
+ const url: string = `${PROJECT_BASE_URL}/testar/state_model/${projectId}/${artifactId}`;
+ return this.http
+ .get(url)
+ .pipe(catchError((err: any) => of({isError: true, error: err})));
+ }
}
diff --git a/appsrc/src/app/plugins/project/testing/services/artifact-retriever.mock.ts b/appsrc/src/app/plugins/project/testing/services/artifact-retriever.mock.ts
index ae2588e14e22061f8d266c7453b57a5bc3ef4b7f..76249b70cf9157eaa1210175bbc7c4039a076550 100644
--- a/appsrc/src/app/plugins/project/testing/services/artifact-retriever.mock.ts
+++ b/appsrc/src/app/plugins/project/testing/services/artifact-retriever.mock.ts
@@ -39,6 +39,9 @@ export function getMockRetriever(): Partial {
getPKMDiagramsFromAProject : jasmine
.createSpy('getPKMDiagramsFromAProject ')
.and.returnValue(scheduled(of([]), asyncScheduler)),
+ getPKMTESTARStateModelFromAProject : jasmine
+ .createSpy('getPKMTESTARStateModelFromAProject')
+ .and.returnValue(scheduled(of([]), asyncScheduler)),
};
return mockRetriever;
diff --git a/appsrc/src/app/shared/constants/constants.ts b/appsrc/src/app/shared/constants/constants.ts
index 0067272eee8e616a07fa45eabdb9fbbbe5d7252b..cdc266103336712e11ad6f054abe0208c415ce4e 100644
--- a/appsrc/src/app/shared/constants/constants.ts
+++ b/appsrc/src/app/shared/constants/constants.ts
@@ -7,6 +7,7 @@ export interface Constants {
COMMENT: string;
LOG: string;
'UML MODEL': string;
+ 'TESTAR STATE MODEL': string;
};
icons: {
@@ -17,6 +18,7 @@ export interface Constants {
COMMENT: string;
LOG: string;
'UML MODEL': string;
+ 'TESTAR STATE MODEL': string;
};
}
@@ -29,6 +31,7 @@ export const constants: Constants = {
COMMENT: 'Comment',
LOG: 'Log',
'UML MODEL': 'UML Model',
+ 'TESTAR STATE MODEL': 'TESTAR_State_Model',
},
icons: {
DIAGRAM: 'integration_instructions',
@@ -38,5 +41,6 @@ export const constants: Constants = {
COMMENT: 'comment',
LOG: 'description',
'UML MODEL': 'device_hub',
+ 'TESTAR STATE MODEL': 'device_hub',
}
};