Merge "Resource dictionary- updated license text"
authorDan Timoney <dtimoney@att.com>
Thu, 16 May 2019 13:20:34 +0000 (13:20 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 16 May 2019 13:20:34 +0000 (13:20 +0000)
132 files changed:
.gitignore
cds-ui/application/pom.xml
cds-ui/client/pom.xml
cds-ui/client/src/app/common/constants/app-constants.ts
cds-ui/client/src/app/common/core/services/api.service.ts
cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts
cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.service.ts
cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
cds-ui/client/src/app/feature-modules/blueprint/test-template/test-template.service.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/exsisting-model.service.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/existing-model/search-resource/search-resource.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-creation.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-template-options/resource-template-options.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-template-options/resource-template-options.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-template-options/resource-template-options.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/resource-template-options/resource-template-options.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource-routing.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-creation/upload-resource/upload-resource.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-definition-routing.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-definition.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit-routing.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.module.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.service.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
cds-ui/pom.xml
cds-ui/server/config/app-config.ts [new file with mode: 0644]
cds-ui/server/pom.xml
cds-ui/server/src/controllers/blueprint-rest.controller.ts
cds-ui/server/src/controllers/data-dictionary.controller.ts
cds-ui/server/src/datasources/blueprint.datasource-template.ts [moved from cds-ui/server/src/datasources/blueprint.datasource.json with 56% similarity]
cds-ui/server/src/datasources/blueprint.datasource.ts
cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts [moved from cds-ui/server/src/datasources/resource-dictionary.datasource.json with 63% similarity]
cds-ui/server/src/datasources/resource-dictionary.datasource.ts
cds-ui/server/src/services/blueprint.service.ts
cds-ui/server/src/services/resource-dictionary.service.ts
components/model-catalog/proto-definition/pom.xml
components/parent/pom.xml
components/pom.xml
ms/blueprintsprocessor/application/pom.xml
ms/blueprintsprocessor/distribution/pom.xml
ms/blueprintsprocessor/functions/cli-executor/pom.xml
ms/blueprintsprocessor/functions/netconf-executor/pom.xml
ms/blueprintsprocessor/functions/pom.xml
ms/blueprintsprocessor/functions/python-executor/pom.xml
ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
ms/blueprintsprocessor/functions/python-executor/src/test/resources/payload/requests/sample-remote-python-request.json [new file with mode: 0644]
ms/blueprintsprocessor/functions/resource-resolution/pom.xml
ms/blueprintsprocessor/functions/restconf-executor/pom.xml
ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
ms/blueprintsprocessor/modules/commons/dmaap-lib/pom.xml
ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
ms/blueprintsprocessor/modules/commons/pom.xml
ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
ms/blueprintsprocessor/modules/inbounds/pom.xml
ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
ms/blueprintsprocessor/modules/outbounds/pom.xml
ms/blueprintsprocessor/modules/pom.xml
ms/blueprintsprocessor/modules/services/execution-service/pom.xml
ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/pom.xml
ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
ms/blueprintsprocessor/parent/pom.xml
ms/blueprintsprocessor/pom.xml
ms/command-executor/pom.xml
ms/controllerblueprints/application/pom.xml
ms/controllerblueprints/distribution/pom.xml
ms/controllerblueprints/modules/blueprint-core/pom.xml
ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt [new file with mode: 0644]
ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
ms/controllerblueprints/modules/blueprint-scripts/pom.xml
ms/controllerblueprints/modules/blueprint-validation/pom.xml
ms/controllerblueprints/modules/db-resources/pom.xml
ms/controllerblueprints/modules/pom.xml
ms/controllerblueprints/modules/resource-dict/pom.xml
ms/controllerblueprints/modules/service/pom.xml
ms/controllerblueprints/parent/pom.xml
ms/controllerblueprints/pom.xml
ms/pom.xml
ms/sdclistener/application/pom.xml
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java [moved from ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java with 75% similarity]
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
ms/sdclistener/application/src/main/resources/application.yaml [moved from ms/sdclistener/application/src/main/resources/application.yml with 100% similarity]
ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
ms/sdclistener/application/src/test/resources/service-ServicePnfTest-csar.csar [new file with mode: 0644]
ms/sdclistener/application/src/test/resources/service-Testsvc140.csar [deleted file]
ms/sdclistener/application/src/test/resources/wrong_csar_pattern.csar [new file with mode: 0644]
ms/sdclistener/distribution/pom.xml
ms/sdclistener/parent/pom.xml
ms/sdclistener/pom.xml
pom.xml
version.properties

index a2661f0..29bf5d4 100644 (file)
@@ -43,6 +43,7 @@ build/Release
 node_modules/
 jspm_packages/
 dist/
+dist10/
 
 # TypeScript v1 declaration files
 typings/
index 3ab1d33..66b4b80 100644 (file)
@@ -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>
index b0b1c55..86504b7 100644 (file)
@@ -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>
index d4e8989..283ce73 100644 (file)
@@ -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',
index 463ef38..addf51c 100644 (file)
@@ -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 {
index 6d26592..13d7d53 100644 (file)
@@ -28,6 +28,7 @@ export interface IBlueprintState {
     name?: string;
     files?: any;
     filesData?: any;
+    uploadedFileName?: string;
     isLoadSuccess?: boolean;
     isUpdateSuccess?: boolean;
     isSaveSuccess?: boolean;
index 37a659d..b4347d4 100644 (file)
@@ -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;
index 1f8526a..09fa003 100644 (file)
@@ -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');
index 63c8019..ec25244 100644 (file)
@@ -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
index 9c11f76..1d0ba2c 100644 (file)
@@ -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,
index 8df8e78..3896265 100644 (file)
@@ -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 {
index 7c3bf54..a4177c1 100644 (file)
@@ -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
index 9051a86..6d4b818 100644 (file)
@@ -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.
index b81a733..7ef4092 100644 (file)
@@ -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.
index afb2b9d..548128d 100644 (file)
@@ -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.
index 50a386a..c36bc2f 100644 (file)
@@ -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.
index 77d9c68..bb64c6a 100644 (file)
@@ -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.
index 549fbb7..65c285e 100644 (file)
@@ -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.
index a0e6b15..b33978d 100644 (file)
@@ -3,6 +3,8 @@
 * ONAP : CDS\r
 * ================================================================================\r
 * Copyright 2019 TechMahindra\r
+*\r
+* Modifications Copyright (C) 2019 IBM\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
index 2205ac8..946165a 100644 (file)
@@ -3,6 +3,8 @@
 * ONAP : CDS\r
 * ================================================================================\r
 * Copyright 2019 TechMahindra\r
+*\r
+* Modifications Copyright (C) 2019 IBM\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
index 2061ed2..8a7a10b 100644 (file)
@@ -3,6 +3,8 @@
 * ONAP : CDS\r
 * ================================================================================\r
 * Copyright 2019 TechMahindra\r
+*\r
+* Modifications Copyright (C) 2019 IBM\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
index 1c6efc9..ec77675 100644 (file)
@@ -3,6 +3,8 @@
 * ONAP : CDS\r
 * ================================================================================\r
 * Copyright 2019 TechMahindra\r
+*\r
+* Modifications Copyright (C) 2019 IBM\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
index 73e6459..c3f00b8 100644 (file)
@@ -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.
index 3d60dab..2b79dd4 100644 (file)
@@ -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.
index cafd2bf..cd9725f 100644 (file)
@@ -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.
index 9893230..18d6073 100644 (file)
@@ -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.
index ac3561a..5299a08 100644 (file)
@@ -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.
index 3f27c2d..5be0bfc 100644 (file)
@@ -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.
index 2f0b3fe..5007a15 100644 (file)
@@ -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.
index 60a8b94..826e314 100644 (file)
@@ -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.
index 328adcf..f8f2af1 100644 (file)
@@ -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.
index 72d72dd..fd34b16 100644 (file)
@@ -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.
index c2f3dad..f7f9388 100644 (file)
@@ -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.
index 0e05653..971e12c 100644 (file)
@@ -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.
index ae417c4..494e765 100644 (file)
@@ -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.
index 4bd4ad4..5be2a14 100644 (file)
@@ -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.
index 9c2d42a..236aa97 100644 (file)
@@ -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.
index f88452d..af2adc0 100644 (file)
@@ -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.
index 77e9017..4603c52 100644 (file)
@@ -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.
index ae7143c..8d2c9aa 100644 (file)
@@ -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.
index 982d71d..bd06abb 100644 (file)
@@ -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
index 3b35a99..d40dbd9 100644 (file)
@@ -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.
index aa8ca61..833376c 100644 (file)
@@ -3,6 +3,8 @@
 * ONAP : CDS\r
 * ================================================================================\r
 * Copyright 2019 TechMahindra\r
+*\r
+* Modifications Copyright (C) 2019 IBM\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
index f157ca5..55be36e 100644 (file)
@@ -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.
index 29244f0..6762f7c 100644 (file)
@@ -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.
index 91a22b8..b1474d2 100644 (file)
@@ -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.
index 5bec796..d4cb7dd 100644 (file)
@@ -3,6 +3,8 @@
 * ONAP : CDS\r
 * ================================================================================\r
 * Copyright 2019 TechMahindra\r
+*\r
+* Modifications Copyright (C) 2019 IBM\r
 *=================================================================================\r
 * Licensed under the Apache License, Version 2.0 (the "License");\r
 * you may not use this file except in compliance with the License.\r
index 4a94fed..cdebf8d 100644 (file)
@@ -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.
index 517add8..52b19f7 100644 (file)
@@ -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.
index a6cd085..e4c545e 100644 (file)
@@ -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 (file)
index 0000000..80f2464
--- /dev/null
@@ -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
index 1c05d55..ae9b1b2 100644 (file)
@@ -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>
index 38abad8..877fa02 100644 (file)
@@ -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) => {
index d535e27..486c286 100644 (file)
@@ -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);
   }
 }
@@ -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
index 0086126..ce901b6 100644 (file)
@@ -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';
@@ -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
index 381ab9a..ba12c78 100644 (file)
@@ -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';
index f482536..970b2af 100644 (file)
@@ -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> {
index 44ba1a3..8bc61fa 100644 (file)
@@ -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> {
index 89590ef..baa6cc9 100644 (file)
     <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>
index d6b40d7..0ecf94a 100644 (file)
@@ -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>
index 510467c..8766401 100644 (file)
@@ -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>
index c079ba9..a5d4527 100755 (executable)
@@ -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>
index 0a9e4a9..91ead8d 100755 (executable)
@@ -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>
index 77c45e7..af76d12 100644 (file)
@@ -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>
index 16ec6fb..a46e743 100644 (file)
@@ -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>
index 3f94806..a635c9f 100755 (executable)
@@ -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>
index af9d198..8e098bf 100644 (file)
@@ -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>
 
index 0c5a947..896d9a6 100644 (file)
 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 (file)
index 0000000..68a3664
--- /dev/null
@@ -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"
+    }
+  }
+}
index b4bbd50..3666b41 100644 (file)
@@ -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>
index ef2f8bb..47a7af7 100644 (file)
@@ -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>
index faf5578..df66ff3 100644 (file)
@@ -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>
index 5f30299..3261489 100644 (file)
@@ -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>
index e50b191..c7933a7 100644 (file)
   ~  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>
