From: Patrik Buhr Date: Mon, 18 Jan 2021 13:38:16 +0000 (+0000) Subject: Merge "Filtering the producer in the frontend" X-Git-Tag: 2.2.0~117 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=f34ec0823b56ceaf7a6073be6fc530b0d432b37d;hp=cde4ceece9e916ef9387e78982df21b13dc58837;p=portal%2Fnonrtric-controlpanel.git Merge "Filtering the producer in the frontend" --- diff --git a/docs/api.json b/docs/api.json index 3a47572..a4ea2ed 100644 --- a/docs/api.json +++ b/docs/api.json @@ -45,10 +45,7 @@ "200": { "description": "OK", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ei_job_request" - } + "type": "string" } }, "401": { @@ -78,10 +75,7 @@ "200": { "description": "OK", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/ei_producer" - } + "type": "string" } }, "401": { @@ -381,64 +375,5 @@ "deprecated": false } } - }, - "definitions": { - "ei_job_request": { - "type": "object", - "required": [ - "ei_job_identity" - ], - "properties": { - "ei_job_data": { - "type": "object", - "description": "Json for the job data" - }, - "ei_job_identity": { - "type": "string", - "description": "Identity of the EI job" - }, - "ei_type_identity": { - "type": "string", - "description": "Type identity for the job" - }, - "owner": { - "type": "string", - "description": "The owner of the job" - }, - "target_uri": { - "type": "string", - "description": "URI for the target of the EI" - } - }, - "title": "ei_job_request", - "description": "The EI job" - }, - "ei_producer": { - "type": "object", - "required": [ - "ei_producer_id", - "ei_producer_types", - "status" - ], - "properties": { - "ei_producer_id": { - "type": "string", - "description": "Idenitity of the EI producer" - }, - "ei_producer_types": { - "type": "array", - "description": "Types provided by the EI producer", - "items": { - "type": "string" - } - }, - "status": { - "type": "string", - "description": "Status of the EI producer" - } - }, - "title": "ei_producer", - "description": "The EI producer" - } } } diff --git a/nonrtric-gateway/.gitignore b/nonrtric-gateway/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/nonrtric-gateway/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/nonrtric-gateway/Dockerfile b/nonrtric-gateway/Dockerfile new file mode 100644 index 0000000..9f2a545 --- /dev/null +++ b/nonrtric-gateway/Dockerfile @@ -0,0 +1,35 @@ +# +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +# +FROM openjdk:11-jre-slim + +ARG JAR + +WORKDIR /opt/app/nonrtric-gateway +RUN mkdir -p /var/log/nonrtric-gateway + +EXPOSE 8081 8433 + +ADD /config/application.yaml /opt/app/nonrtric-gateway/config/application.yaml +ADD target/${JAR} /opt/app/nonrtric-gateway/nonrtric-gateway.jar + + +RUN chmod -R 777 /opt/app/nonrtric-gateway/config/ + +CMD ["java", "-jar", "/opt/app/nonrtric-gateway/nonrtric-gateway.jar"] diff --git a/nonrtric-gateway/README.md b/nonrtric-gateway/README.md new file mode 100644 index 0000000..23eec31 --- /dev/null +++ b/nonrtric-gateway/README.md @@ -0,0 +1,21 @@ +# O-RAN-SC Non-RT RIC ControlPanel Gateway + +The O-RAN Non-RT RIC ControlPanel Gateway provides an API Gateway for all the Non-RT-RIC Components + +The application is a spring cloud gateway and all the route configurations are provided in application.yaml. + + +## License + +Copyright (C) 2021 Nordix Foundation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/nonrtric-gateway/config/application.yaml b/nonrtric-gateway/config/application.yaml new file mode 100644 index 0000000..57d94d7 --- /dev/null +++ b/nonrtric-gateway/config/application.yaml @@ -0,0 +1,52 @@ +################################################################################ +# Copyright (c) 2021 Nordix Foundation. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +server: + port: 9090 +spring: + cloud: + gateway: + httpclient: + ssl: + useInsecureTrustManager: true + wiretap: true + httpserver: + wiretap: true + routes: + - id: policytypes + uri: https://localhost:8433 + predicates: + - Path=/v2/policy-types/** + - id: policies + uri: https://localhost:8433 + predicates: + - Path=/v2/policies +management: + endpoint: + gateway: + enabled: true + endpoints: + web: + exposure: + include: "gateway,loggers,logfile,health,info,metrics,threaddump,heapdump" +logging: + level: + ROOT: ERROR + org.springframework: ERROR + org.springframework.cloud.gateway: INFO + reactor.netty: INFO + file: + name: /var/log/nonrtric-gateway/application.log \ No newline at end of file diff --git a/nonrtric-gateway/eclipse-formatter.xml b/nonrtric-gateway/eclipse-formatter.xml new file mode 100644 index 0000000..c5412d9 --- /dev/null +++ b/nonrtric-gateway/eclipse-formatter.xml @@ -0,0 +1,363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nonrtric-gateway/pom.xml b/nonrtric-gateway/pom.xml new file mode 100644 index 0000000..5917ef5 --- /dev/null +++ b/nonrtric-gateway/pom.xml @@ -0,0 +1,181 @@ + + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.4.1 + + + org.oransc.nonrtric + nonrtric-gateway + 0.0.1-SNAPSHOT + Nonrtric Gateway + Nonrtric Gateway + + + 11 + 2020.0.0 + 2.13.0 + 2.5.0 + 0.30.0 + + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-actuator + runtime + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + net.revelc.code.formatter + formatter-maven-plugin + ${formatter-maven-plugin.version} + + LF + ${project.basedir}/eclipse-formatter.xml + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless-maven-plugin.version} + + UNIX + + + + com,java,javax,org + + + + + + + + + + docker + + + + io.fabric8 + docker-maven-plugin + ${docker-maven-plugin.version} + false + + + generate-nonrtric-gateway-image + package + + build + + + ${env.CONTAINER_PULL_REGISTRY} + + + o-ran-sc/nonrtric-gateway:${project.version} + + try + ${basedir} + Dockerfile + + ${project.build.finalName}.jar + + + ${project.version} + + + + + + + + push-nonrtric-gateway-image + + build + push + + + ${env.CONTAINER_PULL_REGISTRY} + ${env.CONTAINER_PUSH_REGISTRY} + + + o-ran-sc/nonrtric-gateway:${project.version} + + ${basedir} + Dockerfile + + ${project.build.finalName}.jar + + + ${project.version} + latest + + + + + + + + + + + + + \ No newline at end of file diff --git a/nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java b/nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java new file mode 100644 index 0000000..992e793 --- /dev/null +++ b/nonrtric-gateway/src/main/java/org/oransc/nonrtric/gateway/GatewayApplication.java @@ -0,0 +1,33 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2021 Nordix Foundation + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================LICENSE_END=================================== + */ + +package org.oransc.nonrtric.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class GatewayApplication { + + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class, args); + } + +} diff --git a/nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java b/nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java new file mode 100644 index 0000000..c2ca7f3 --- /dev/null +++ b/nonrtric-gateway/src/test/java/org/oransc/nonrtric/gateway/GatewayApplicationTests.java @@ -0,0 +1,32 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2021 Nordix Foundation + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================LICENSE_END=================================== + */ + +package org.oransc.nonrtric.gateway; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class GatewayApplicationTests { + + @Test + void contextLoads() {} + +} diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/controller/EnrichmentController.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/controller/EnrichmentController.java index c874dc1..297f5bc 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/controller/EnrichmentController.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/controller/EnrichmentController.java @@ -19,6 +19,7 @@ */ package org.oransc.portal.nonrtric.controlpanel.controller; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; @@ -73,6 +74,7 @@ public class EnrichmentController { // Populated by the autowired constructor private final EiProducerApi eiProducerApi; + public static com.google.gson.Gson gson = new GsonBuilder().create(); @Autowired public EnrichmentController(final EiProducerApi eiProducerApi) { @@ -83,7 +85,7 @@ public class EnrichmentController { @ApiOperation(value = "Get the EI job definitions for one EI producer") @GetMapping(EI_JOBS) - public ResponseEntity> getEiJobs() { + public ResponseEntity getEiJobs() { logger.debug("getEiJobs"); ResponseEntity response = this.eiProducerApi.getAllEiProducerIds(); JsonArray bodyJson = JsonParser.parseString(response.getBody()).getAsJsonArray(); @@ -91,7 +93,7 @@ public class EnrichmentController { for (JsonElement producerId : bodyJson) { allJobs.addAll(getJobs(producerId)); } - return new ResponseEntity<>(allJobs, HttpStatus.OK); + return new ResponseEntity<>(gson.toJson(allJobs), HttpStatus.OK); } private List getJobs(JsonElement producerId) { @@ -102,7 +104,7 @@ public class EnrichmentController { @ApiOperation(value = "Get EI producers") @GetMapping(EI_PRODUCERS) - public ResponseEntity> getEiProducers() { + public ResponseEntity getEiProducers() { logger.debug("getEiProducers"); ResponseEntity response = this.eiProducerApi.getAllEiProducerIds(); JsonArray bodyJson = JsonParser.parseString(response.getBody()).getAsJsonArray(); @@ -116,7 +118,7 @@ public class EnrichmentController { producers.add(producerInfo); } - return new ResponseEntity<>(producers, HttpStatus.OK); + return new ResponseEntity<>(gson.toJson(producers), HttpStatus.OK); } private String[] getSupportedTypes(JsonElement producerId) { diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java index 78bbd87..9f64153 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/JobInfo.java @@ -20,7 +20,6 @@ package org.oransc.portal.nonrtric.controlpanel.model; -import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; @@ -36,27 +35,22 @@ public class JobInfo { @ApiModelProperty(value = "Identity of the EI job", required = true) @SerializedName("ei_job_identity") - @JsonProperty("ei_job_identity") public String id; @ApiModelProperty(value = "Type identity for the job") @SerializedName("ei_type_identity") - @JsonProperty("ei_type_identity") public String typeId; @ApiModelProperty(value = "Json for the job data") @SerializedName("ei_job_data") - @JsonProperty("ei_job_data") public Object jobData; @ApiModelProperty(value = "URI for the target of the EI") @SerializedName("target_uri") - @JsonProperty("target_uri") public String targetUri; @ApiModelProperty(value = "The owner of the job") @SerializedName("owner") - @JsonProperty("owner") public String owner; } diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/PolicyType.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/PolicyType.java index ca2996e..ac114b3 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/PolicyType.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/PolicyType.java @@ -20,14 +20,10 @@ */ package org.oransc.portal.nonrtric.controlpanel.model; -import com.fasterxml.jackson.annotation.JsonProperty; - public class PolicyType { - @JsonProperty("name") String name; - @JsonProperty("schema") Object schema; public PolicyType(String name, Object schema) { diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerInfo.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerInfo.java index 6293871..08aeee9 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerInfo.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerInfo.java @@ -18,7 +18,6 @@ package org.oransc.portal.nonrtric.controlpanel.model; -import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; @@ -34,17 +33,14 @@ public class ProducerInfo { @ApiModelProperty(value = "Idenitity of the EI producer", required = true) @SerializedName("ei_producer_id") - @JsonProperty("ei_producer_id") public String id; @ApiModelProperty(value = "Types provided by the EI producer", required = true) @SerializedName("ei_producer_types") - @JsonProperty("ei_producer_types") public String[] types; @ApiModelProperty(value = "Status of the EI producer", required = true) @SerializedName("status") - @JsonProperty("status") public String status; } diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerRegistrationInfo.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerRegistrationInfo.java index 0f4499d..670beb3 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerRegistrationInfo.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerRegistrationInfo.java @@ -20,7 +20,6 @@ package org.oransc.portal.nonrtric.controlpanel.model; -import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; import io.swagger.annotations.ApiModel; @@ -44,32 +43,26 @@ public class ProducerRegistrationInfo { @ApiModelProperty(value = "EI type identity", required = true) @SerializedName("ei_type_identity") - @JsonProperty(value = "ei_type_identity", required = true) public String eiTypeId; @ApiModelProperty(value = "Json schema for the job data") @SerializedName("ei_job_data_schema") - @JsonProperty("ei_job_data_schema") public Object jobDataSchema; } @ApiModelProperty(value = "Supported EI types", required = true) @SerializedName("supported_ei_types") - @JsonProperty(value = "supported_ei_types", required = true) public Collection types; @ApiModelProperty(value = "callback for EI job", required = true) @SerializedName("ei_job_callback_url") - @JsonProperty(value = "ei_job_callback_url", required = true) public String jobCallbackUrl; @ApiModelProperty(value = "callback for producer supervision", required = true) @SerializedName("ei_producer_supervision_callback_url") - @JsonProperty(value = "ei_producer_supervision_callback_url", required = true) public String producerSupervisionCallbackUrl; @ApiModelProperty(value = "status", required = true) @SerializedName("status") - @JsonProperty(value = "status", required = true) public ProducerStatusInfo status; } diff --git a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerStatusInfo.java b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerStatusInfo.java index 77f02a8..53daebb 100644 --- a/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerStatusInfo.java +++ b/webapp-backend/src/main/java/org/oransc/portal/nonrtric/controlpanel/model/ProducerStatusInfo.java @@ -20,7 +20,6 @@ package org.oransc.portal.nonrtric.controlpanel.model; -import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.annotations.SerializedName; import lombok.Builder; @@ -37,7 +36,6 @@ public class ProducerStatusInfo { } @SerializedName("operational_state") - @JsonProperty(value = "operational_state", required = true) public final OperationalState opState; public ProducerStatusInfo(OperationalState state) { diff --git a/webapp-frontend/container-tag.yaml b/webapp-frontend/container-tag.yaml index 46ba559..82f559b 100644 --- a/webapp-frontend/container-tag.yaml +++ b/webapp-frontend/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 2.2.0-SNAPSHOT +tag: 2.2.0 diff --git a/webapp-frontend/src/app/app.component.html b/webapp-frontend/src/app/app.component.html new file mode 100644 index 0000000..838606d --- /dev/null +++ b/webapp-frontend/src/app/app.component.html @@ -0,0 +1,8 @@ +
+

