summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--cds-ui/application/pom.xml9
-rw-r--r--cds-ui/client/pom.xml9
-rw-r--r--cds-ui/client/src/app/common/constants/app-constants.ts4
-rw-r--r--cds-ui/client/src/app/common/core/services/api.service.ts1
-rw-r--r--cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts1
-rw-r--r--cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts3
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts13
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts9
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts5
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts1
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/exsisting-model.service.ts4
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.spec.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-definition-routing.module.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.spec.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts4
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.spec.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts2
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts2
-rw-r--r--cds-ui/pom.xml11
-rw-r--r--cds-ui/server/config/app-config.ts9
-rw-r--r--cds-ui/server/pom.xml9
-rw-r--r--cds-ui/server/src/controllers/blueprint-rest.controller.ts44
-rw-r--r--cds-ui/server/src/controllers/data-dictionary.controller.ts14
-rw-r--r--cds-ui/server/src/datasources/blueprint.datasource-template.ts (renamed from cds-ui/server/src/datasources/blueprint.datasource.json)14
-rw-r--r--cds-ui/server/src/datasources/blueprint.datasource.ts2
-rw-r--r--cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts (renamed from cds-ui/server/src/datasources/resource-dictionary.datasource.json)38
-rw-r--r--cds-ui/server/src/datasources/resource-dictionary.datasource.ts2
-rw-r--r--cds-ui/server/src/services/blueprint.service.ts2
-rw-r--r--cds-ui/server/src/services/resource-dictionary.service.ts10
-rw-r--r--components/model-catalog/proto-definition/pom.xml4
-rw-r--r--components/parent/pom.xml2
-rw-r--r--components/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/distribution/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/functions/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt120
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json23
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/pom.xml2
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml9
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt88
-rwxr-xr-xms/blueprintsprocessor/modules/commons/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt22
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/outbounds/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt59
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt27
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt42
-rwxr-xr-xms/blueprintsprocessor/modules/services/pom.xml2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml2
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml8
-rwxr-xr-xms/blueprintsprocessor/pom.xml2
-rwxr-xr-xms/command-executor/pom.xml5
-rw-r--r--ms/controllerblueprints/application/pom.xml2
-rwxr-xr-xms/controllerblueprints/distribution/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt33
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt169
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt515
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/blueprint-validation/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/db-resources/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/pom.xml5
-rw-r--r--ms/controllerblueprints/modules/resource-dict/pom.xml2
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml5
-rw-r--r--ms/controllerblueprints/parent/pom.xml2
-rw-r--r--ms/controllerblueprints/pom.xml4
-rw-r--r--ms/pom.xml7
-rw-r--r--ms/sdclistener/application/pom.xml20
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java36
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java1
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java1
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java10
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java84
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java (renamed from ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java)24
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java65
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java16
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java30
-rw-r--r--ms/sdclistener/application/src/main/resources/application.yaml (renamed from ms/sdclistener/application/src/main/resources/application.yml)0
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java46
-rw-r--r--ms/sdclistener/application/src/test/resources/service-ServicePnfTest-csar.csarbin0 -> 58715 bytes
-rw-r--r--ms/sdclistener/application/src/test/resources/service-Testsvc140.csarbin116298 -> 0 bytes
-rw-r--r--ms/sdclistener/application/src/test/resources/wrong_csar_pattern.csarbin0 -> 29302 bytes
-rwxr-xr-xms/sdclistener/distribution/pom.xml2
-rwxr-xr-xms/sdclistener/parent/pom.xml6
-rw-r--r--ms/sdclistener/pom.xml2
-rw-r--r--pom.xml11
-rw-r--r--version.properties4
112 files changed, 1542 insertions, 280 deletions
diff --git a/.gitignore b/.gitignore
index a2661f06f..29bf5d423 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@ build/Release
node_modules/
jspm_packages/
dist/
+dist10/
# TypeScript v1 declaration files
typings/
diff --git a/cds-ui/application/pom.xml b/cds-ui/application/pom.xml
index 3ab1d338b..66b4b80e7 100644
--- a/cds-ui/application/pom.xml
+++ b/cds-ui/application/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START==========================================
===================================================================
@@ -17,20 +18,18 @@ 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============================================ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ui</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>application</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cds-ui-application</name>
diff --git a/cds-ui/client/pom.xml b/cds-ui/client/pom.xml
index b0b1c55ec..86504b7ea 100644
--- a/cds-ui/client/pom.xml
+++ b/cds-ui/client/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START==========================================
===================================================================
@@ -17,20 +18,18 @@ 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============================================ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ui</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ui-client</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cds-ui-client</name>
diff --git a/cds-ui/client/src/app/common/constants/app-constants.ts b/cds-ui/client/src/app/common/constants/app-constants.ts
index d4e8989c1..283ce735f 100644
--- a/cds-ui/client/src/app/common/constants/app-constants.ts
+++ b/cds-ui/client/src/app/common/constants/app-constants.ts
@@ -92,10 +92,6 @@ export const GlobalContants = {
}
};
-export const LoopbackConfig = {
- url: "http://127.0.0.1:3000",
- authtoken: "ccsdkapps"
-}
export const ResourceDictionaryURLs = {
saveResourceDictionary: '/resourcedictionary/save',
diff --git a/cds-ui/client/src/app/common/core/services/api.service.ts b/cds-ui/client/src/app/common/core/services/api.service.ts
index 463ef3827..addf51ca5 100644
--- a/cds-ui/client/src/app/common/core/services/api.service.ts
+++ b/cds-ui/client/src/app/common/core/services/api.service.ts
@@ -24,7 +24,6 @@ limitations under the License.
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpResponse, HttpHeaderResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
-import { LoopbackConfig } from '../../constants/app-constants';
@Injectable()
export class ApiService {
diff --git a/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts b/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
index 6d2659248..13d7d53fe 100644
--- a/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
+++ b/cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
@@ -28,6 +28,7 @@ export interface IBlueprintState {
name?: string;
files?: any;
filesData?: any;
+ uploadedFileName?: string;
isLoadSuccess?: boolean;
isUpdateSuccess?: boolean;
isSaveSuccess?: boolean;
diff --git a/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
index 37a659da6..b4347d458 100644
--- a/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
+++ b/cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
@@ -55,7 +55,8 @@ export function blueprintReducer(state: IBlueprintState = initialBlueprintState,
blueprint: action.payload.blueprint,
name: action.payload.name,
files: action.payload.files,
- filesData: action.payload.filesData
+ filesData: action.payload.filesData,
+ uploadedFileName: action.payload.uploadedFileName
}
default:
return state;
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
index 1f8526a53..09fa00315 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
@@ -105,6 +105,7 @@ export class EditorComponent implements OnInit {
private fileObject: any;
private tocsaMetadaData: any;
metadata: IMetaData;
+ uploadedFileName: string;
private transformer = (node: Node, level: number) => {
return {
@@ -159,6 +160,7 @@ export class EditorComponent implements OnInit {
this.filesData = blueprintdata.filesData;
this.dataSource.data = this.filesTree;
this.blueprintName = blueprintdata.name;
+ this.uploadedFileName = blueprintdata.uploadedFileName;
let blueprint = [];
for (let key in this.blueprintdata) {
if (this.blueprintdata.hasOwnProperty(key)) {
@@ -176,6 +178,7 @@ export class EditorComponent implements OnInit {
this.artifactVersion = metadatavalues[4];
this.editor.getEditor().getSession().setTabSize(2);
this.editor.getEditor().getSession().setUseWrapMode(true);
+ this.editor.getEditor().getSession().setValue("");
this.setEditorMode();
})
}
@@ -201,7 +204,8 @@ export class EditorComponent implements OnInit {
blueprint: this.blueprint,
name: this.blueprintName,
files: this.filesTree,
- filesData: this.filesData
+ filesData: this.filesData,
+ uploadedFileName: this.uploadedFileName
}
this.store.dispatch(new SetBlueprintState(blueprintState));
// console.log(this.text);
@@ -217,7 +221,7 @@ export class EditorComponent implements OnInit {
this.filetoDelete = file.name;
this.currentFilePath = this.currentFilePath + this.selectedFile;
this.filesData.forEach((fileNode) => {
- if (fileNode.name.includes(file.name)) {
+ if (fileNode.name.includes(file.name) && fileNode.name == this.currentFilePath) {
this.text = fileNode.data;
}
})
@@ -405,7 +409,9 @@ export class EditorComponent implements OnInit {
this.paths = [];
for (var file in zip.files) {
this.fileObject = {
- name: zip.files[file].name,
+ // name: zip.files[file].name,
+ // name: this.uploadedFileName + '/' + zip.files[file].name,
+ name: this.uploadedFileName + zip.files[file].name,
data: ''
};
const value = <any>await zip.files[file].async('string');
@@ -425,6 +431,7 @@ export class EditorComponent implements OnInit {
if (this.validfile) {
this.fetchTOSACAMetadata();
+ this.filesData = this.paths;
this.tree = this.arrangeTreeData(this.paths);
} else {
alert('Please update proper file with TOSCA metadata');
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
index 63c8019c3..ec2524422 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
@@ -24,7 +24,6 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, observable } from 'rxjs';
import { ApiService } from '../../../../common/core/services/api.service';
-import { LoopbackConfig } from '../../../../common/constants/app-constants';
import { saveAs } from 'file-saver';
@Injectable()
@@ -35,10 +34,10 @@ export class EditorService {
}
enrich(uri: string, body: FormData): Observable<any> {
- return this.api.post(LoopbackConfig.url + uri, body, { responseType: 'blob' });
+ return this.api.post(uri, body, { responseType: 'blob' });
}
downloadCBA(uri: string): string {
- this.api.get(LoopbackConfig.url + uri, { responseType: 'blob' })
+ this.api.get(uri, { responseType: 'blob' })
.subscribe(response => {
let blob = new Blob([response], { 'type': "application/octet-stream" });
saveAs(blob, "CBA.zip");
@@ -49,11 +48,11 @@ export class EditorService {
}
post(uri: string, body: any | null, options?: any): Observable<any> {
- return this.api.post(LoopbackConfig.url + uri, body, options);
+ return this.api.post(uri, body, options);
}
deployPost(uri: string, body: any | null, options?: any): Observable<any> {
- return this.api.post(LoopbackConfig.url + uri, body, { responseType: 'text' });
+ return this.api.post(uri, body, { responseType: 'text' });
}
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
index 9c11f7684..1d0ba2c39 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
@@ -78,7 +78,8 @@ export class SearchTemplateComponent implements OnInit {
blueprint: data,
name: this.blueprintName,
files: this.tree,
- filesData: this.paths
+ filesData: this.paths,
+ uploadedFileName: this.uploadedFileName
}
this.store.dispatch(new SetBlueprintState(blueprintState))
// this.store.dispatch(new LoadBlueprintSuccess(data));
@@ -87,7 +88,9 @@ export class SearchTemplateComponent implements OnInit {
async buildFileViewData(zip) {
this.validfile = false;
this.paths = [];
+ console.log(zip.files);
for (var file in zip.files) {
+ console.log("name: " +zip.files[file].name);
this.fileObject = {
// nameForUIDisplay: this.uploadedFileName + '/' + zip.files[file].name,
// name: zip.files[file].name,
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
index 8df8e78a6..3896265fe 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
@@ -24,7 +24,6 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, observable } from 'rxjs';
import { ApiService } from '../../../common/core/services/api.service';
-import { LoopbackConfig } from '../../../common/constants/app-constants';
@Injectable()
export class TestTemplateService {
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/exsisting-model.service.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/exsisting-model.service.ts
index 7c3bf5465..a4177c176 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/exsisting-model.service.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/exsisting-model.service.ts
@@ -24,7 +24,7 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, observable } from 'rxjs';
import { ApiService } from '../../../../common/core/services/api.service';
-import { LoopbackConfig, ResourceDictionaryURLs } from '../../../../common/constants/app-constants';
+import { ResourceDictionaryURLs } from '../../../../common/constants/app-constants';
@Injectable()
export class ExsistingModelService {
@@ -34,6 +34,6 @@ export class ExsistingModelService {
}
searchByTags(tag) {
- return this.api.get(LoopbackConfig.url+ ResourceDictionaryURLs.searchResourceDictionaryByTags + '/' + tag);
+ return this.api.get(ResourceDictionaryURLs.searchResourceDictionaryByTags + '/' + tag);
}
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
index afb2b9d55..548128d4a 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss
index 50a386aa4..c36bc2f42 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.spec.ts
index 77d9c6819..bb64c6aed 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.spec.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.spec.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.ts
index 549fbb7ea..65c285e33 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition-routing.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition-routing.module.ts
index 2f0b3fe30..5007a1548 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition-routing.module.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition-routing.module.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.html
index 60a8b94ec..826e3142a 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.html
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss
index 328adcf71..f8f2af13a 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.spec.ts
index 72d72dd02..fd34b1618 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.spec.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.spec.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.ts
index c2f3dad7f..f7f938831 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts
index 0e056530d..971e12c9e 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
index 982d71d58..bd06abbc1 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
@@ -24,7 +24,7 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, observable } from 'rxjs';
import { ApiService } from '../../../common/core/services/api.service';
-import { LoopbackConfig, ResourceDictionaryURLs } from '../../../common/constants/app-constants';
+import { ResourceDictionaryURLs } from '../../../common/constants/app-constants';
@Injectable()
export class ResourceEditService {
@@ -34,6 +34,6 @@ export class ResourceEditService {
}
saveResource(resource) {
- return this.api.post(LoopbackConfig.url+ ResourceDictionaryURLs.saveResourceDictionary, resource);
+ return this.api.post(ResourceDictionaryURLs.saveResourceDictionary, resource);
}
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.spec.ts
index f157ca58f..55be36e2a 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.spec.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.spec.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
index 29244f0fb..6762f7c26 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
index 91a22b8b4..b1474d2a2 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss
index 5bec796e8..d4cb7ddfd 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts
index 4a94fed93..cdebf8d32 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
index 517add87b..52b19f728 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
@@ -3,6 +3,8 @@
* ONAP : CDS
* ================================================================================
* Copyright (C) 2019 TechMahindra
+*
+* Modifications Copyright (C) 2019 IBM
*=================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/cds-ui/pom.xml b/cds-ui/pom.xml
index a6cd085dc..e4c545e27 100644
--- a/cds-ui/pom.xml
+++ b/cds-ui/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START==========================================
===================================================================
@@ -17,21 +18,19 @@ 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============================================ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<relativePath/>
</parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ui</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cds-ui-parent</name>
@@ -52,4 +51,4 @@ limitations under the License.
<module>application</module>
</modules>
-</project> \ No newline at end of file
+</project>
diff --git a/cds-ui/server/config/app-config.ts b/cds-ui/server/config/app-config.ts
new file mode 100644
index 000000000..80f246427
--- /dev/null
+++ b/cds-ui/server/config/app-config.ts
@@ -0,0 +1,9 @@
+export const controllerApiConfig = Object.freeze({
+ url: process.env.API_BLUEPRINT_CONTROLLER_BASE_URL || "http://localhost:8080/api/v1",
+ authToken: process.env.API_BLUEPRINT_CONTROLLER_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
+});
+
+export const processorApiConfig = Object.freeze({
+ url: process.env.API_BLUEPRINT_PROCESSOR_BASE_URL || "http://localhost:8081/api/v1",
+ authToken: process.env.API_BLUEPRINT_PROCESSOR_AUTH_TOKEN || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=="
+}); \ No newline at end of file
diff --git a/cds-ui/server/pom.xml b/cds-ui/server/pom.xml
index 1c05d5521..ae9b1b293 100644
--- a/cds-ui/server/pom.xml
+++ b/cds-ui/server/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
============LICENSE_START==========================================
===================================================================
@@ -17,20 +18,18 @@ 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============================================ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ui</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ui-server</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cds-ui-server</name>
diff --git a/cds-ui/server/src/controllers/blueprint-rest.controller.ts b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
index 38abad80c..877fa02bb 100644
--- a/cds-ui/server/src/controllers/blueprint-rest.controller.ts
+++ b/cds-ui/server/src/controllers/blueprint-rest.controller.ts
@@ -48,11 +48,7 @@ import { BlueprintService } from '../services';
import * as fs from 'fs';
import * as multiparty from 'multiparty';
import * as request_lib from 'request';
-
-const REST_BLUEPRINT_CONTROLLER_BASE_URL = process.env.REST_BLUEPRINT_CONTROLLER_BASE_URL || "http://localhost:8080/api/v1";
-const REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER = process.env.REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==";
-const REST_BLUEPRINT_PROCESSOR_BASE_URL= process.env.REST_BLUEPRINT_PROCESSOR_BASE_URL ||"http://localhost:8081/api/v1";
-const MULTIPART_FORM_UPLOAD_DIR = process.env.MULTIPART_FORM_UPLOAD_DIR || "/tmp";
+import {controllerApiConfig, processorApiConfig} from '../../config/app-config';
export class BlueprintRestController {
constructor(
@@ -69,7 +65,7 @@ export class BlueprintRestController {
},
})
async getall() {
- return await this.bpservice.getAllblueprints(REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER);
+ return await this.bpservice.getAllblueprints();
}
@post('/create-blueprint')
@@ -90,7 +86,7 @@ export class BlueprintRestController {
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file=>{
- this.uploadFileToBlueprintController(file, REST_BLUEPRINT_CONTROLLER_BASE_URL+"/blueprint-model/", response).then(resp=>{
+ this.uploadFileToBlueprintController(file, "/blueprint-model/", response).then(resp=>{
resolve(resp);
}, err=>{
reject(err);
@@ -100,6 +96,7 @@ export class BlueprintRestController {
});
});
}
+
@post('/publish')
async publish(
@requestBody({
@@ -118,7 +115,7 @@ export class BlueprintRestController {
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file=>{
- this.uploadFileToBlueprintController(file, REST_BLUEPRINT_CONTROLLER_BASE_URL+"/blueprint-model/publish/", response).then(resp=>{
+ this.uploadFileToBlueprintController(file, "/blueprint-model/publish/", response).then(resp=>{
resolve(resp);
}, err=>{
reject(err);
@@ -128,6 +125,7 @@ export class BlueprintRestController {
});
});
}
+
@post('/enrich-blueprint')
async enrich(
@requestBody({
@@ -146,7 +144,7 @@ export class BlueprintRestController {
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file=>{
- this.uploadFileToBlueprintController(file, REST_BLUEPRINT_CONTROLLER_BASE_URL+"/blueprint-model/enrich/", response).then(resp=>{
+ this.uploadFileToBlueprintController(file, "/blueprint-model/enrich/", response).then(resp=>{
resolve(resp);
}, err=>{
reject(err);
@@ -163,7 +161,7 @@ export class BlueprintRestController {
@param.path.string('version') version:string,
@inject(RestBindings.Http.RESPONSE) response: Response,
): Promise<Response> {
- return this.downloadFileFromBlueprintController(REST_BLUEPRINT_CONTROLLER_BASE_URL+"/blueprint-model/download/by-name/"+name+"/version/"+version, response);
+ return this.downloadFileFromBlueprintController("/blueprint-model/download/by-name/"+name+"/version/"+version, response);
}
async getFileFromMultiPartForm(request: Request): Promise<multiparty.File>{
@@ -199,7 +197,7 @@ export class BlueprintRestController {
): Promise<Response> {
return new Promise((resolve, reject) => {
this.getFileFromMultiPartForm(request).then(file=>{
- this.uploadFileToBlueprintController(file, REST_BLUEPRINT_PROCESSOR_BASE_URL+"/execution-service/upload/", response).then(resp=>{
+ this.uploadFileToBlueprintProcessor(file, "/execution-service/upload/", response).then(resp=>{
resolve(resp);
}, err=>{
reject(err);
@@ -209,12 +207,20 @@ export class BlueprintRestController {
});
});
}
+
async uploadFileToBlueprintController(file: multiparty.File, uri: string, response: Response): Promise<Response>{
+ return this.uploadFileToBlueprintService(file, controllerApiConfig.url + uri, controllerApiConfig.authToken, response);
+ }
+
+ async uploadFileToBlueprintProcessor(file: multiparty.File, uri: string, response: Response): Promise<Response>{
+ return this.uploadFileToBlueprintService(file, processorApiConfig.url + uri, processorApiConfig.authToken, response);
+ }
+
+ async uploadFileToBlueprintService(file: multiparty.File, url: string, authToken: string, response: Response): Promise<Response>{
let options = {
- // url: REST_BLUEPRINT_CONTROLLER_BASE_URL + uri,
- url:uri,
+ url: url,
headers: {
- Authorization: REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER,
+ Authorization: authToken,
'content-type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
},
formData: {
@@ -248,12 +254,16 @@ export class BlueprintRestController {
});
})
}
+
async downloadFileFromBlueprintController(uri: string, response: Response): Promise<Response> {
+ return this.downloadFileFromBlueprintService(controllerApiConfig.url + uri, controllerApiConfig.authToken, response);
+ }
+
+ async downloadFileFromBlueprintService(url: string, authToken: string, response: Response): Promise<Response> {
let options = {
- url: uri,
- // REST_BLUEPRINT_CONTROLLER_BASE_URL + uri,
+ url: url,
headers: {
- Authorization: REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER,
+ Authorization: authToken,
}
};
return new Promise((resolve, reject) => {
diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts
index d535e27b2..486c28658 100644
--- a/cds-ui/server/src/controllers/data-dictionary.controller.ts
+++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts
@@ -18,7 +18,6 @@ import {
import { inject } from '@loopback/core';
import { ResourceDictionaryService } from '../services';
-const REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER = process.env.REST_BLUEPRINT_CONTROLLER_BASIC_AUTH_HEADER || "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==";
export class DataDictionaryController {
constructor(
@inject('services.ResourceDictionaryService')
@@ -33,8 +32,9 @@ export class DataDictionaryController {
},
})
async getByName(@param.path.string('name') name: string) {
- return await this.rdservice.getByName(name, REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER);
+ return await this.rdservice.getByName(name);
}
+
@get('/resourcedictionary/search/{tags}', {
responses: {
'200': {
@@ -43,7 +43,7 @@ export class DataDictionaryController {
},
})
async getByTags(@param.path.string('tags') tags: string) {
- return await this.rdservice.getByTags(tags, REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER);
+ return await this.rdservice.getByTags(tags);
}
@get('/resourcedictionary/source-mapping', {
@@ -54,8 +54,9 @@ export class DataDictionaryController {
},
})
async getSourceMapping() {
- return await this.rdservice.getSourceMapping(REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER);
+ return await this.rdservice.getSourceMapping();
}
+
@post('/resourcedictionary/save', {
responses: {
'200': {
@@ -67,8 +68,9 @@ export class DataDictionaryController {
content: { 'application/json': { schema: { 'x-ts-type': JSON } } },
accepts: { 'application/json': { schema: { 'x-ts-type': JSON } } }
}) resourceDictionary: JSON): Promise<any> {
- return await this.rdservice.save(REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER, resourceDictionary);
+ return await this.rdservice.save(resourceDictionary);
}
+
@post('/resourcedictionary/search/by-names', {
responses: {
'200': {
@@ -80,6 +82,6 @@ export class DataDictionaryController {
content: { 'application/json': { schema: { 'x-ts-type': JSON } } },
accepts: { 'application/json': { schema: { 'x-ts-type': JSON } } }
}) resourceDictionaryList: JSON): Promise<any> {
- return await this.rdservice.searchbyNames(REST_RESOURCE_DICTIONARY_BASIC_AUTH_HEADER, resourceDictionaryList);
+ return await this.rdservice.searchbyNames(resourceDictionaryList);
}
}
diff --git a/cds-ui/server/src/datasources/blueprint.datasource.json b/cds-ui/server/src/datasources/blueprint.datasource-template.ts
index 86b1c2c15..3cbf09576 100644
--- a/cds-ui/server/src/datasources/blueprint.datasource.json
+++ b/cds-ui/server/src/datasources/blueprint.datasource-template.ts
@@ -1,22 +1,24 @@
-{
+import {controllerApiConfig} from '../../config/app-config';
+
+export default {
"name": "blueprint",
"connector": "rest",
- "baseURL": "http://localhost:8080/api/v1/",
+ "baseURL": controllerApiConfig.url,
"crud": false,
"operations": [{
"template": {
"method": "GET",
- "url": "http://localhost:8080/api/v1/blueprint-model/",
+ "url": controllerApiConfig.url + "/blueprint-model/",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": "{authtoken}"
+ "authorization": controllerApiConfig.authToken
},
"responsePath": "$.*"
},
"functions": {
- "getAllblueprints": ["authtoken"]
+ "getAllblueprints": []
}
}]
-} \ No newline at end of file
+}; \ No newline at end of file
diff --git a/cds-ui/server/src/datasources/blueprint.datasource.ts b/cds-ui/server/src/datasources/blueprint.datasource.ts
index 008612693..ce901b6d7 100644
--- a/cds-ui/server/src/datasources/blueprint.datasource.ts
+++ b/cds-ui/server/src/datasources/blueprint.datasource.ts
@@ -1,6 +1,6 @@
import {inject} from '@loopback/core';
import {juggler} from '@loopback/repository';
-import * as config from './blueprint.datasource.json';
+import config from './blueprint.datasource-template';
export class BlueprintDataSource extends juggler.DataSource {
static dataSourceName = 'blueprint';
diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource.json b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
index 9bf5f30c4..b987e588c 100644
--- a/cds-ui/server/src/datasources/resource-dictionary.datasource.json
+++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
@@ -1,89 +1,91 @@
-{
+import {controllerApiConfig} from '../../config/app-config';
+
+export default {
"name": "resourceDictionary",
"connector": "rest",
- "baseURL": "http://localhost:8080/api/v1/dictionary",
+ "baseURL": controllerApiConfig.url + "/dictionary",
"crud": false,
"operations": [{
"template": {
"method": "GET",
- "url": "http://localhost:8080/api/v1/dictionary/{name}",
+ "url": controllerApiConfig.url + "/dictionary/{name}",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": "{authtoken}"
+ "authorization": controllerApiConfig.authToken
},
"responsePath": "$.*"
},
"functions": {
- "getByName": ["name", "authtoken"]
+ "getByName": ["name"]
}
},
{
"template": {
"method": "GET",
- "url": "http://localhost:8080/api/v1/dictionary/source-mapping",
+ "url": controllerApiConfig.url + "/dictionary/source-mapping",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": "{authtoken}"
+ "authorization": controllerApiConfig.authToken
},
"responsePath": "$.*"
},
"functions": {
- "getSourceMapping": ["authtoken"]
+ "getSourceMapping": []
}
},
{
"template": {
"method": "GET",
- "url": "http://localhost:8080/api/v1/dictionary/search/{tags}",
+ "url": controllerApiConfig.url + "/dictionary/search/{tags}",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": "{authtoken}"
+ "authorization": controllerApiConfig.authToken
},
"responsePath": "$.*"
},
"functions": {
- "getByTags": ["tags", "authtoken"]
+ "getByTags": ["tags"]
}
},
{
"template": {
"method": "POST",
- "url": "http://localhost:8080/api/v1/dictionary",
+ "url": controllerApiConfig.url + "/dictionary",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": "{authtoken}"
+ "authorization": controllerApiConfig.authToken
},
"body": "{resourceDictionary}",
"responsePath": "$.*"
},
"functions": {
- "save": ["authtoken", "resourceDictionary"]
+ "save": ["resourceDictionary"]
}
},
{
"template": {
"method": "POST",
- "url": "http://localhost:8080/api/v1/dictionary/by-names",
+ "url": controllerApiConfig.url + "/dictionary/by-names",
"headers": {
"accepts": "application/json",
"content-type": "application/json",
- "authorization": "{authtoken}"
+ "authorization": controllerApiConfig.authToken
},
"body": "{resourceDictionaryList}",
"responsePath": "$.*"
},
"functions": {
- "searchbyNames": ["authtoken", "resourceDictionaryList"]
+ "searchbyNames": ["resourceDictionaryList"]
}
}
]
-} \ No newline at end of file
+}; \ No newline at end of file
diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource.ts
index 381ab9a78..ba12c78e2 100644
--- a/cds-ui/server/src/datasources/resource-dictionary.datasource.ts
+++ b/cds-ui/server/src/datasources/resource-dictionary.datasource.ts
@@ -1,6 +1,6 @@
import {inject} from '@loopback/core';
import {juggler} from '@loopback/repository';
-import * as config from './resource-dictionary.datasource.json';
+import config from './resource-dictionary.datasource-template';
export class ResourceDictionaryDataSource extends juggler.DataSource {
static dataSourceName = 'resourceDictionary';
diff --git a/cds-ui/server/src/services/blueprint.service.ts b/cds-ui/server/src/services/blueprint.service.ts
index f48253652..970b2afda 100644
--- a/cds-ui/server/src/services/blueprint.service.ts
+++ b/cds-ui/server/src/services/blueprint.service.ts
@@ -3,7 +3,7 @@ import {inject, Provider} from '@loopback/core';
import {BlueprintDataSource} from '../datasources';
export interface BlueprintService {
- getAllblueprints(authtoken: string): Promise<any>;
+ getAllblueprints(): Promise<any>;
}
export class BlueprintServiceProvider implements Provider<BlueprintService> {
diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts
index 44ba1a347..8bc61fad1 100644
--- a/cds-ui/server/src/services/resource-dictionary.service.ts
+++ b/cds-ui/server/src/services/resource-dictionary.service.ts
@@ -3,11 +3,11 @@ import {inject, Provider} from '@loopback/core';
import {ResourceDictionaryDataSource} from '../datasources';
export interface ResourceDictionaryService {
- getByName(name: string, authtoken: string): Promise<JSON>;
- getSourceMapping(authtoken: string): Promise<JSON>;
- getByTags(tags: string, authtoken: string): Promise<JSON>;
- save(authtoken: string, resourceDictionary: JSON): Promise<JSON>;
- searchbyNames(authtoken: string, resourceDictionaryList: JSON): Promise<JSON>;
+ getByName(name: string): Promise<JSON>;
+ getSourceMapping(): Promise<JSON>;
+ getByTags(tags: string): Promise<JSON>;
+ save(resourceDictionary: JSON): Promise<JSON>;
+ searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
}
export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {
diff --git a/components/model-catalog/proto-definition/pom.xml b/components/model-catalog/proto-definition/pom.xml
index 89590ef8d..baa6cc9ec 100644
--- a/components/model-catalog/proto-definition/pom.xml
+++ b/components/model-catalog/proto-definition/pom.xml
@@ -20,13 +20,13 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>
<groupId>org.onap.ccsdk.cds.components</groupId>
<artifactId>proto-definition</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Controller Blueprints Proto Definition</name>
diff --git a/components/parent/pom.xml b/components/parent/pom.xml
index d6b40d74a..0ecf94af1 100644
--- a/components/parent/pom.xml
+++ b/components/parent/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>components</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.components</groupId>
<artifactId>parent</artifactId>
diff --git a/components/pom.xml b/components/pom.xml
index 510467c81..8766401cf 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>components</artifactId>
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index c079ba990..a5d45277d 100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>application</artifactId>
diff --git a/ms/blueprintsprocessor/distribution/pom.xml b/ms/blueprintsprocessor/distribution/pom.xml
index 0a9e4a93e..91ead8d90 100755
--- a/ms/blueprintsprocessor/distribution/pom.xml
+++ b/ms/blueprintsprocessor/distribution/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>distribution</artifactId>
diff --git a/ms/blueprintsprocessor/functions/cli-executor/pom.xml b/ms/blueprintsprocessor/functions/cli-executor/pom.xml
index 77c45e76e..af76d128b 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/cli-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cli-executor</artifactId>
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
index 16ec6fbc1..a46e7433d 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/netconf-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>functions</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
diff --git a/ms/blueprintsprocessor/functions/pom.xml b/ms/blueprintsprocessor/functions/pom.xml
index 3f948061f..a635c9f4c 100755
--- a/ms/blueprintsprocessor/functions/pom.xml
+++ b/ms/blueprintsprocessor/functions/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/functions/python-executor/pom.xml b/ms/blueprintsprocessor/functions/python-executor/pom.xml
index af9d1987a..8e098bfef 100644
--- a/ms/blueprintsprocessor/functions/python-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/python-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index 0c5a947f1..896d9a648 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -17,14 +17,22 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.runBlocking
import org.junit.Test
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.PrepareRemoteEnvInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionOutput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StatusType
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.RemoteScriptExecutionService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.putJsonElement
+import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import kotlin.test.assertEquals
@@ -58,7 +66,117 @@ class ComponentRemotePythonExecutorTest {
executionServiceInput.stepData = stepInputData
componentRemotePythonExecutor.applyNB(executionServiceInput)
}
+ }
+
+ /**
+ * Test cases for python executor to work with the process NB of remote
+ * executor.
+ */
+ @Test
+ fun testComponentRemotePythonExecutorProcessNB() {
+ runBlocking {
+ val remoteScriptExecutionService =
+ MockRemoteScriptExecutionService()
+ val componentRemotePythonExecutor = ComponentRemotePythonExecutor(
+ remoteScriptExecutionService)
+ val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>(
+ "123456-1000")
+ val input = getMockedOutput(bluePrintRuntime)
+ componentRemotePythonExecutor.bluePrintRuntimeService =
+ bluePrintRuntime
+ componentRemotePythonExecutor.applyNB(input)
+ }
+ }
+
+ /**
+ * Mocked input information for remote python executor.
+ */
+ fun getMockedOutput(svc: DefaultBluePrintRuntimeService):
+ ExecutionServiceInput {
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
+
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python")
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor")
+ stepMetaData.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
+ val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python")
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor")
+ operationalInputs.putJsonElement(
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ operationalInputs.putJsonElement("endpoint-selector", "aai")
+ operationalInputs.putJsonElement("dynamic-properties", rootNode)
+ operationalInputs.putJsonElement("command", "./run.sh")
+ operationalInputs.putJsonElement("packages", "py")
+
+ every {
+ svc.resolveNodeTemplateInterfaceOperationInputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process")
+ } returns operationalInputs
+
+ val stepInputData = StepData().apply {
+ name = "execute-remote-python"
+ properties = stepMetaData
+ }
+ val executionServiceInput = JacksonUtils
+ .readValueFromClassPathFile(
+ "payload/requests/sample-remote-python-request.json",
+ ExecutionServiceInput::class.java)!!
+ executionServiceInput.stepData = stepInputData
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ svc.resolveNodeTemplateInterfaceOperationOutputs(
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process")
+ } returns operationOutputs
+ val bluePrintRuntimeService = BluePrintMetadataUtils
+ .getBluePrintRuntime("123456-1000",
+ "./../../../../components/model-" +
+ "catalog/blueprint-model/test-blueprint/" +
+ "remote_scripts")
+ every {
+ svc.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script")
+ } returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
+ "execute-remote-python", "component-script")
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive())
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive())
+ } returns Unit
+ every {
+ svc.setNodeTemplateAttributeValue(
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive())
+ } returns Unit
+
+ every {
+ svc.bluePrintContext()
+ } returns bluePrintRuntimeService.bluePrintContext()
+ return executionServiceInput
}
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json
new file mode 100644
index 000000000..68a366432
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json
@@ -0,0 +1,23 @@
+{
+ "actionIdentifiers": {
+ "actionName": "activate",
+ "blueprintName": "remote_scripts",
+ "blueprintVersion": "1.0.0",
+ "mode": "sync"
+ },
+ "commonHeader": {
+ "flags": {
+ "force": true,
+ "ttl": 3600
+ },
+ "originatorId": "sdnc",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "timestamp": "2012-04-23T18:25:43.511Z"
+ },
+ "payload": {
+ "execute-remote-python": {
+ "input": "1234"
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
index b4bbd50f9..3666b4109 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
+++ b/ms/blueprintsprocessor/functions/resource-resolution/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>functions</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
<artifactId>resource-resolution</artifactId>
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/pom.xml b/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
index ef2f8bbb6..47a7af7ea 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/restconf-executor/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>functions</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
index faf5578c9..df66ff391 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>db-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
index 5f302993a..3261489ee 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>dmaap-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
index e50b1915f..c7933a7ff 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
@@ -14,14 +14,11 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>commons</artifactId>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -45,4 +42,4 @@
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
index a459d5fe2..8df218fe9 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
@@ -16,17 +16,22 @@
package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
import org.onap.ccsdk.cds.blueprintsprocessor.core.BlueprintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BasicAuthGrpcClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BluePrintGrpcLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
+import kotlin.test.assertEquals
import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [BluePrintGrpcLibConfiguration::class,
@@ -36,21 +41,92 @@ import kotlin.test.assertNotNull
"blueprintsprocessor.grpcclient.sample.host=127.0.0.1",
"blueprintsprocessor.grpcclient.sample.port=50505",
"blueprintsprocessor.grpcclient.sample.username=sampleuser",
- "blueprintsprocessor.grpcclient.sample.password=sampleuser"
+ "blueprintsprocessor.grpcclient.sample.password=sampleuser",
+ "blueprintsprocessor.grpcclient.token.type=token-auth",
+ "blueprintsprocessor.grpcclient.token.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.token.port=50505",
+ "blueprintsprocessor.grpcclient.token.username=sampleuser",
+ "blueprintsprocessor.grpcclient.token.password=sampleuser"
])
class BluePrintGrpcLibPropertyServiceTest {
@Autowired
lateinit var bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService
+ /**
+ * Tests the GRPC client properties with selector for basic auth.
+ */
@Test
fun testGrpcClientProperties() {
val properties = bluePrintGrpcLibPropertyService.grpcClientProperties(
- "blueprintsprocessor.grpcclient.sample") as BasicAuthGrpcClientProperties
+ "blueprintsprocessor.grpcclient.sample")
+ as BasicAuthGrpcClientProperties
assertNotNull(properties, "failed to create property bean")
- assertNotNull(properties.host, "failed to get host property in property bean")
- assertNotNull(properties.port, "failed to get host property in property bean")
- assertNotNull(properties.username, "failed to get host property in property bean")
- assertNotNull(properties.password, "failed to get host property in property bean")
+ assertNotNull(properties.host, "failed to get host property" +
+ " in property bean")
+ assertNotNull(properties.port, "failed to get host property" +
+ " in property bean")
+ assertNotNull(properties.username, "failed to get host pro" +
+ "perty in property bean")
+ assertNotNull(properties.password, "failed to get host pr" +
+ "operty in property bean")
+ }
+
+ /**
+ * Tests the GRPC client properties with JSON node for token auth.
+ */
+ @Test
+ fun testGrpcClientPropertiesWithJson() {
+ val json: String = "{\n" +
+ " \"type\" : \"token-auth\",\n" +
+ " \"host\" : \"127.0.0.1\",\n" +
+ " \"port\" : \"50505\"\n" +
+ "}"
+ val mapper = ObjectMapper()
+ val actualObj: JsonNode = mapper.readTree(json)
+ val properties = bluePrintGrpcLibPropertyService.grpcClientProperties(
+ actualObj) as TokenAuthGrpcClientProperties
+ assertNotNull(properties, "failed to create property bean")
+ assertEquals(properties.host, "127.0.0.1")
+ assertNotNull(properties.port, "50505")
+ }
+
+ /**
+ * Tests the GRPC client service with selector for basic auth.
+ */
+ @Test
+ fun testGrpcClientServiceBasic() {
+ val svc = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(
+ "sample")
+ assertTrue(svc is BasicAuthGrpcClientService)
+ }
+
+ /**
+ * Tests the GRPC client service with selector for token auth.
+ */
+ @Test
+ fun testGrpcClientServiceToken() {
+ val svc = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(
+ "token")
+ assertTrue(svc is TokenAuthGrpcClientService)
+ }
+
+ /**
+ * Tests the GRPC client service with JSON node for basic auth.
+ */
+ @Test
+ fun testGrpcClientServiceWithJson() {
+ val json: String = "{\n" +
+ " \"type\" : \"basic-auth\",\n" +
+ " \"host\" : \"127.0.0.1\",\n" +
+ " \"port\" : \"50505\",\n" +
+ " \"username\" : \"sampleuser\",\n" +
+ " \"password\" : \"samplepwd\"\n" +
+ "}"
+ val mapper = ObjectMapper()
+ val actualObj: JsonNode = mapper.readTree(json)
+ val svc = bluePrintGrpcLibPropertyService
+ .blueprintGrpcClientService(actualObj)
+ assertTrue(svc is BasicAuthGrpcClientService)
}
} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml
index 9b52565c1..5fdfb5064 100755
--- a/ms/blueprintsprocessor/modules/commons/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>commons</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
index 93a9b793a..31feff177 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>processor-core</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
index 6809e7968..0cae94690 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>commons</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>rest-lib</artifactId>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
index a85dc9ad7..37a797f78 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
@@ -20,7 +20,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintProperties
@@ -63,7 +62,6 @@ import kotlin.test.assertNotNull
"blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
"blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
])
-@Ignore
class BluePrintRestLibPropertyServiceTest {
@Autowired
@@ -215,5 +213,25 @@ class BluePrintRestLibPropertyServiceTest {
"eprintWebClientService")
}
+ @Test
+ fun testBlueprintWebClientServiceWithJsonNode() {
+ val json: String = "{\n" +
+ " \"type\" : \"ssl-basic-auth\",\n" +
+ " \"url\" : \"https://localhost:8443\",\n" +
+ " \"keyStoreInstance\" : \"PKCS12\",\n" +
+ " \"sslTrust\" : \"src/test/resources/keystore.p12\",\n" +
+ " \"sslTrustPassword\" : \"changeit\",\n" +
+ " \"basicAuth\" : {\n" +
+ " \"username\" : \"admin\",\n" +
+ " \"password\" : \"cds\"\n" +
+ " }\n" +
+ "}"
+ val mapper = ObjectMapper()
+ val actualObj: JsonNode = mapper.readTree(json)
+ val blueprintWebClientService = bluePrintRestLibPropertyService
+ .blueprintWebClientService(actualObj)
+ assertNotNull(blueprintWebClientService, "failed to create blu" +
+ "eprintWebClientService")
+ }
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml
index c8f6b9e42..17b630fdd 100644
--- a/ms/blueprintsprocessor/modules/inbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>inbounds</artifactId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
index 4d5857651..d5acf4f93 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>resource-api</artifactId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index d3f8b4616..340f2c618 100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>inbounds</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>selfservice-api</artifactId>
diff --git a/ms/blueprintsprocessor/modules/outbounds/pom.xml b/ms/blueprintsprocessor/modules/outbounds/pom.xml
index d406462db..7512990c1 100644
--- a/ms/blueprintsprocessor/modules/outbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/outbounds/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>outbounds</artifactId>
diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml
index c67c97882..3bdd13d58 100644
--- a/ms/blueprintsprocessor/modules/pom.xml
+++ b/ms/blueprintsprocessor/modules/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
index d366f740d..edfa4e3f7 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>services</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>execution-service</artifactId>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
index c5fbea80f..b404fbed6 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
@@ -21,6 +21,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts;
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.node.ObjectNode
import io.mockk.every
import io.mockk.mockk
@@ -32,12 +33,16 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.scripts.BluePrintScriptsServiceImpl
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.BeforeTest
import kotlin.test.assertEquals
@@ -47,10 +52,16 @@ import kotlin.test.assertNotNull
* Unit test cases for abstract component function.
*/
@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [ComponentFunctionScriptingService::class,
+ BluePrintScriptsServiceImpl::class,PythonExecutorProperty::class,
+ BlueprintJythonService::class])
class AbstractComponentFunctionTest {
lateinit var blueprintContext: BluePrintContext
+ @Autowired
+ lateinit var compSvc: ComponentFunctionScriptingService
+
@BeforeTest
fun init() {
blueprintContext = mockk<BluePrintContext>()
@@ -82,12 +93,56 @@ class AbstractComponentFunctionTest {
}
}
+ /**
+ * Tests the abstract script component functionality.
+ */
+ @Test
+ fun testAbstractScriptComponent() {
+ runBlocking {
+ val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
+ val samp = SampleRestconfComponent(compSvc)
+ val comp = samp as AbstractComponentFunction
+
+ comp.bluePrintRuntimeService = bluePrintRuntime
+ comp.stepName = "sample-step"
+ assertNotNull(comp, "failed to get kotlin instance")
+
+ val input = getMockedInput(bluePrintRuntime)
+ val inp = getMockedContext()
+
+ val output = comp.applyNB(input)
+
+ assertEquals(output.actionIdentifiers.actionName, "activate")
+ assertEquals(output.commonHeader.requestId, "1234")
+ assertEquals(output.stepData!!.name, "activate-restconf")
+ assertEquals(output.status.message, "success")
+ }
+ }
+
+ /**
+ * Mocked input for abstract function test.
+ */
+ private fun getMockedContext() {
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ blueprintContext.name()
+ } returns "SampleTest"
+ every {
+ blueprintContext.version()
+ } returns "SampleScriptComponent"
+ }
/**
* Mocked input for abstract function test.
*/
private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService):
ExecutionServiceInput {
+
+ val mapper = ObjectMapper()
+ val rootNode = mapper.createObjectNode()
+ rootNode.put("ip-address", "0.0.0.0")
+ rootNode.put("type", "rest")
+
val operationInputs = hashMapOf<String, JsonNode>()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
"activate-restconf".asJsonPrimitive()
@@ -95,6 +150,8 @@ class AbstractComponentFunctionTest {
"interfaceName".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
"operationName".asJsonPrimitive()
+ operationInputs["dynamic-properties"] = rootNode
+
val stepInputData = StepData().apply {
name = "activate-restconf"
@@ -125,4 +182,6 @@ class AbstractComponentFunctionTest {
return executionServiceInput
}
+
}
+
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
index dd417e56d..ae7b7b2ef 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
@@ -28,8 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.assertNotNull
import kotlin.test.BeforeTest
+import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [BlueprintJythonService::class, PythonExecutorProperty::class])
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
index e09cbfb66..000d8c09b 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
@@ -23,6 +23,9 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
+
import org.slf4j.LoggerFactory
open class SampleComponent : AbstractComponentFunction() {
@@ -37,12 +40,34 @@ open class SampleComponent : AbstractComponentFunction() {
}
}
-open class SampleScriptComponent : AbstractComponentFunction() {
+open class SampleRestconfComponent (private var componentFunctionScriptingService: ComponentFunctionScriptingService)
+ : AbstractComponentFunction() {
val log = LoggerFactory.getLogger(SampleScriptComponent::class.java)!!
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ var scriptComponent: AbstractScriptComponentFunction
+ scriptComponent = componentFunctionScriptingService
+ .scriptInstance<AbstractScriptComponentFunction>(this,
+ "internal",
+ "org.onap.ccsdk.cds.blueprintsprocessor.services" +
+ ".execution.scripts.SampleTest",
+ mutableListOf())
+ scriptComponent.executeScript(executionServiceInput)
+ }
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ }
+}
+
+open class SampleScriptComponent : AbstractScriptComponentFunction() {
+
+ val log = LoggerFactory.getLogger(SampleScriptComponent::class.java)!!
+
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt
new file mode 100644
index 000000000..6a95e29e7
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt
@@ -0,0 +1,42 @@
+package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
+
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - CDS
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.
+ * ============LICENSE_END=========================================================
+ */
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
+import org.slf4j.LoggerFactory
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+open class SampleTest : AbstractScriptComponentFunction() {
+
+ val log = LoggerFactory.getLogger(SampleTest::class.java)!!
+
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ val isPresent = checkDynamicProperties("type")
+ assertTrue(isPresent)
+ val prop = getDynamicProperties("ip-address").toString()
+ assertEquals(prop, "\"0.0.0.0\"")
+ }
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml
index 751ad94d4..d2f1219e9 100755
--- a/ms/blueprintsprocessor/modules/services/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>services</artifactId>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
index c48ff250f..d7f87aeff 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>services</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index 42abbc51d..5f3e926f7 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -16,13 +16,12 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>blueprintsprocessor</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>parent</artifactId>
@@ -41,7 +40,6 @@
<jsch.version>0.1.55</jsch.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
- <sli.version>0.4.2-SNAPSHOT</sli.version>
<guava.version>27.0.1-jre</guava.version>
<jython.version>2.7.1</jython.version>
<springfox.swagger2.version>2.9.2</springfox.swagger2.version>
@@ -249,7 +247,7 @@
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-provider</artifactId>
- <version>${sli.version}</version>
+ <version>${ccsdk.sli.core.version}</version>
<exclusions>
<exclusion>
<groupId>commons-lang</groupId>
diff --git a/ms/blueprintsprocessor/pom.xml b/ms/blueprintsprocessor/pom.xml
index ffdb877e4..99d796972 100755
--- a/ms/blueprintsprocessor/pom.xml
+++ b/ms/blueprintsprocessor/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>blueprintsprocessor</artifactId>
diff --git a/ms/command-executor/pom.xml b/ms/command-executor/pom.xml
index 7376d7746..c4a679b12 100755
--- a/ms/command-executor/pom.xml
+++ b/ms/command-executor/pom.xml
@@ -14,13 +14,12 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>command-executor</artifactId>
diff --git a/ms/controllerblueprints/application/pom.xml b/ms/controllerblueprints/application/pom.xml
index ddefb2787..d1d6551ed 100644
--- a/ms/controllerblueprints/application/pom.xml
+++ b/ms/controllerblueprints/application/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>application</artifactId>
diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml
index 563b4eb40..6da578814 100755
--- a/ms/controllerblueprints/distribution/pom.xml
+++ b/ms/controllerblueprints/distribution/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>distribution</artifactId>
diff --git a/ms/controllerblueprints/modules/blueprint-core/pom.xml b/ms/controllerblueprints/modules/blueprint-core/pom.xml
index 524a42f17..9e22af637 100644
--- a/ms/controllerblueprints/modules/blueprint-core/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-core/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-core</artifactId>
<name>Controller Blueprints Core</name>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
new file mode 100644
index 000000000..e3e5c26a3
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
@@ -0,0 +1,33 @@
+package org.onap.ccsdk.cds.controllerblueprints.core
+
+import org.junit.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+class BluePrintErrorTest {
+
+ @Test
+ fun testBluePrintErrorIsCreatedWithemptyList() {
+ val bluePrintError = BluePrintError()
+
+ assertTrue(bluePrintError.errors.isEmpty())
+ }
+
+ @Test
+ fun testAddErrorWith3Params() {
+ val bluePrintError = BluePrintError()
+
+ bluePrintError.addError("type", "name", "error")
+
+ assertEquals("type : name : error", bluePrintError.errors[0])
+ }
+
+ @Test
+ fun testAddErrorWith1Params() {
+ val bluePrintError = BluePrintError()
+
+ bluePrintError.addError("error")
+
+ assertEquals("error", bluePrintError.errors[0])
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
index d5334dc5f..487b1d15b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
@@ -16,8 +16,12 @@
package org.onap.ccsdk.cds.controllerblueprints.core
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.node.*
import org.junit.Test
-import kotlin.test.assertEquals
+import kotlin.test.*
+
/**
*
*
@@ -25,11 +29,172 @@ import kotlin.test.assertEquals
*/
class CustomFunctionsTest {
@Test
- fun testFormat(): Unit {
+ fun testFormat() {
val returnValue : String = format("This is {} for times {}", "test", 2)
assertEquals("This is test for times 2", returnValue, "Failed to format String")
val returnValue1 : String = format("This is test for times 2")
assertEquals("This is test for times 2", returnValue1, "Failed to format empty args")
}
+
+ @Test
+ fun testStringAsJsonPrimitive() {
+ val returnValue: TextNode = "hello".asJsonPrimitive()
+ assertEquals("hello", returnValue.textValue())
+ }
+
+ @Test
+ fun testIntAsJsonPrimitive() {
+ val returnValue: IntNode = 1.asJsonPrimitive()
+ assertEquals(1, returnValue.intValue())
+ }
+
+ @Test
+ fun testBooleanAsJsonPrimitive() {
+ val returnValue: BooleanNode = false.asJsonPrimitive()
+ assertFalse(returnValue.asBoolean())
+ }
+
+ @Test
+ fun testAsJsonType() {
+ val nullReturnValue: JsonNode = null.asJsonType()
+ assertEquals(NullNode.instance, nullReturnValue)
+
+ val returnValueString: JsonNode = "hello".asJsonType()
+ assertEquals("hello", returnValueString.textValue())
+
+ val returnValueJsonNode: JsonNode = returnValueString.asJsonType()
+ assertEquals(returnValueString, returnValueJsonNode)
+
+ val returnValueInt: JsonNode = 1.asJsonType()
+ assertEquals(1, returnValueInt.intValue())
+
+ val returnValueBool: JsonNode = false.asJsonType()
+ assertFalse(returnValueBool.asBoolean())
+
+ val returnValue: JsonNode = BluePrintError().asJsonType()
+ assertEquals(JsonNodeType.OBJECT, returnValue.getNodeType())
+ }
+
+ @Test
+ fun testMapAsObjectNode() {
+ val returnValue: ObjectNode = hashMapOf("test" to BluePrintError()).asObjectNode()
+ assertNotNull(returnValue.get("test"))
+ }
+
+ @Test
+ fun testCastOptionalValue() {
+ val initMap: Map<String, *> = hashMapOf("test" to 1.1, "test2" to null)
+ val returnValue = initMap.castOptionalValue("test", Number::class)
+
+ assert(returnValue is Number)
+
+ val returnValueNull = initMap.castOptionalValue("test1", Number::class)
+
+ assertNull(returnValueNull)
+
+ val returnValueString: String? = initMap.castOptionalValue("test2", String::class)
+
+ assertNull(returnValueString)
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testCastValue() {
+ val initMap: Map<String, Double> = hashMapOf("test" to 1.1)
+ val returnValue = initMap.castValue("test", Number::class)
+
+ assertNotNull(returnValue)
+
+ initMap.castValue("test1", Number::class)
+ }
+
+ @Test
+ fun testAsListOfString() {
+ val arrayNode: ArrayNode = ObjectMapper().createObjectNode().putArray("array")
+
+ val result: List<String> = arrayNode.asListOfString()
+
+ assertTrue(result.isEmpty())
+ }
+
+ @Test
+ fun testReturnNullIfMissing() {
+ val valueExist = "hello".asJsonType().returnNullIfMissing()
+ assertNotNull(valueExist)
+
+ val valueNull = NullNode.instance.returnNullIfMissing()
+ assertNull(valueNull)
+
+ val missingValue = MissingNode.getInstance().returnNullIfMissing()
+ assertNull(missingValue)
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testRootFieldsToMap() {
+ 1.asJsonType().rootFieldsToMap()
+ }
+
+ @Test
+ fun testPutJsonElement() {
+ val mutMap = mutableMapOf("test" to 2.asJsonType())
+
+ mutMap.putJsonElement("hello", 3)
+
+ assertEquals(3, mutMap["hello"]?.asInt())
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testMapGetAsString() {
+ val initMap = hashMapOf("test" to "hello".asJsonType())
+
+ assertEquals("hello", initMap.getAsString("test"))
+
+ initMap.getAsString("test2")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testMapGetAsBoolean() {
+ val initMap = hashMapOf("test" to true.asJsonType())
+
+ assertTrue(initMap.getAsBoolean("test"))
+
+ initMap.getAsBoolean("test2")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testMapGetAsInt() {
+ val initMap = hashMapOf("test" to 1.asJsonType())
+
+ assertEquals(1, initMap.getAsInt("test"))
+
+ initMap.getAsInt("test2")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testCheckEquals() {
+ assertTrue(checkEquals("hello", "hello", { -> "error"}))
+
+ checkEquals("hello", "test", { -> "error"})
+ }
+
+ @Test(expected = IllegalStateException::class)
+ fun testCheckNotEmpty() {
+ assertEquals("hello", checkNotEmpty("hello", { -> "error"}))
+
+ checkNotEmpty("", { -> "error"})
+ }
+
+ @Test(expected = IllegalStateException::class)
+ fun testCheckNotBlank() {
+ assertEquals("hello", checkNotBlank("hello", { -> "error"}))
+
+ checkNotBlank(" ", { -> "error"})
+ }
+
+ @Test
+ fun testNullToEmpty() {
+ assertEquals("", nullToEmpty(null))
+
+ assertEquals("hello", nullToEmpty("hello"))
+ }
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
index 2c6561f23..33890277f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
@@ -18,11 +18,18 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
+import com.fasterxml.jackson.databind.ObjectMapper
import org.slf4j.LoggerFactory
import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.data.*
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import kotlin.test.assertEquals
import kotlin.test.assertNotNull
+import kotlin.test.assertNull
+import kotlin.test.assertTrue
/**
*
@@ -49,5 +56,513 @@ class BluePrintContextTest {
log.trace("Properties {}", JacksonUtils.getJson(nodeType, true))
}
+ @Test
+ fun testImports() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.imports = mutableListOf()
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.imports()!!.isEmpty())
+
+ serviceTemplate.imports = null
+ assertNull(bluePrintContext.imports())
+ }
+
+ @Test
+ fun testDataTypes() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.dataTypes = mutableMapOf()
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.dataTypes()!!.isEmpty())
+
+ serviceTemplate.dataTypes = null
+ assertNull(bluePrintContext.dataTypes())
+ }
+
+ @Test
+ fun testInputs() {
+ val topologyTemplate = TopologyTemplate()
+ topologyTemplate.inputs = mutableMapOf()
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.inputs()!!.isEmpty())
+
+ topologyTemplate.inputs = null
+
+ assertNull(bluePrintContext.inputs())
+ }
+
+ @Test
+ fun testBluePrintJson() {
+ val serviceTemplate = ServiceTemplate()
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("{\"tosca_definitions_version\":\"controller_blueprint_1_0_0\"}", bluePrintContext.blueprintJson())
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testName() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.metadata = mutableMapOf(BluePrintConstants.METADATA_TEMPLATE_NAME to "hello")
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.name())
+
+ serviceTemplate.metadata = mutableMapOf()
+ val bluePrintContext2 = BluePrintContext(serviceTemplate)
+ bluePrintContext2.name()
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testVersion() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.metadata = mutableMapOf(BluePrintConstants.METADATA_TEMPLATE_VERSION to "hello")
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.version())
+
+ serviceTemplate.metadata = mutableMapOf()
+ val bluePrintContext2 = BluePrintContext(serviceTemplate)
+ bluePrintContext2.version()
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testAuthor() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.metadata = mutableMapOf(BluePrintConstants.METADATA_TEMPLATE_AUTHOR to "hello")
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.author())
+
+ serviceTemplate.metadata = mutableMapOf()
+ val bluePrintContext2 = BluePrintContext(serviceTemplate)
+ bluePrintContext2.author()
+ }
+
+ @Test
+ fun testWorkflows() {
+ val topologyTemplate = TopologyTemplate()
+ topologyTemplate.workflows = mutableMapOf()
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.workflows()!!.isEmpty())
+
+ topologyTemplate.workflows = null
+ assertNull(bluePrintContext.workflows())
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testWorkFlowsByName() {
+ val topologyTemplate = TopologyTemplate()
+ topologyTemplate.workflows = mutableMapOf("workflow" to Workflow())
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.workflowByName("workflow"))
+
+ bluePrintContext.workflowByName("")
+ }
+
+ @Test
+ fun testWorkflowInput() {
+ val topologyTemplate = TopologyTemplate()
+ val workflow = Workflow()
+ workflow.inputs = mutableMapOf()
+ topologyTemplate.workflows = mutableMapOf("workflow" to workflow)
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.workflowInputs("workflow")!!.isEmpty())
+
+ workflow.inputs = null
+
+ assertNull(bluePrintContext.workflowInputs("workflow"))
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testWorkflowStepByName() {
+ val topologyTemplate = TopologyTemplate()
+ val workflow = Workflow()
+ workflow.steps = mutableMapOf("step" to Step())
+ topologyTemplate.workflows = mutableMapOf("workflow" to workflow)
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.workflowStepByName("workflow", "step"))
+
+ bluePrintContext.workflowStepByName("workflow", "")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testWorkflowStepNodeTemplate() {
+ val topologyTemplate = TopologyTemplate()
+ val workflow = Workflow()
+ val step = Step()
+ step.target = "hello"
+ workflow.steps = mutableMapOf("step" to step)
+ topologyTemplate.workflows = mutableMapOf("workflow" to workflow)
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.workflowStepNodeTemplate("workflow", "step"))
+
+ bluePrintContext.workflowStepNodeTemplate("workflow", "")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testWorkflowFirstStepNodeTemplate() {
+ val topologyTemplate = TopologyTemplate()
+ val workflow = Workflow()
+ val step = Step()
+ step.target = "hello"
+ workflow.steps = mutableMapOf("step" to step, "step2" to Step())
+ topologyTemplate.workflows = mutableMapOf("workflow" to workflow)
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.workflowFirstStepNodeTemplate("workflow"))
+
+ workflow.steps = null
+ bluePrintContext.workflowFirstStepNodeTemplate("workflow")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testWorkflowStepFirstCallOperation() {
+ val topologyTemplate = TopologyTemplate()
+ val workflow = Workflow()
+ val step = Step()
+ val activity = Activity()
+ activity.callOperation = "hello"
+ step.activities = arrayListOf(activity)
+ workflow.steps = mutableMapOf("step" to step)
+ topologyTemplate.workflows = mutableMapOf("workflow" to workflow)
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.topologyTemplate = topologyTemplate
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.workflowStepFirstCallOperation("workflow", "step"))
+
+ bluePrintContext.workflowStepFirstCallOperation("workflow", "")
+ }
+
+ @Test
+ fun testDatatypeByName() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.dataTypes = mutableMapOf("data" to DataType())
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.dataTypeByName("data"))
+ assertNull(bluePrintContext.dataTypeByName(""))
+ }
+
+ @Test
+ fun testArtifactTypes() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.artifactTypes = mutableMapOf()
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.artifactTypes()!!.isEmpty())
+
+ serviceTemplate.artifactTypes = null
+ assertNull(bluePrintContext.artifactTypes())
+ }
+
+ @Test
+ fun testPolicyTypes() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.policyTypes = mutableMapOf()
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.policyTypes()!!.isEmpty())
+
+ serviceTemplate.policyTypes = null
+ assertNull(bluePrintContext.policyTypes())
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testPolicyTypeByName() {
+ val serviceTemplate = ServiceTemplate()
+ serviceTemplate.policyTypes = mutableMapOf("policy" to PolicyType())
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.policyTypeByName("policy"))
+ bluePrintContext.policyTypeByName("")
+ }
+
+ @Test
+ fun testPolicyTypesDerivedFrom() {
+ val serviceTemplate = ServiceTemplate()
+ val policyType = PolicyType()
+ policyType.derivedFrom = "hi"
+ val policyType2 = PolicyType()
+ policyType2.derivedFrom = "hello"
+ serviceTemplate.policyTypes = mutableMapOf("policy" to policyType, "policy2" to policyType2)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals(1, bluePrintContext.policyTypesDerivedFrom("hi")!!.size)
+
+ serviceTemplate.policyTypes = null
+ assertNull(bluePrintContext.policyTypesDerivedFrom("hi"))
+ }
+
+ @Test
+ fun testPolicyTypesTarget() {
+ val serviceTemplate = ServiceTemplate()
+ val policyType = PolicyType()
+ policyType.targets = mutableListOf("hi")
+ val policyType2 = PolicyType()
+ policyType2.targets = mutableListOf()
+ serviceTemplate.policyTypes = mutableMapOf("policy" to policyType, "policy2" to policyType2)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals(1, bluePrintContext.policyTypesTarget("hi")!!.size)
+
+ serviceTemplate.policyTypes = null
+ assertNull(bluePrintContext.policyTypesTarget("hi"))
+ }
+
+ @Test
+ fun testPolicyTypesTargetNDerivedFrom() {
+ val serviceTemplate = ServiceTemplate()
+ val policyType = PolicyType()
+ policyType.targets = mutableListOf("hi")
+ policyType.derivedFrom = "hi"
+ val policyType2 = PolicyType()
+ policyType2.targets = mutableListOf()
+ policyType2.derivedFrom = "hi"
+ serviceTemplate.policyTypes = mutableMapOf("policy" to policyType, "policy2" to policyType2)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals(1, bluePrintContext.policyTypesTargetNDerivedFrom("hi", "hi")!!.size)
+
+ serviceTemplate.policyTypes = null
+ assertNull(bluePrintContext.policyTypesTargetNDerivedFrom("hi", "hi"))
+ }
+
+ @Test
+ fun testNodeTypeDerivedFrom() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeType = NodeType()
+ nodeType.derivedFrom = "hi"
+ val nodeType2 = NodeType()
+ nodeType2.derivedFrom = "hiii"
+ serviceTemplate.nodeTypes = mutableMapOf("node" to nodeType, "node2" to nodeType2)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals(1, bluePrintContext.nodeTypeDerivedFrom("hi")!!.size)
+
+ serviceTemplate.nodeTypes = null
+ assertNull(bluePrintContext.nodeTypeDerivedFrom("hi"))
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testInterfaceNameForNodeType() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeType = NodeType()
+ nodeType.interfaces = mutableMapOf("hello" to InterfaceDefinition(), "hi" to InterfaceDefinition())
+ serviceTemplate.nodeTypes = mutableMapOf("node" to nodeType)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("hello", bluePrintContext.interfaceNameForNodeType("node"))
+
+ bluePrintContext.interfaceNameForNodeType("")
+ }
+
+ @Test
+ fun testNodeTemplateForNodeType() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.type = "hello"
+ val nodeTemplate2 = NodeTemplate()
+ nodeTemplate2.type = "hi"
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate, "node2" to nodeTemplate2)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals(1, bluePrintContext.nodeTemplateForNodeType("hello")!!.size)
+
+ serviceTemplate.topologyTemplate!!.nodeTemplates = null
+ assertNull(bluePrintContext.nodeTemplateForNodeType("hello"))
+ }
+
+ @Test
+ fun testNodeTemplateProperty() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.properties = mutableMapOf("prop" to ObjectMapper().createObjectNode())
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateProperty("node", "prop"))
+
+ assertNull(bluePrintContext.nodeTemplateProperty("node", ""))
+
+ nodeTemplate.properties = null
+ assertNull(bluePrintContext.nodeTemplateProperty("node", "prop"))
+ }
+
+ @Test
+ fun testNodeTemplateArtifacts() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.artifacts = mutableMapOf()
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertTrue(bluePrintContext.nodeTemplateArtifacts("node")!!.isEmpty())
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateArtifact() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.artifacts = mutableMapOf("art" to ArtifactDefinition())
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateArtifact("node", "art"))
+
+ bluePrintContext.nodeTemplateArtifact("node", "")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateArtifactForArtifactType() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ val artifactDefinition = ArtifactDefinition()
+ artifactDefinition.type = "type"
+ val artifactDefinition2 = ArtifactDefinition()
+ artifactDefinition2.type = "No type"
+ nodeTemplate.artifacts = mutableMapOf("art" to artifactDefinition, "art2" to artifactDefinition2)
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateArtifactForArtifactType("node", "type"))
+
+ bluePrintContext.nodeTemplateArtifactForArtifactType("", "")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateFirstInterface() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.interfaces = mutableMapOf("interface" to InterfaceAssignment(), "interf" to InterfaceAssignment())
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateFirstInterface("node"))
+
+ nodeTemplate.interfaces = null
+ bluePrintContext.nodeTemplateFirstInterface("node")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateFirstInterfaceName() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.interfaces = mutableMapOf("interface" to InterfaceAssignment(), "interf" to InterfaceAssignment())
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("interface", bluePrintContext.nodeTemplateFirstInterfaceName("node"))
+
+ nodeTemplate.interfaces = null
+ bluePrintContext.nodeTemplateFirstInterfaceName("node")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateFirstInterfaceFirstOperationName() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ val interfaceAssignment = InterfaceAssignment()
+ interfaceAssignment.operations = mutableMapOf("op" to OperationAssignment(), "op2" to OperationAssignment())
+ nodeTemplate.interfaces = mutableMapOf("intf" to interfaceAssignment)
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertEquals("op", bluePrintContext.nodeTemplateFirstInterfaceFirstOperationName("node"))
+
+ interfaceAssignment.operations = null
+ bluePrintContext.nodeTemplateFirstInterfaceFirstOperationName("node")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateCapability() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.capabilities = mutableMapOf("cap" to CapabilityAssignment())
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateCapability("node", "cap"))
+
+ bluePrintContext.nodeTemplateCapability("node", "")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateRequirement() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ nodeTemplate.requirements = mutableMapOf("req" to RequirementAssignment())
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateRequirement("node", "req"))
+
+ bluePrintContext.nodeTemplateRequirement("node", "")
+ }
+
+ @Test(expected = BluePrintException::class)
+ fun testNodeTemplateRequirementNode() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ val requirementAssignment = RequirementAssignment()
+ requirementAssignment.node = "node"
+ nodeTemplate.requirements = mutableMapOf("req" to requirementAssignment)
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateRequirementNode("node", "req"))
+
+ bluePrintContext.nodeTemplateRequirementNode("node", "")
+ }
+
+ @Test
+ fun testNodeTemplateCapabilityProperty() {
+ val serviceTemplate = ServiceTemplate()
+ val nodeTemplate = NodeTemplate()
+ val capabilityAssignment = CapabilityAssignment()
+ capabilityAssignment.properties = mutableMapOf("prop" to ObjectMapper().createObjectNode())
+ nodeTemplate.capabilities = mutableMapOf("cap" to capabilityAssignment)
+ serviceTemplate.topologyTemplate = TopologyTemplate()
+ serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate)
+ val bluePrintContext = BluePrintContext(serviceTemplate)
+
+ assertNotNull(bluePrintContext.nodeTemplateCapabilityProperty("node", "cap", "prop"))
+
+ capabilityAssignment.properties = null
+
+ assertNull(bluePrintContext.nodeTemplateCapabilityProperty("node", "cap", "prop"))
+ }
}
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
index 64a5c12ab..2f4b0472d 100644
--- a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
@@ -18,7 +18,7 @@
<parent>
<artifactId>modules</artifactId>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>blueprint-scripts</artifactId>
diff --git a/ms/controllerblueprints/modules/blueprint-validation/pom.xml b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
index 12502ce78..24755ec06 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/pom.xml
+++ b/ms/controllerblueprints/modules/blueprint-validation/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-validation</artifactId>
<name>Controller Blueprints Validation Service</name>
diff --git a/ms/controllerblueprints/modules/db-resources/pom.xml b/ms/controllerblueprints/modules/db-resources/pom.xml
index 0364800df..af0aa1aff 100644
--- a/ms/controllerblueprints/modules/db-resources/pom.xml
+++ b/ms/controllerblueprints/modules/db-resources/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>db-resources</artifactId>
<name>Controller Blueprints DB Resources</name>
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index c4d1b1d37..3310c3824 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -15,13 +15,12 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>modules</artifactId>
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/controllerblueprints/modules/resource-dict/pom.xml
index 3f4f762b0..5892f52cf 100644
--- a/ms/controllerblueprints/modules/resource-dict/pom.xml
+++ b/ms/controllerblueprints/modules/resource-dict/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>resource-dict</artifactId>
<name>Controller Blueprints Resource Dictionary</name>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 40a5c259d..79b3bb980 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -18,13 +18,12 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>modules</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>service</artifactId>
<name>Controller Blueprints Service</name>
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 276c4001b..236dcc1dc 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>controllerblueprints</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
<artifactId>parent</artifactId>
diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml
index 2e361acd5..211110627 100644
--- a/ms/controllerblueprints/pom.xml
+++ b/ms/controllerblueprints/pom.xml
@@ -18,13 +18,13 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>controllerblueprints</artifactId>
<name>Controller Blueprints Root</name>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<properties>
<service.name>ControllerBlueprints</service.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/ms/pom.xml b/ms/pom.xml
index b97ebc03f..4bd744c9c 100644
--- a/ms/pom.xml
+++ b/ms/pom.xml
@@ -14,19 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Micro-services Root</name>
diff --git a/ms/sdclistener/application/pom.xml b/ms/sdclistener/application/pom.xml
index 5513279cc..62191b185 100644
--- a/ms/sdclistener/application/pom.xml
+++ b/ms/sdclistener/application/pom.xml
@@ -1,23 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- ~ Copyright (C) 2019 Bell Canada. All rights reserved.
+ ~ Copyright © 2019 Bell Canada.
~
- ~ NOTICE: All the intellectual and technical concepts contained herein are
- ~ proprietary to Bell Canada and are protected by trade secret or copyright law.
- ~ Unauthorized copying of this file, via any medium is strictly prohibited.
+ ~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds.sdclistener</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>application</artifactId>
<packaging>jar</packaging>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<name>SDC Listener Application</name>
<properties>
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
index eb339aef7..d5f156e55 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
@@ -21,10 +21,10 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Objects;
-import java.util.Optional;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.service.ListenerService;
import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus;
+import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType;
import org.onap.ccsdk.cds.sdclistener.util.FileUtil;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.consumer.INotificationCallback;
@@ -81,7 +81,9 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
*/
private void downloadCsarArtifacts(IArtifactInfo info, IDistributionClient distributionClient) {
final String url = info.getArtifactURL();
+ sdcListenerDto.setArtifactUrl(url);
final String id = info.getArtifactUUID();
+ final String distributionId = sdcListenerDto.getDistributionId();
if (Objects.equals(info.getArtifactType(), SdcListenerConfiguration.TOSCA_CSAR)) {
LOGGER.info("Trying to download the artifact from : {} and UUID is {} ", url, id);
@@ -90,38 +92,38 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
IDistributionClientDownloadResult result = distributionClient.download(info);
if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
- String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url,
+ final String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url,
result.getDistributionActionResult());
- listenerStatus.sendResponseStatusBackToSDC(sdcListenerDto.getDistributionId(),
- DistributionStatusEnum.COMPONENT_DONE_ERROR, errorMessage);
+ listenerStatus
+ .sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR, errorMessage,
+ url, NotificationType.DOWNLOAD);
LOGGER.error(errorMessage);
} else {
+ listenerStatus.sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_OK, null, url,
+ NotificationType.DOWNLOAD);
LOGGER.info("Trying to write CSAR artifact to file with URL {} and UUID {}", url, id);
processCsarArtifact(result);
}
}
}
- public void processCsarArtifact(IDistributionClientDownloadResult result) {
+ private void processCsarArtifact(IDistributionClientDownloadResult result) {
Path cbaArchivePath = Paths.get(pathToStoreArchives, "cba-archive");
Path csarArchivePath = Paths.get(pathToStoreArchives, "csar-archive");
// Extract and store the CSAR archive into local disk.
- listenerService.extractCsarAndStore(result, csarArchivePath.toString());
+ listenerService.extractCsarAndStore(result, csarArchivePath);
- Optional<List<File>> csarFiles = FileUtil.getFilesFromDisk(csarArchivePath);
+ List<File> csarFiles = FileUtil.getFilesFromDisk(csarArchivePath);
- if (csarFiles.isPresent()) {
- //Extract CBA archive from CSAR package and store it into local disk.
- List<File> files = csarFiles.get();
+ if (!csarFiles.isEmpty()) {
+ final String archivePath = cbaArchivePath.toString();
- if (!files.isEmpty()) {
- final String archivePath = cbaArchivePath.toString();
- files.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath));
- files.forEach(file -> FileUtil.deleteFile(file, archivePath));
- } else {
- LOGGER.error("The CSAR file is not present at this location {}", csarArchivePath);
- }
+ //Extract CBA archive from CSAR package and store it into local disk
+ csarFiles.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath));
+ csarFiles.forEach(file -> FileUtil.deleteFile(file, csarArchivePath.toString()));
+ } else {
+ LOGGER.error("Could not able to read CSAR files from this location {}", csarArchivePath);
}
listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc());
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
index 6f782d10a..5866a63e0 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.ccsdk.cds.sdclistener.client;
import io.grpc.CallOptions;
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
index a9e51ac12..44245752f 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.ccsdk.cds.sdclistener.controller;
import org.springframework.http.MediaType;
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
index c7c3d4829..a59022c3f 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
@@ -34,6 +34,8 @@ public class SdcListenerDto {
@Value("${listenerservice.config.grpcPort}")
private int grpcPort;
+ private String artifactUrl;
+
@Autowired
private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor;
@@ -67,4 +69,12 @@ public class SdcListenerDto {
public ManagedChannel getManagedChannelForGrpc() {
return managedChannel;
}
+
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ public void setArtifactUrl(String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ }
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
index 446c3e621..bc72c8f98 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
@@ -43,5 +43,5 @@ public interface ListenerService {
* @param result - IDistributionClientDownloadResult contains payload.
* @param csarArchivePath The destination path where CSAR will be stored.
*/
- void extractCsarAndStore(IDistributionClientDownloadResult result, String csarArchivePath);
+ void extractCsarAndStore(IDistributionClientDownloadResult result, Path csarArchivePath);
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
index 9a6ae8779..148d0c028 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright © 2017-2019 AT&T, Bell Canada
+ * Copyright © 2019 Bell Canada
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.ccsdk.cds.sdclistener.service;
-import static java.nio.file.Files.walk;
+import static java.lang.String.format;
+import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType.SDC_LISTENER_COMPONENT;
import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR;
import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
import com.google.protobuf.ByteString;
@@ -31,20 +31,19 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
import java.util.List;
-import java.util.Optional;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.commons.io.FileUtils;
import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput;
+import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk;
import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler;
import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus;
import org.onap.ccsdk.cds.sdclistener.util.FileUtil;
-import org.onap.ccsdk.cds.controllerblueprints.common.api.Status;
-import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput;
-import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,12 +74,15 @@ public class ListenerServiceImpl implements ListenerService {
@Value("${listenerservice.config.grpcPort}")
private int grpcPort;
- private static final String CBA_ZIP_PATH = "Artifacts/Resources/[a-zA-Z0-9-_]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_]+[.]zip";
+ private static final String CBA_ZIP_PATH = "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip";
private static final int SUCCESS_CODE = 200;
private static final Logger LOGGER = LoggerFactory.getLogger(ListenerServiceImpl.class);
@Override
public void extractBluePrint(String csarArchivePath, String cbaArchivePath) {
+ int validPathCount = 0;
+ final String distributionId = getDistributionId();
+ final String artifactUrl = getArtifactUrl();
Path cbaStorageDir = getStorageDirectory(cbaArchivePath);
try (ZipFile zipFile = new ZipFile(csarArchivePath)) {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
@@ -88,14 +90,26 @@ public class ListenerServiceImpl implements ListenerService {
ZipEntry entry = entries.nextElement();
String fileName = entry.getName();
if (Pattern.matches(CBA_ZIP_PATH, fileName)) {
+ validPathCount++;
final String cbaArchiveName = Paths.get(fileName).getFileName().toString();
LOGGER.info("Storing the CBA archive {}", cbaArchiveName);
storeBluePrint(zipFile, cbaArchiveName, cbaStorageDir, entry);
}
}
+ if (validPathCount == 0) {
+ LOGGER
+ .info("CBA archive doesn't exist in the CSAR Package or it doesn't exist as per the given path {}",
+ CBA_ZIP_PATH);
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null,
+ artifactUrl, SDC_LISTENER_COMPONENT);
+ }
+
} catch (Exception e) {
- LOGGER.error("Failed to extract blueprint {}", e);
+ final String errorMessage = format("Failed to extract blueprint %s", e.getMessage());
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage,
+ artifactUrl, SDC_LISTENER_COMPONENT);
+ LOGGER.error(errorMessage);
}
}
@@ -121,15 +135,17 @@ public class ListenerServiceImpl implements ListenerService {
@Override
public void saveBluePrintToCdsDatabase(Path cbaArchivePath, ManagedChannel channel) {
- Optional<List<File>> zipFiles = FileUtil.getFilesFromDisk(cbaArchivePath);
- zipFiles.ifPresent(files -> prepareRequestForCdsBackend(files, channel, cbaArchivePath.toString()));
+ List<File> zipFiles = FileUtil.getFilesFromDisk(cbaArchivePath);
+ if (!zipFiles.isEmpty()) {
+ prepareRequestForCdsBackend(zipFiles, channel, cbaArchivePath.toString());
+ }
}
@Override
- public void extractCsarAndStore(IDistributionClientDownloadResult result, String csarArchivePath) {
+ public void extractCsarAndStore(IDistributionClientDownloadResult result, Path csarArchivePath) {
// Create CSAR storage directory
- Path csarStorageDir = getStorageDirectory(csarArchivePath);
+ Path csarStorageDir = getStorageDirectory(csarArchivePath.toString());
byte[] payload = result.getArtifactPayload();
String csarFileName = result.getArtifactFilename();
Path targetLocation = csarStorageDir.resolve(csarFileName);
@@ -140,8 +156,11 @@ public class ListenerServiceImpl implements ListenerService {
try (FileOutputStream outFile = new FileOutputStream(targetCsarFile)) {
outFile.write(payload, 0, payload.length);
+ if (!csarArchivePath.toFile().exists()) {
+ LOGGER.error("Could not able to store the CSAR at this location {}", csarArchivePath);
+ }
} catch (Exception e) {
- LOGGER.error("Failed to put CSAR file into target location {}, {}", targetLocation, e);
+ LOGGER.error("Fail to write the data into FileOutputStream {}, {}", targetLocation, e);
}
}
@@ -159,44 +178,51 @@ public class ListenerServiceImpl implements ListenerService {
}
private void prepareRequestForCdsBackend(List<File> files, ManagedChannel managedChannel, String path) {
- final String distributionId = sdcListenerDto.getDistributionId();
+ final String distributionId = getDistributionId();
+ final String artifactUrl = getArtifactUrl();
files.forEach(zipFile -> {
try {
- final BluePrintUploadInput request = generateBluePrintUploadInputBuilder(zipFile);
+ final BluePrintUploadInput request = generateBluePrintUploadInputBuilder(zipFile, path);
// Send request to CDS Backend.
final Status responseStatus = bluePrintProcesssorHandler.sendRequest(request, managedChannel);
if (responseStatus.getCode() != SUCCESS_CODE) {
- final String errorMessage = String.format("Failed to store the CBA archive into CDS DB due to %s",
+ final String errorMessage = format("Failed to store the CBA archive into CDS DB due to %s",
responseStatus.getErrorMessage());
- listenerStatus.sendResponseStatusBackToSDC(distributionId,
- COMPONENT_DONE_ERROR, errorMessage);
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
+ SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
-
} else {
LOGGER.info(responseStatus.getMessage());
- listenerStatus.sendResponseStatusBackToSDC(distributionId,
- COMPONENT_DONE_OK, null);
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null, artifactUrl,
+ SDC_LISTENER_COMPONENT);
}
} catch (Exception e) {
- final String errorMessage = String.format("Failure due to %s", e.getMessage());
- listenerStatus.sendResponseStatusBackToSDC(distributionId, COMPONENT_DONE_ERROR, errorMessage);
- LOGGER.error("Failure due to {}", e);
- } finally {
- FileUtil.deleteFile(zipFile, path);
+ final String errorMessage = format("Failure due to %s", e.getMessage());
+ listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
+ SDC_LISTENER_COMPONENT);
+ LOGGER.error(errorMessage);
}
});
}
- private BluePrintUploadInput generateBluePrintUploadInputBuilder(File file) throws IOException {
+ private BluePrintUploadInput generateBluePrintUploadInputBuilder(File file, String path) throws IOException {
byte[] bytes = FileUtils.readFileToByteArray(file);
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
-
+ FileUtil.deleteFile(file, path);
return BluePrintUploadInput.newBuilder()
.setFileChunk(fileChunk)
.build();
}
+
+ private String getDistributionId() {
+ return sdcListenerDto.getDistributionId();
+ }
+
+ private String getArtifactUrl() {
+ return sdcListenerDto.getArtifactUrl();
+ }
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
index 60463762b..7a959692a 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
@@ -15,10 +15,11 @@
*/
package org.onap.ccsdk.cds.sdclistener.status;
-import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
+import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.utils.DistributionStatusEnum;
-public class DistributionStatusMessage implements IFinalDistrStatusMessage {
+public class ComponentStatusMessage implements IComponentDoneStatusMessage, IDistributionStatusMessage {
public String componentName;
@@ -28,17 +29,16 @@ public class DistributionStatusMessage implements IFinalDistrStatusMessage {
public DistributionStatusEnum status;
+ public long timeStamp;
+
+ public String artifactUrl;
+
@Override
public String getDistributionID() {
return distributionID;
}
@Override
- public long getTimestamp() {
- return 0;
- }
-
- @Override
public DistributionStatusEnum getStatus() {
return status;
}
@@ -52,4 +52,14 @@ public class DistributionStatusMessage implements IFinalDistrStatusMessage {
public String getComponentName() {
return componentName;
}
+
+ @Override
+ public String getArtifactURL() {
+ return artifactUrl;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return timeStamp;
+ }
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
index ff64c0d0c..446fdc068 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
@@ -20,7 +20,8 @@ import java.util.Objects;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.util.BuilderUtil;
import org.onap.sdc.api.IDistributionClient;
-import org.onap.sdc.api.consumer.IFinalDistrStatusMessage;
+import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.api.results.IDistributionClientResult;
import org.onap.sdc.utils.DistributionStatusEnum;
import org.slf4j.Logger;
@@ -45,32 +46,62 @@ public class SdcListenerStatus {
@Autowired
private SdcListenerDto sdcListenerDto;
+ public enum NotificationType {
+ DOWNLOAD, SDC_LISTENER_COMPONENT;
+ }
+
/**
- * Send the response back to SDC.
- *
+ * Send the component status back to SDC.
* @param distributionID SDC Distribution ID
* @param status Distribution status
- * @param errorReason Reason of failure
+ * @param errorReason Reason of failure if present
+ * @param url Artifact URL
+ * @param type - NotificationType(Download or Component)
*/
- public void sendResponseStatusBackToSDC(String distributionID, DistributionStatusEnum status, String errorReason) {
-
+ public void sendResponseBackToSdc(String distributionID, DistributionStatusEnum status, String errorReason,
+ String url, NotificationType type) {
final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient();
- IFinalDistrStatusMessage finalDistribution = new BuilderUtil<>(new DistributionStatusMessage())
- .build(builder -> {
- builder.distributionID = distributionID;
- builder.status = status;
- builder.consumerID = consumerId;
- builder.componentName = COMPONENT_NAME;
- }).create();
+ switch (type) {
+ case SDC_LISTENER_COMPONENT:
+ IComponentDoneStatusMessage componentStatusMessage = buildStatusMessage(distributionID, status, url,
+ COMPONENT_NAME);
- if (errorReason == null) {
- checkResponseStatusFromSdc(distributionClient.sendFinalDistrStatus(finalDistribution));
- } else {
- checkResponseStatusFromSdc(distributionClient.sendFinalDistrStatus(finalDistribution, errorReason));
+ if (errorReason == null) {
+ checkResponseStatusFromSdc(distributionClient.sendComponentDoneStatus(componentStatusMessage));
+ } else {
+ checkResponseStatusFromSdc(
+ distributionClient.sendComponentDoneStatus(componentStatusMessage, errorReason));
+ }
+ break;
+
+ case DOWNLOAD:
+ IDistributionStatusMessage downloadStatusMessage = buildStatusMessage(distributionID, status, url,
+ null);
+
+ if (errorReason == null) {
+ checkResponseStatusFromSdc(distributionClient.sendDownloadStatus(downloadStatusMessage));
+ } else {
+ checkResponseStatusFromSdc(
+ distributionClient.sendDownloadStatus(downloadStatusMessage, errorReason));
+ }
+ default:
+ break;
}
}
+ private ComponentStatusMessage buildStatusMessage(String distributionId, DistributionStatusEnum status, String url,
+ String componentName) {
+ return new BuilderUtil<>(new ComponentStatusMessage()).build(builder -> {
+ builder.distributionID = distributionId;
+ builder.status = status;
+ builder.consumerID = consumerId;
+ builder.componentName = componentName;
+ builder.timeStamp = System.currentTimeMillis();
+ builder.artifactUrl = url;
+ }).create();
+ }
+
private void checkResponseStatusFromSdc(IDistributionClientResult result) {
if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
LOGGER.error("SDC failed to receive the response from cds-sdc listener due to {}",
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
index 1f546d107..a5c4a5c16 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
@@ -1,9 +1,17 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.
*/
package org.onap.ccsdk.cds.sdclistener.util;
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
index 967e854d7..b6d0e4809 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
@@ -1,11 +1,18 @@
/*
- * Copyright (C) 2019 Bell Canada. All rights reserved.
+ * Copyright © 2019 Bell Canada
*
- * NOTICE: All the intellectual and technical concepts contained herein are
- * proprietary to Bell Canada and are protected by trade secret or copyright law.
- * Unauthorized copying of this file, via any medium is strictly prohibited.
+ * 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.
*/
-
package org.onap.ccsdk.cds.sdclistener.util;
import static java.nio.file.Files.walk;
@@ -13,8 +20,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.io.FileUtils;
@@ -47,15 +54,16 @@ public final class FileUtil {
* @param path where files reside.
* @return list of files.
*/
- public static Optional<List<File>> getFilesFromDisk(Path path) {
+ public static List<File> getFilesFromDisk(Path path) {
+
try (Stream<Path> fileTree = walk(path)) {
// Get the list of files from the path
- return Optional.of(fileTree.filter(Files::isRegularFile)
- .map(Path::toFile)
- .collect(Collectors.toList()));
+ return fileTree.filter(Files::isRegularFile)
+ .map(Path::toFile)
+ .collect(Collectors.toList());
} catch (IOException e) {
LOGGER.error("Failed to find the file due to", e);
}
- return Optional.empty();
+ return new ArrayList<>();
}
}
diff --git a/ms/sdclistener/application/src/main/resources/application.yml b/ms/sdclistener/application/src/main/resources/application.yaml
index b3f8443eb..b3f8443eb 100644
--- a/ms/sdclistener/application/src/main/resources/application.yml
+++ b/ms/sdclistener/application/src/main/resources/application.yaml
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
index f5ff2bdb8..aa8f8e4e8 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
@@ -16,6 +16,8 @@
package org.onap.ccsdk.cds.sdclistener.service;
import static junit.framework.TestCase.assertTrue;
+import static org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus.NotificationType.SDC_LISTENER_COMPONENT;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -27,6 +29,10 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration;
import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
@@ -37,6 +43,7 @@ import org.onap.sdc.impl.mock.DistributionClientResultStubImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@@ -46,40 +53,73 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = {ListenerServiceImplTest.class})
public class ListenerServiceImplTest {
- private static final String CSAR_SAMPLE = "src/test/resources/service-Testsvc140.csar";
+ private static final String CSAR_SAMPLE = "src/test/resources/service-ServicePnfTest-csar.csar";
+ private static final String WRONG_CSAR_SAMPLE = "src/test/resources/wrong_csar_pattern.csar";
+ private static final String CBA_ZIP_PATH = "Artifacts/[a-zA-Z0-9-_.]+/Deployment/CONTROLLER_BLUEPRINT_ARCHIVE/[a-zA-Z0-9-_.()]+[.]zip";
private static final String ZIP_FILE = ".zip";
private static final String CSAR_FILE = ".csar";
+ private static final String DISTRIBUTION_ID = "1";
+ private static final String URL = "/sdc/v1/artifact";
+
+
private String csarArchivePath;
private Path tempDirectoryPath;
@Rule
public TemporaryFolder folder = new TemporaryFolder();
+ @Rule
+ public MockitoRule mockitoRule = MockitoJUnit.rule();
+
@Autowired
private ListenerServiceImpl listenerService;
+ @MockBean
+ SdcListenerStatus status;
+
+ @MockBean
+ SdcListenerDto listenerDto;
+
@Before
public void setup() {
+ MockitoAnnotations.initMocks(this);
csarArchivePath = folder.getRoot().toString();
tempDirectoryPath = Paths.get(csarArchivePath, "cds-sdc-listener-test");
}
+
@Test
public void extractBluePrintSuccessfully() throws IOException {
// Act
listenerService.extractBluePrint(CSAR_SAMPLE, tempDirectoryPath.toString());
- // Verify
+ // Verify.
String result = checkFileExists(tempDirectoryPath);
assertTrue(result.contains(ZIP_FILE));
}
@Test
+ public void extractBluePrintFailure() {
+ // Arrange
+ Mockito.when(listenerDto.getDistributionId()).thenReturn(DISTRIBUTION_ID);
+ Mockito.when(listenerDto.getArtifactUrl()).thenReturn(URL);
+ Mockito.doCallRealMethod().when(status)
+ .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
+
+ // Act
+ listenerService.extractBluePrint(WRONG_CSAR_SAMPLE, tempDirectoryPath.toString());
+
+ // Verify
+ Mockito.verify(status)
+ .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
+ }
+
+ @Test
public void storeCsarArtifactToFileSuccessfully() throws IOException {
// Arrange
DistributionClientDownloadResultStubImpl resultStub = new DistributionClientDownloadResultStubImpl();
// Act
- listenerService.extractCsarAndStore(resultStub, tempDirectoryPath.toString());
+ listenerService.extractCsarAndStore(resultStub, tempDirectoryPath);
// Verify
String result = checkFileExists(tempDirectoryPath);
diff --git a/ms/sdclistener/application/src/test/resources/service-ServicePnfTest-csar.csar b/ms/sdclistener/application/src/test/resources/service-ServicePnfTest-csar.csar
new file mode 100644
index 000000000..62a77dcaf
--- /dev/null
+++ b/ms/sdclistener/application/src/test/resources/service-ServicePnfTest-csar.csar
Binary files differ
diff --git a/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar b/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar
deleted file mode 100644
index 4aa0de72b..000000000
--- a/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar
+++ /dev/null
Binary files differ
diff --git a/ms/sdclistener/application/src/test/resources/wrong_csar_pattern.csar b/ms/sdclistener/application/src/test/resources/wrong_csar_pattern.csar
new file mode 100644
index 000000000..ee18b580d
--- /dev/null
+++ b/ms/sdclistener/application/src/test/resources/wrong_csar_pattern.csar
Binary files differ
diff --git a/ms/sdclistener/distribution/pom.xml b/ms/sdclistener/distribution/pom.xml
index a79a14c52..af0114973 100755
--- a/ms/sdclistener/distribution/pom.xml
+++ b/ms/sdclistener/distribution/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds.sdclistener</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<artifactId>distribution</artifactId>
diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml
index fabdc2530..695d5e86e 100755
--- a/ms/sdclistener/parent/pom.xml
+++ b/ms/sdclistener/parent/pom.xml
@@ -16,13 +16,12 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>sdclistener</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.ccsdk.cds.sdclistener</groupId>
<artifactId>parent</artifactId>
@@ -35,7 +34,6 @@
<grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
- <sli.version>0.4.2-SNAPSHOT</sli.version>
<guava.version>27.0.1-jre</guava.version>
<onap.logger.slf4j>1.2.2</onap.logger.slf4j>
<powermock.version>1.7.4</powermock.version>
diff --git a/ms/sdclistener/pom.xml b/ms/sdclistener/pom.xml
index 70e8529f6..6aeb5484e 100644
--- a/ms/sdclistener/pom.xml
+++ b/ms/sdclistener/pom.xml
@@ -19,7 +19,7 @@
<parent>
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>ms</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/pom.xml b/pom.xml
index cfc2e656a..7fb034564 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2019 Bell Canada
@@ -14,14 +15,12 @@ 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.
-->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>1.2.2-SNAPSHOT</version>
+ <version>1.3.0-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -29,7 +28,7 @@ limitations under the License.
<groupId>org.onap.ccsdk.cds</groupId>
<artifactId>parent</artifactId>
- <version>0.4.2-SNAPSHOT</version>
+ <version>0.5.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>cds-parent</name>
@@ -110,4 +109,4 @@ limitations under the License.
</profile>
</profiles>
-</project> \ No newline at end of file
+</project>
diff --git a/version.properties b/version.properties
index 1c98ae9b3..79f39f1d2 100644
--- a/version.properties
+++ b/version.properties
@@ -5,8 +5,8 @@
release_name=0
-sprint_number=4
-feature_revision=2
+sprint_number=5
+feature_revision=0
base_version=${release_name}.${sprint_number}.${feature_revision}