index a459d5f..8df218f 100644 (file)
 
 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
index 9b52565..5fdfb50 100755 (executable)
@@ -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>
index 93a9b79..31feff1 100644 (file)
@@ -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>
index 6809e79..0cae946 100644 (file)
@@ -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>
index a85dc9a..37a797f 100644 (file)
@@ -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")
+    }
 }
 
index c8f6b9e..17b630f 100644 (file)
@@ -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>
index 4d58576..d5acf4f 100644 (file)
@@ -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>
index d3f8b46..340f2c6 100755 (executable)
@@ -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>
index d406462..7512990 100644 (file)
@@ -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>
index c67c978..3bdd13d 100644 (file)
@@ -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>
 
index d366f74..edfa4e3 100644 (file)
@@ -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>
index c5fbea8..b404fbe 100644 (file)
@@ -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
     }
+
 }
+
index dd417e5..ae7b7b2 100644 (file)
@@ -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])
index e09cbfb..000d8c0 100644 (file)
@@ -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 (file)
index 0000000..6a95e29
--- /dev/null
@@ -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
index 751ad94..d2f1219 100755 (executable)
@@ -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>
index c48ff25..d7f87ae 100644 (file)
@@ -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>
 
index 42abbc5..5f3e926 100755 (executable)
   ~  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>
             <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>