+ Welcome to {{title}}! +

+ +
+ + \ No newline at end of file diff --git a/webapp-frontend/src/app/app.component.sass b/webapp-frontend/src/app/app.component.sass new file mode 100644 index 0000000..e69de29 diff --git a/webapp-frontend/src/app/app.component.spec.ts b/webapp-frontend/src/app/app.component.spec.ts new file mode 100644 index 0000000..7222b1e --- /dev/null +++ b/webapp-frontend/src/app/app.component.spec.ts @@ -0,0 +1,35 @@ +import { TestBed, async } from '@angular/core/testing'; +import { APP_BASE_HREF } from '@angular/common'; +import { RouterModule, Routes } from '@angular/router'; +import { AppComponent } from './app.component'; + +describe('AppComponent', () => { + const routes: Routes = [ + { path: '', redirectTo: '/policy', pathMatch: 'full'} + ]; + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ + AppComponent + ], + imports: [ + RouterModule.forRoot(routes) + ], + providers: [ + { provide: APP_BASE_HREF, useValue: '/' } + ] + }).compileComponents(); + })); + + it('should create the app', async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + })); + + it(`should have as title 'controlpanelApp'`, async(() => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('controlpanelApp'); + })); +}); \ No newline at end of file diff --git a/webapp-frontend/src/app/app.component.ts b/webapp-frontend/src/app/app.component.ts new file mode 100644 index 0000000..7115687 --- /dev/null +++ b/webapp-frontend/src/app/app.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.sass'] +}) +export class AppComponent { + title = 'controlpanelApp'; +} \ No newline at end of file diff --git a/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.spec.ts b/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.spec.ts index 36b2cc8..59b09e9 100644 --- a/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.spec.ts +++ b/webapp-frontend/src/app/ei-coordinator/ei-coordinator.component.spec.ts @@ -37,8 +37,4 @@ describe('EICoordinatorComponent', () => { component = fixture.componentInstance; fixture.detectChanges(); }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); }); diff --git a/webapp-frontend/src/app/footer/footer.component.spec.ts b/webapp-frontend/src/app/footer/footer.component.spec.ts index 9b1d31a..2c8321c 100644 --- a/webapp-frontend/src/app/footer/footer.component.spec.ts +++ b/webapp-frontend/src/app/footer/footer.component.spec.ts @@ -20,6 +20,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FooterComponent } from './footer.component'; +import { UiService } from '../services/ui/ui.service'; describe('FooterComponent', () => { let component: FooterComponent; @@ -27,7 +28,10 @@ describe('FooterComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FooterComponent ] + declarations: [ FooterComponent ], + providers: [ + UiService + ] }) .compileComponents(); })); diff --git a/webapp-frontend/src/app/main/main.component.spec.ts b/webapp-frontend/src/app/main/main.component.spec.ts index df9a9aa..809ee32 100644 --- a/webapp-frontend/src/app/main/main.component.spec.ts +++ b/webapp-frontend/src/app/main/main.component.spec.ts @@ -38,7 +38,5 @@ describe('MainComponent', () => { fixture.detectChanges(); }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + }); diff --git a/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts b/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts index 7c8643a..094ff45 100644 --- a/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts +++ b/webapp-frontend/src/app/policy-control/policy-control.component.spec.ts @@ -20,6 +20,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { PolicyControlComponent } from './policy-control.component'; +import { MatIconModule, MatTableModule } from '@angular/material'; +import { PolicyType } from '../interfaces/policy.types'; describe('PolicyControlComponent', () => { let component: PolicyControlComponent; @@ -27,6 +29,7 @@ describe('PolicyControlComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ + imports: [ MatIconModule,MatTableModule ], declarations: [ PolicyControlComponent ] }) .compileComponents(); @@ -38,7 +41,4 @@ describe('PolicyControlComponent', () => { fixture.detectChanges(); }); - it('should create', () => { - expect(component).toBeTruthy(); - }); }); diff --git a/webapp-frontend/src/app/services/ei/ei.service.spec.ts b/webapp-frontend/src/app/services/ei/ei.service.spec.ts index 6814d8a..affa682 100644 --- a/webapp-frontend/src/app/services/ei/ei.service.spec.ts +++ b/webapp-frontend/src/app/services/ei/ei.service.spec.ts @@ -20,9 +20,12 @@ import { TestBed } from '@angular/core/testing'; import { EIService } from './ei.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing' -describe('PolicyService', () => { - beforeEach(() => TestBed.configureTestingModule({})); +describe('EIService', () => { + beforeEach(() => TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + })); it('should be created', () => { const service: EIService = TestBed.get(EIService); diff --git a/webapp-frontend/src/app/services/policy/policy.service.spec.ts b/webapp-frontend/src/app/services/policy/policy.service.spec.ts index de1f4e6..135e413 100644 --- a/webapp-frontend/src/app/services/policy/policy.service.spec.ts +++ b/webapp-frontend/src/app/services/policy/policy.service.spec.ts @@ -20,9 +20,12 @@ import { TestBed } from '@angular/core/testing'; import { PolicyService } from './policy.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing' describe('PolicyService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({ + imports: [HttpClientTestingModule] + })); it('should be created', () => { const service: PolicyService = TestBed.get(PolicyService); diff --git a/webapp-frontend/src/app/services/ui/confirm-dialog.service.spec.ts b/webapp-frontend/src/app/services/ui/confirm-dialog.service.spec.ts index c8992eb..2cc241e 100644 --- a/webapp-frontend/src/app/services/ui/confirm-dialog.service.spec.ts +++ b/webapp-frontend/src/app/services/ui/confirm-dialog.service.spec.ts @@ -21,9 +21,14 @@ import { TestBed } from '@angular/core/testing'; import { ConfirmDialogService } from './confirm-dialog.service'; +import { MatDialogModule } from '@angular/material'; +import {UiService} from './ui.service'; describe('ConfirmDialogService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({ + imports: [ MatDialogModule ], + providers: [UiService] + })); it('should be created', () => { const service: ConfirmDialogService = TestBed.get(ConfirmDialogService); diff --git a/webapp-frontend/src/app/services/ui/notification.service.spec.ts b/webapp-frontend/src/app/services/ui/notification.service.spec.ts index 61110c9..b6953e6 100644 --- a/webapp-frontend/src/app/services/ui/notification.service.spec.ts +++ b/webapp-frontend/src/app/services/ui/notification.service.spec.ts @@ -21,9 +21,16 @@ import { TestBed } from '@angular/core/testing'; import { NotificationService } from './notification.service'; +import { ToastrModule } from 'ngx-toastr'; describe('NotificationService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({ + imports: [ToastrModule.forRoot()], + providers: [ + {provide: ToastrModule} + ] + + })); it('should be created', () => { const service: NotificationService = TestBed.get(NotificationService); diff --git a/webapp-frontend/src/app/ui/confirm-dialog/confirm-dialog.component.spec.ts b/webapp-frontend/src/app/ui/confirm-dialog/confirm-dialog.component.spec.ts index 266b581..c0bb760 100644 --- a/webapp-frontend/src/app/ui/confirm-dialog/confirm-dialog.component.spec.ts +++ b/webapp-frontend/src/app/ui/confirm-dialog/confirm-dialog.component.spec.ts @@ -21,6 +21,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ConfirmDialogComponent } from './confirm-dialog.component'; +import { MatDialogModule } from '@angular/material'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; describe('ConfirmDialogComponent', () => { let component: ConfirmDialogComponent; @@ -28,7 +30,12 @@ describe('ConfirmDialogComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ConfirmDialogComponent ] + declarations: [ ConfirmDialogComponent ], + imports: [ MatDialogModule ], + providers: [ + { provide: MAT_DIALOG_DATA, useValue: {} }, + { provide: MatDialogRef, useValue: {} } + ] }) .compileComponents(); })); diff --git a/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts b/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts index c438461..7bdf97c 100644 --- a/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts +++ b/webapp-frontend/src/app/ui/ei-card/ei-card.component.spec.ts @@ -20,14 +20,24 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {EICardComponent} from './ei-card.component'; +import { MatIconModule } from '@angular/material'; +import { RouterModule, Routes } from '@angular/router'; +import {UiService} from '../../services/ui/ui.service'; describe('EICardComponent', () => { + const routes: Routes = [ + { path: 'ei-coordinator', redirectTo: '../../ei-coordinator', pathMatch: 'full'} + ]; let component: EICardComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [EICardComponent] + declarations: [EICardComponent], + imports: [ MatIconModule, + RouterModule.forRoot(routes) + ], + providers: [UiService] }) .compileComponents(); })); diff --git a/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts b/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts index eb678a9..4dd9000 100644 --- a/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts +++ b/webapp-frontend/src/app/ui/policy-card/policy-card.component.spec.ts @@ -20,14 +20,24 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {PolicyCardComponent} from './policy-card.component'; +import { MatIconModule,MatCardModule } from '@angular/material'; +import { RouterModule, Routes } from '@angular/router'; +import {UiService} from '../../services/ui/ui.service'; describe('PolicyCardComponent', () => { + const routes: Routes = [ + { path: 'policy', redirectTo: '../../policy', pathMatch: 'full'} + ]; let component: PolicyCardComponent; let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [PolicyCardComponent] + declarations: [PolicyCardComponent], + imports: [ MatIconModule,MatCardModule, + RouterModule.forRoot(routes) + ], + providers: [UiService] }) .compileComponents(); })); diff --git a/webapp-frontend/src/styles.css b/webapp-frontend/src/styles.css new file mode 100644 index 0000000..e69de29