index ffdb877..99d7969 100755 (executable)
@@ -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>
index 7376d77..c4a679b 100755 (executable)
   ~  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>
index ddefb27..d1d6551 100644 (file)
@@ -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>
index 563b4eb..6da5788 100755 (executable)
@@ -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>
index 524a42f..9e22af6 100644 (file)
@@ -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 (file)
index 0000000..e3e5c26
--- /dev/null
@@ -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
index d5334dc..487b1d1 100644 (file)
 
 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
index 2c6561f..3389027 100644 (file)
 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"))
+    }
 }
index 64a5c12..2f4b047 100644 (file)
@@ -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>
index 12502ce..24755ec 100644 (file)
@@ -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>
index 0364800..af0aa1a 100644 (file)
@@ -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>
index c4d1b1d..3310c38 100644 (file)
   ~ 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>
index 3f4f762..5892f52 100644 (file)
@@ -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>
index 40a5c25..79b3bb9 100644 (file)
   ~ 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>
index 276c400..236dcc1 100644 (file)
@@ -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>
index 2e361ac..2111106 100644 (file)
     <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>
index b97ebc0..4bd744c 100644 (file)
  * 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>
index 5513279..62191b1 100644 (file)
@@ -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>
index eb339ae..d5f156e 100644 (file)
@@ -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());
index a9e51ac..4424575 100644 (file)
@@ -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;
index c7c3d48..a59022c 100644 (file)
@@ -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;
+    }
 }
index 446c3e6..bc72c8f 100644 (file)
@@ -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);
 }
index 9a6ae87..148d0c0 100644 (file)
@@ -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.
  * 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();
+    }
 }
  */
 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,16 +29,15 @@ 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;
+    }
 }
index ff64c0d..446fdc0 100644 (file)
@@ -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 {}",
index 1f546d1..a5c4a5c 100644 (file)
@@ -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;
 
index 967e854..b6d0e48 100644 (file)
@@ -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<>();
     }
 }
index f5ff2bd..aa8f8e4 100644 (file)
@@ -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 (file)
index 0000000..62a77dc
Binary files /dev/null and b/ms/sdclistener/application/src/test/resources/service-ServicePnfTest-csar.csar 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 (file)
index 4aa0de7..0000000
Binary files a/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar and /dev/null 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 (file)
index 0000000..ee18b58
Binary files /dev/null and b/ms/sdclistener/application/src/test/resources/wrong_csar_pattern.csar differ
index a79a14c..af01149 100755 (executable)
@@ -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>
index fabdc25..695d5e8 100755 (executable)
   ~  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>
index 70e8529..6aeb548 100644 (file)
@@ -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 cfc2e65..7fb0345 100644 (file)
--- 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>
index 1c98ae9..79f39f1 100644 (file)
@@ -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}