summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.editorconfig5
-rw-r--r--README.md7
-rw-r--r--cds-ui/client-frankfurt/src/app/app.component.html1
-rw-r--r--cds-ui/client-frankfurt/src/app/common/core/services/api.service.ts137
-rw-r--r--cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.ts27
-rw-r--r--cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.module.ts21
-rw-r--r--cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.routing.module.ts15
-rw-r--r--cds-ui/client-frankfurt/src/styles.css778
-rw-r--r--cds-ui/client/src/app/common/core/store/models/catalog.model.ts16
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html16
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts28
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html33
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts13
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts25
-rw-r--r--cds-ui/designer-client/README.md (renamed from cds-ui/client-frankfurt/README.md)2
-rw-r--r--cds-ui/designer-client/angular.json (renamed from cds-ui/client-frankfurt/angular.json)23
-rw-r--r--cds-ui/designer-client/browserslist (renamed from cds-ui/client-frankfurt/browserslist)0
-rw-r--r--cds-ui/designer-client/e2e/protractor.conf.js (renamed from cds-ui/client-frankfurt/e2e/protractor.conf.js)0
-rw-r--r--cds-ui/designer-client/e2e/src/app.e2e-spec.ts (renamed from cds-ui/client-frankfurt/e2e/src/app.e2e-spec.ts)2
-rw-r--r--cds-ui/designer-client/e2e/src/app.po.ts (renamed from cds-ui/client-frankfurt/e2e/src/app.po.ts)0
-rw-r--r--cds-ui/designer-client/e2e/tsconfig.json (renamed from cds-ui/client-frankfurt/e2e/tsconfig.json)0
-rw-r--r--cds-ui/designer-client/karma.conf.js (renamed from cds-ui/client-frankfurt/karma.conf.js)2
-rw-r--r--cds-ui/designer-client/package.json (renamed from cds-ui/client-frankfurt/package.json)12
-rw-r--r--cds-ui/designer-client/proxy.conf.json (renamed from cds-ui/client-frankfurt/proxy.conf.json)0
-rw-r--r--cds-ui/designer-client/src/app/app-routing.module.ts (renamed from cds-ui/client-frankfurt/src/app/app-routing.module.ts)1
-rw-r--r--cds-ui/designer-client/src/app/app.component.css (renamed from cds-ui/client-frankfurt/src/app/app.component.css)0
-rw-r--r--cds-ui/designer-client/src/app/app.component.html7
-rw-r--r--cds-ui/designer-client/src/app/app.component.spec.ts (renamed from cds-ui/client-frankfurt/src/app/app.component.spec.ts)6
-rw-r--r--cds-ui/designer-client/src/app/app.component.ts (renamed from cds-ui/client-frankfurt/src/app/app.component.ts)2
-rw-r--r--cds-ui/designer-client/src/app/app.module.ts (renamed from cds-ui/client-frankfurt/src/app/app.module.ts)5
-rw-r--r--cds-ui/designer-client/src/app/common/constants/app-constants.ts (renamed from cds-ui/client-frankfurt/src/app/common/constants/app-constants.ts)5
-rw-r--r--cds-ui/designer-client/src/app/common/core/services/api.service.ts51
-rw-r--r--cds-ui/designer-client/src/app/common/core/services/api.typed.service.ts51
-rw-r--r--cds-ui/designer-client/src/app/common/core/stores/Store.ts22
-rw-r--r--cds-ui/designer-client/src/app/common/model/page.ts21
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/blueprint.page.mock.ts50
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.css (renamed from cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css)10
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html (renamed from cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.html)2
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.spec.ts (renamed from cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.spec.ts)0
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts128
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/model/BluePrint.model.ts58
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts33
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.css (renamed from cds-ui/client-frankfurt/src/assets/.gitkeep)0
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html18
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts45
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts100
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.css (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript)0
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html104
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.spec.ts36
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts32
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.css0
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.html7
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.spec.ts25
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts41
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dahsboard.component.spec.ts44
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.css0
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.html61
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.ts37
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.css0
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.html4
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.spec.ts25
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.ts25
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-list.service.ts66
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts36
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.routing.module.ts20
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.spec.ts44
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.ts104
-rw-r--r--cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.css12
-rw-r--r--cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html72
-rw-r--r--cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.spec.ts25
-rw-r--r--cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.ts15
-rw-r--r--cds-ui/designer-client/src/app/modules/shared-modules/shared-modules.module.ts13
-rw-r--r--cds-ui/designer-client/src/assets/.gitkeep0
-rw-r--r--cds-ui/designer-client/src/assets/css/bootstrap.min.css (renamed from cds-ui/client-frankfurt/src/assets/css/bootstrap.min.css)0
-rw-r--r--cds-ui/designer-client/src/assets/css/designer.css0
-rw-r--r--cds-ui/designer-client/src/assets/css/font-awesome.min.css (renamed from cds-ui/client-frankfurt/src/assets/css/font-awesome.min.css)0
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/css/orangeHelvetica.css (renamed from cds-ui/client-frankfurt/src/assets/css/orangeHelvetica.css)0
-rw-r--r--cds-ui/designer-client/src/assets/css/style1.css0
-rw-r--r--cds-ui/designer-client/src/assets/css/style2.css3
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.eot (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.eot)bin39193 -> 39193 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.svg (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.svg)0
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.ttf (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.ttf)bin88172 -> 88172 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.woff (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.woff)bin48038 -> 48038 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.woff2 (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.woff2)bin38000 -> 38000 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.eot (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.eot)bin39324 -> 39324 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.svg (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.svg)0
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.ttf (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.ttf)bin85816 -> 85816 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.woff (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.woff)bin47987 -> 47987 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.woff2 (renamed from cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.woff2)bin37996 -> 37996 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/icon-orange.eot (renamed from cds-ui/client-frankfurt/src/assets/fonts/icon-orange.eot)bin389532 -> 389532 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/icon-orange.svg (renamed from cds-ui/client-frankfurt/src/assets/fonts/icon-orange.svg)0
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/icon-orange.ttf (renamed from cds-ui/client-frankfurt/src/assets/fonts/icon-orange.ttf)bin389372 -> 389372 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/icon-orange.woff (renamed from cds-ui/client-frankfurt/src/assets/fonts/icon-orange.woff)bin389448 -> 389448 bytes
-rwxr-xr-x[-rw-r--r--]cds-ui/designer-client/src/assets/fonts/icon-orange.woff2 (renamed from cds-ui/client-frankfurt/src/assets/fonts/icon-orange.woff2)bin165812 -> 165812 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/android-chrome-192x192.png (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/android-chrome-192x192.png)bin12178 -> 12178 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/android-chrome-512x512.png (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/android-chrome-512x512.png)bin37218 -> 37218 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/apple-touch-icon.png (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/apple-touch-icon.png)bin11490 -> 11490 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/browserconfig.xml (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/browserconfig.xml)0
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/favicon-16x16.png (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/favicon-16x16.png)bin1217 -> 1217 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/favicon-32x32.png (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/favicon-32x32.png)bin2069 -> 2069 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/favicon.ico (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/favicon.ico)bin15086 -> 15086 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/mstile-150x150.png (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/mstile-150x150.png)bin8822 -> 8822 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/safari-pinned-tab.svg (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/safari-pinned-tab.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/favicon/site.webmanifest (renamed from cds-ui/client-frankfurt/src/assets/img/favicon/site.webmanifest)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-add-hover.svg12
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-add.svg19
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-addPackage.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-addPackage.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-archive-sm.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-archive-sm.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-btn-card-config.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-btn-card-config.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-btn-card-topology.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-btn-card-topology.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-clone-sm.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-clone-sm.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-close.svg15
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType1-sm.svg28
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType1.svg26
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType2-sm.svg23
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType2.svg21
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType3-sm.svg65
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType3.svg63
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-comType4-sm.svg23
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-create-white.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-create-white.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-delete-sm.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-delete-sm.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-deploy.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-deploy.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-drag.svg32
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-edit.svg21
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-import-blue.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-import-blue.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-menuDots.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-menuDots.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-nav-dictionary.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-nav-dictionary.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-nav-packages.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-nav-packages.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-redo.svg19
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-search-light.svg17
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-search.svg (renamed from cds-ui/client-frankfurt/src/assets/img/icon-search.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-topologySource.svg28
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-topologyView-active.svg27
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-undoActive.svg19
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-zoomIn.svg19
-rw-r--r--cds-ui/designer-client/src/assets/img/icon-zoomOut.svg19
-rw-r--r--cds-ui/designer-client/src/assets/img/img-user1.jpegbin0 -> 25183 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/img-user2.jpgbin0 -> 242904 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/img-user3.jpgbin0 -> 194503 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/img-userProfile.png (renamed from cds-ui/client-frankfurt/src/assets/img/img-userProfile.png)bin1551 -> 1551 bytes
-rw-r--r--cds-ui/designer-client/src/assets/img/logo-icon.svg (renamed from cds-ui/client-frankfurt/src/assets/img/logo-icon.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/img/logo-text.svg (renamed from cds-ui/client-frankfurt/src/assets/img/logo-text.svg)0
-rw-r--r--cds-ui/designer-client/src/assets/js/bootstrap.min.js (renamed from cds-ui/client-frankfurt/src/assets/js/bootstrap.min.js)0
-rw-r--r--cds-ui/designer-client/src/assets/js/jquery-3.3.1.slim.min.js (renamed from cds-ui/client-frankfurt/src/assets/js/jquery-3.3.1.slim.min.js)0
-rw-r--r--cds-ui/designer-client/src/assets/js/popper.min.js (renamed from cds-ui/client-frankfurt/src/assets/js/popper.min.js)0
-rw-r--r--cds-ui/designer-client/src/environments/environment.prod.ts (renamed from cds-ui/client-frankfurt/src/environments/environment.prod.ts)0
-rw-r--r--cds-ui/designer-client/src/environments/environment.ts (renamed from cds-ui/client-frankfurt/src/environments/environment.ts)0
-rw-r--r--cds-ui/designer-client/src/favicon.ico (renamed from cds-ui/client-frankfurt/src/favicon.ico)bin948 -> 948 bytes
-rw-r--r--cds-ui/designer-client/src/index.html (renamed from cds-ui/client-frankfurt/src/index.html)0
-rw-r--r--cds-ui/designer-client/src/main.ts (renamed from cds-ui/client-frankfurt/src/main.ts)0
-rw-r--r--cds-ui/designer-client/src/polyfills.ts (renamed from cds-ui/client-frankfurt/src/polyfills.ts)0
-rw-r--r--cds-ui/designer-client/src/styles.css1441
-rw-r--r--cds-ui/designer-client/src/test.ts (renamed from cds-ui/client-frankfurt/src/test.ts)0
-rw-r--r--cds-ui/designer-client/tsconfig.app.json (renamed from cds-ui/client-frankfurt/tsconfig.app.json)0
-rw-r--r--cds-ui/designer-client/tsconfig.json (renamed from cds-ui/client-frankfurt/tsconfig.json)0
-rw-r--r--cds-ui/designer-client/tsconfig.spec.json (renamed from cds-ui/client-frankfurt/tsconfig.spec.json)0
-rw-r--r--cds-ui/designer-client/tslint.json (renamed from cds-ui/client-frankfurt/tslint.json)0
-rw-r--r--cds-ui/server/pom.xml2
-rw-r--r--cds-ui/server/src/controllers/data-dictionary.controller.ts16
-rw-r--r--cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts18
-rw-r--r--cds-ui/server/src/services/resource-dictionary.service.ts3
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json66
-rwxr-xr-xms/blueprintsprocessor/application/pom.xml8
-rwxr-xr-xms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml24
-rwxr-xr-xms/blueprintsprocessor/application/src/main/docker/distribution.xml5
-rw-r--r--ms/blueprintsprocessor/application/src/main/docker/startService.sh2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt59
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt22
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt31
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt34
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt29
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt7
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt30
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt16
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt (renamed from ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MoreMatchers.kt)0
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt38
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt124
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt8
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt2
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt8
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application-dev.properties5
-rwxr-xr-xms/blueprintsprocessor/application/src/main/resources/application.properties5
-rw-r--r--ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem37
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt12
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt24
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt7
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt9
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt47
-rw-r--r--ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt12
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml4
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt89
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt52
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt2
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt1
-rw-r--r--ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt33
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt68
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt11
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotRepository.kt8
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt81
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt304
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt58
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt4
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/AbstractMessagePrioritizeProcessor.kt (renamed from ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/AbstractTopologyComponents.kt)6
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumer.kt83
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt7
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizeExtensions.kt9
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt33
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritization.kt (renamed from ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt)14
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt118
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageRepository.kt160
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt93
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageAggregateProcessor.kt22
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageOutputProcessor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationPunctuators.kt33
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationSerde.kt (renamed from ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationSerdes.kt)4
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizeProcessor.kt69
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt10
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt39
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageProcessorUtils.kt7
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt100
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/TestConfiguration.kt9
-rw-r--r--ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtilsTest.kt83
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt16
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt4
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt60
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt11
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt23
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt17
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt88
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt17
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt77
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImpl.kt3
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt83
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt27
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt17
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt7
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt117
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfMessageStateTest.kt149
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt17
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt144
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt26
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtilsTest.kt28
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt131
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt19
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt43
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt93
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt29
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt18
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt104
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt9
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt73
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt45
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt133
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt24
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt19
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt351
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt244
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt29
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt101
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt42
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt23
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt14
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt107
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt7
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt24
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt31
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt37
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt13
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt73
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt17
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/SimpleRAProcessor.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt)0
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt26
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt12
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt42
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt184
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt24
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt60
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt47
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt40
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt (renamed from ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintResLibPropertyService.kt)10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt51
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt10
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt30
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt28
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt24
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt221
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml1
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt8
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt42
-rw-r--r--ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt32
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/pom.xml (renamed from ms/controllerblueprints/modules/blueprint-core/pom.xml)10
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt)9
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt)6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt)50
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt)100
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/ConfigModelConstant.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/ConfigModelConstant.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt)20
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt)31
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt)61
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt77
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt)39
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt)45
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintErrorCode.kt)7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt)11
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt313
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt)175
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt)12
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt)71
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt)17
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt)89
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt)161
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt)8
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt)20
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt)9
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt)11
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt)10
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt)18
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt)32
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt)40
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt)21
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt)31
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt)38
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt)88
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt)8
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt)108
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt)9
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt)46
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt)28
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt)165
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt)25
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt)277
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt)18
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt)25
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt)83
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt)89
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt)76
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt)11
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt)52
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt)16
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt47
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt)19
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt)38
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt)7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt)13
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt)12
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt)23
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory (renamed from ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt)34
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt)8
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt24
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt119
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt)72
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt)34
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt)27
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt)27
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt)90
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt)17
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt)82
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt)9
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt)7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt)6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt)9
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt)14
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt)20
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/TOSCA-Metadata/TOSCA.meta (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/TOSCA-Metadata/TOSCA.meta)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/componentnode/default.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/data/alltype-data.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/alltype-data.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/data/default-context.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/dictionary/dictionary_schema.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/environments/Environments/environment1.properties (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment1.properties)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/environments/Environments/environment2.properties (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/logback-test.xml (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/properties/convert.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/properties/default.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/default.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-data-jinja.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json)0
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-data-velocity.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-velocity.json)0
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-velocity-template.vtl (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-velocity-template.vtl)0
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/default-variable-value-data.json (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-data.json)0
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl)0
-rwxr-xr-xms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/interface.jinja (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/isis.jinja (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/master.jinja (renamed from ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-proto/krotoPlusConfig.asciipb (renamed from ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-proto/pom.xml (renamed from ms/controllerblueprints/modules/blueprint-proto/pom.xml)10
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/pom.xml (renamed from ms/controllerblueprints/modules/blueprint-validation/pom.xml)14
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt)21
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt)20
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt)23
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt)153
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt)42
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt)16
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt)16
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt)11
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt)38
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt)26
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt)17
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt)13
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt)22
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt)17
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt (renamed from ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt)19
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/pom.xml39
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/pom.xml (renamed from ms/controllerblueprints/modules/resource-dict/pom.xml)10
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt)1
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt)26
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt)19
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt)18
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java)11
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java)5
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java (renamed from ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java)7
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt (renamed from ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/data/resource-assignment-input.json (renamed from ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/cyclic.json (renamed from ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/duplicate.json (renamed from ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json)0
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/success.json (renamed from ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json)0
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/pom.xml8
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt35
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt7
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibGenericService.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/PrimaryDBLibGenericService.kt (renamed from ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt)11
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt40
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt16
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt19
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt10
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt18
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt25
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintCatalogServiceImpl.kt22
-rwxr-xr-xms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt50
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt30
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt54
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt16
-rw-r--r--ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties1
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt15
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt13
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt48
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/DmaapClientProperties.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt86
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcExtensions.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt31
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt34
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BasicAuthGrpcClientService.kt17
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt29
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/GrpcLoggerService.kt33
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcClientService.kt34
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcServerService.kt18
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TokenAuthGrpcClientService.kt37
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt132
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcServerTest.kt39
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt35
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-chain.pem60
-rw-r--r--ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-key.pem100
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageExtensions.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt1
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/kafka/AbstractKafkaTopologyComponents.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt25
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt24
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt13
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt20
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerService.kt8
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt28
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt81
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt27
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerServiceTest.kt65
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerServiceTest.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt7
-rwxr-xr-xms/blueprintsprocessor/modules/commons/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt31
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt7
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt41
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt49
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/ApiDataUtils.kt (renamed from ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt)102
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt62
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingsTest.kt (renamed from ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingTests.kt)13
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt5
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt6
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt29
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt59
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt100
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt36
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/SSLRestClientService.kt27
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt13
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/utils/WebClientUtils.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt134
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt221
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt11
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt20
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt12
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt2
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt27
-rw-r--r--ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt27
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml5
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt82
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt62
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt179
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt76
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt13
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt14
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt14
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt14
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt25
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt40
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt13
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt18
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt13
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt39
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt42
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt52
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt145
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt15
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt5
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt12
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt10
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt9
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepository.kt (renamed from ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt)16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt36
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt86
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BlueprintSortByOption.kt (renamed from ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/SortByOptionsEnum.kt)2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt147
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt138
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt25
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt60
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt18
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt31
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt28
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryReactRepositoryTest.kt (renamed from ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt)14
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt11
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/pom.xml3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt24
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/SecurityEncryptionConfiguration.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ApplicationHealth.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt7
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/Metrics.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/MetricsResponse.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceName.kt2
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServicesCheckResponse.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/WebClientEnpointResponse.kt3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/EndPointExecution.kt13
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/AbstractHealthCheck.kt13
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/BluePrintProcessorHealthCheck.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/SDCListenerHealthCheck.kt16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.kt99
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/SecurityConfigurationTest.kt1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedHealth.kt16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedMetrics.kt16
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedHealthService.kt23
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedMetricsService.kt28
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt18
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml1
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt85
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt76
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt62
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt24
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt60
-rwxr-xr-xms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt23
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt41
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt40
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt44
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt51
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt28
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt21
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt29
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt60
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt19
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/UtilsTest.kt (renamed from ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt)3
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt12
-rw-r--r--ms/blueprintsprocessor/modules/pom.xml1
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/pom.xml8
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt40
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractServiceFunction.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt47
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt106
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt148
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt15
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt70
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt77
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt31
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt48
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt5
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt11
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt196
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt50
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionServiceTest.kt64
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt36
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt33
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHostTest.kt13
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt24
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleTest.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt29
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt29
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt22
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt29
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt84
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt24
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt20
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt59
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt39
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt24
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt48
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt23
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt14
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml61
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py12
-rwxr-xr-xms/controllerblueprints/README.md13
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt78
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt243
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt27
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt116
-rw-r--r--ms/controllerblueprints/modules/pom.xml91
-rw-r--r--ms/controllerblueprints/parent/pom.xml453
-rw-r--r--ms/controllerblueprints/pom.xml49
-rw-r--r--ms/pom.xml5
-rw-r--r--ms/py-executor/README5
-rw-r--r--ms/py-executor/README.md35
-rw-r--r--ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2.py528
-rw-r--r--ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2_grpc.py111
-rw-r--r--ms/py-executor/certs/py-executor/py-executor-chain.pem60
-rw-r--r--ms/py-executor/certs/py-executor/py-executor-key.pem100
-rw-r--r--ms/py-executor/certs/py-executor/py-executor.conf43
-rw-r--r--ms/py-executor/configuration-local.ini13
-rw-r--r--ms/py-executor/requirements.txt4
-rw-r--r--ms/sdclistener/application/pom.xml19
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java5
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java28
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/actuator/indicator/SDCListenerCustomIndicator.java26
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java12
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java15
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java8
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java4
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java5
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java13
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java28
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java4
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java35
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java2
-rw-r--r--ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java9
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java19
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java5
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java3
-rw-r--r--ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java26
-rwxr-xr-xms/sdclistener/parent/pom.xml29
-rw-r--r--pom.xml53
746 files changed, 15642 insertions, 8397 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..ed85a2b18
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,5 @@
+[*.{kt, kts}]
+# Comma-separated list of rules to disable (Since 0.34.0)
+# Note that rules in any ruleset other than the standard ruleset will need to be prefixed
+# by the ruleset identifier.
+disabled_rules = import-ordering \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..8513e0f98
--- /dev/null
+++ b/README.md
@@ -0,0 +1,7 @@
+## Format code with ktlint checkstyle tool use the following command
+
+mvn process-source -P format
+
+
+## Reference
+https://github.com/pinterest/ktlint
diff --git a/cds-ui/client-frankfurt/src/app/app.component.html b/cds-ui/client-frankfurt/src/app/app.component.html
deleted file mode 100644
index 0680b43f9..000000000
--- a/cds-ui/client-frankfurt/src/app/app.component.html
+++ /dev/null
@@ -1 +0,0 @@
-<router-outlet></router-outlet>
diff --git a/cds-ui/client-frankfurt/src/app/common/core/services/api.service.ts b/cds-ui/client-frankfurt/src/app/common/core/services/api.service.ts
deleted file mode 100644
index b26558b01..000000000
--- a/cds-ui/client-frankfurt/src/app/common/core/services/api.service.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-
-/*
-============LICENSE_START==========================================
-===================================================================
-Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
-
-Modifications Copyright (C) 2019 Orange
-
-===================================================================
-
-Unless otherwise specified, all software contained herein is licensed
-under the Apache License, Version 2.0 (the License);
-you may not use this software 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============================================
-*/
-export const GlobalContants = {
- endpoints: {},
- cbawizard: {
- stepsRequired:
- {
- stepCount: 4,
- steps: [{
- name: 'CBA Metadata',
- componentURL: '/controllerBlueprint/selectTemplate',
- label: 'CBA Metadata',
- link: '/blueprint/selectTemplate',
- index: 0,
- component: 'SelectTemplateComponent'
- },
- {
- name: 'Controller Blueprint Designer',
- componentURL: '/controllerBlueprint/modifyTemplate',
- label: 'Controller Blueprint Designer',
- link: '/blueprint/modifyTemplate',
- index: 1,
- component: 'ModifyTemplateComponent'
- },
- {
- name: 'Test',
- componentURL: '/controllerBlueprint/testTemplate',
- label: 'Test',
- link: '/blueprint/testTemplate',
- index: 2,
- component: 'TestTemplateComponent'
- },
- {
- name: 'Deploy',
- componentURL: '/controllerBlueprint/deployTemplate',
- label: 'Deploy',
- link: '/blueprint/deployTemplate',
- index: 3,
- component: 'DeployTemplateComponent'
- }]
- }
- },
- datadictionary: {
- stepsRequired:
- {
- stepCount: 3,
- steps: [{
- name: 'Resource Creation', componentURL: '/dataDictionary/selectTemplate',
- label: 'Resource Creation',
- component: 'ResourceCreationComponent'
-
- },
- {
- name: 'Edit/Validate', componentURL: '/dataDictionary/modifyTemplate',
- label: 'Edit/Validate',
- component: 'ResourceEditComponent'
- },
- {
- name: 'Save', componentURL: '/dataDictionary/saveTemplate',
- label: 'Save Resource',
- component: 'SaveResourceComponent'
- }]
- }
-
- }
-};
-
-export const BlueprintURLs = {
- getAllBlueprints: '/controllerblueprint/all',
- searchByTag: '/controllerblueprint/searchByTags/',
- save: '/controllerblueprint/create-blueprint',
- publish: '/controllerblueprint/publish',
- enrich: '/controllerblueprint/enrich-blueprint',
- download: '/controllerblueprint/download-blueprint/',
- deploy: '/controllerblueprint/deploy-blueprint',
- getMetaDate: '/controllerblueprint/meta-data/'
-};
-
-export const ResourceDictionaryURLs = {
- saveResourceDictionary: '/resourcedictionary/save',
- searchResourceDictionaryByTags: '/resourcedictionary/search',
- searchResourceDictionaryByName: '',
- getSources: '/resourcedictionary/source-mapping',
- getModelType: '/resourcedictionary/model-type',
- getDataType: '/resourcedictionary/model-type/by-definition/data_type'
-};
-
-export const ControllerCatalogURLs = {
- searchControllerCatalogByTags: '/controllercatalog/search',
- saveControllerCatalog: '/controllercatalog/save',
- getDefinition: '/controllercatalog/model-type/by-definition',
- getDerivedFrom: '/controllercatalog/model-type/by-derivedfrom'
-};
-
-
-
-import {Injectable} from '@angular/core';
-import {HttpClient, HttpHeaders, HttpResponse, HttpHeaderResponse} from '@angular/common/http';
-import {Observable} from 'rxjs';
-
-@Injectable()
-export class ApiService {
-
- constructor(private httpClient: HttpClient) {
- }
-
- get(url: string, params?: any): Observable<any> {
- return this.httpClient.get(url, params);
- }
-
- post(url: string, body: any | null, options?: any): Observable<any> {
-
- return this.httpClient.post(url, body, options);
- }
-}
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.ts
deleted file mode 100644
index 2d3557cb1..000000000
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { Component, OnInit, ViewEncapsulation } from '@angular/core';
-
-@Component({
- selector: 'app-designer',
- templateUrl: './designer.component.html',
- styleUrls: ['./designer.component.css'],
- encapsulation: ViewEncapsulation.None
-})
-export class DesignerComponent implements OnInit {
-
- private controllerSideBar: boolean;
- private attributesSideBar: boolean;
- constructor() {
- this.controllerSideBar = true;
- this.attributesSideBar = false;
- }
- private _toggleSidebar1() {
- this.controllerSideBar = !this.controllerSideBar;
- }
- private _toggleSidebar2() {
- this.attributesSideBar = !this.attributesSideBar;
- }
-
-
- ngOnInit() {
- }
-}
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.module.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.module.ts
deleted file mode 100644
index 63b84ebb8..000000000
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.module.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import {NgModule} from '@angular/core';
-import {CommonModule} from '@angular/common';
-import {PackagesRoutingModule} from './packages.routing.module';
-import {NgbPaginationModule} from '@ng-bootstrap/ng-bootstrap';
-import { DesignerComponent } from './designer/designer.component';
-import { SidebarModule } from 'ng-sidebar';
-
-
-@NgModule({
- declarations: [DesignerComponent],
- imports: [
- CommonModule,
- PackagesRoutingModule,
- NgbPaginationModule,
- SidebarModule.forRoot(),
- ],
- providers: [],
- bootstrap: []
-})
-export class PackagesModule {
-}
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.routing.module.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.routing.module.ts
deleted file mode 100644
index dc4856806..000000000
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.routing.module.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import {NgModule} from '@angular/core';
-import {Routes, RouterModule} from '@angular/router';
-import { DesignerComponent } from './designer/designer.component';
-
-
-const routes: Routes = [
- { path: 'designer', component: DesignerComponent },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
-})
-export class PackagesRoutingModule {
-}
diff --git a/cds-ui/client-frankfurt/src/styles.css b/cds-ui/client-frankfurt/src/styles.css
deleted file mode 100644
index 0a88e5d79..000000000
--- a/cds-ui/client-frankfurt/src/styles.css
+++ /dev/null
@@ -1,778 +0,0 @@
-html, body{
- height: 100%;
-}
-body{
- background: #FAFAFA !important;
- margin: 0;
- font-family: 'HelvNeueOrange', 'Helvetica Neue', sans-serif !important;
- color: #1B3E6F !important;
-}
-*:focus{
- outline: none;
-}
-
-/*Bootstrap*/
-.custom-control-label::before{
- border: solid 1px #1B3E6F !important;
- border-radius: 0 !important;
-}
-.custom-control-input:checked ~ .custom-control-label::before{
- background: #1B3E6F !important;
-}
-
-/*Components*/
-/**Tab Nav**/
-.nav-tabs{
- border-bottom-color: #ECEDF2 !important;
-}
-.nav-link{
- padding: 15px 20px 15px 0 !important;
- text-transform: uppercase !important;
- font-size: 12px;
- font-weight: bold;
- color: #C3CDDB !important;
- border: none !important;
-}
-.nav-tabs .nav-link:focus,
-.nav-tabs .nav-link:hover{
- border: 0 !important;
-}
-.nav-tabs .nav-link:hover{
- color: #1B3E6F !important;
-}
-.nav-tabs .nav-link.active{
- color: #1B3E6F !important;
- background: transparent !important;
- border: 0 !important;
- border-bottom: solid 2px #1B3E6F !important;
-}
-.nav-tabs .nav-link::before{
- content: "|";
- padding-right: 20px !important;
- color: #C3CDDB;
- font-weight: normal;
-}
-.nav-tabs .nav-link:first-child::before{
- content: none;
-}
-.nav-tabs .nav-link:first-child{
- padding-left: 20px !important;
-}
-/**Sliding Search Input**/
-.searchBox{
- position: absolute;
- top: 0%;
- right: 0%;
- transform: translate(0%,-0%);
- height: 40px;
-}
-.searchButton{
- float: right;
- margin-top: 14px;
- padding-left: 0 !important;
- padding-right: 24px !important;
- width: 60px;
- height: 24px;
- background: url(../src/assets/img/icon-search.svg) center center no-repeat;
- background-size: 28%;
- border: 0 !important;
- border-right: solid 1px #1B3E6F !important;
- display: flex;
- justify-content: center;
- align-items: center;
- transition: 0.4s;
-}
-.searchBox:hover > .searchInput{
- width: 240px;
- border-bottom: solid 1px #C3CDDB;
-}
-.searchBox:hover > .searchButton{
- color: #1B3E6F;
-}
-.searchInput{
- border: none;
- background: none;
- outline: none;
- float: left;
- padding: 0;
- color: #1B3E6F;
- font-size: 14px;
- transition: 0.4s;
- line-height: 40px;
- width: 0px;
-}
-.searchInput::placeholder{
- color: #BABBC3;
-}
-/**Drop Down Menu**/
-.dropdown{
- position: relative;
- display: inline-block;
- text-align: left;
- width: 132px;
- z-index: 200;
-}
-.dropdown-text{
- cursor: pointer;
- position: relative;
- text-indent: 10px;
- line-height: 32px;
- background-color: #eee;
- border: 1px solid #ccc;
- border-radius: 3px;
- box-shadow: 0 1px 0 rgba(255,255,255, .9) inset, 0 1px 3px rgba(0,0,0, .1);
- width: 100%;
-}
-.dropdown-text:after{
- position: absolute;
- right: 6px;
- top: 15px;
- content: '';
- width: 0px;
- height: 0px;
- border-style: solid;
- border-width: 5px 4px 0 4px;
- border-color: #555 transparent transparent transparent;
-}
-.dropdown-toggle{
- font-size: 0;
- z-index: 1;
- cursor: pointer;
- position: absolute;
- top: 0;
- border: none;
- padding: 0;
- margin: 0 0 0 1px;
- background: transparent;
- text-indent: -10px;
- height: 34px;
- width: 100%;
-}
-.dropdown-toggle:focus{
- outline: 0;
-}
-.dropdown-content{
- position: absolute;
- top: 32px;
- width: 140px;
- margin: 0;
- padding: 0;
- opacity: 0;
- visibility:hidden;
- -webkit-transition: all .25s ease;
- -moz-transition: all .25s ease;
- -ms-transition: all .25s ease;
- -o-transition: all .25s ease;
- transition: all .25s ease;
- list-style-type: none;
- border-radius: 3px;
- text-indent: 10px;
- line-height: 32px;
- background-color: #eee;
- border: 1px solid #ccc;
-}
-.dropdown-content a{
- display: block;
-}
-.dropdown-content a:hover{
- background: #e8e8e8;
-}
-.dropdown-toggle:hover ~ .dropdown-text,
-.dropdown-toggle:focus ~ .dropdown-text{
- background-color: #e8e8e8;
-}
-.dropdown-toggle:focus ~ .dropdown-text{
- box-shadow: 0 1px 3px rgba(0,0,0, .2) inset, 0 1px 0 rgba(255,255,255, 0.8);
- z-index: 2;
-}
-.dropdown-toggle:focus ~ .dropdown-text:after{
- border-width: 0 4px 5px 4px;
- border-color: transparent transparent #555 transparent;
-}
-.dropdown-content:hover,
-.dropdown-toggle:focus ~ .dropdown-content{
- opacity: 1;
- visibility:visible;
- top: 42px;
-}
-/**Card**/
-/* Hover Shadow */
-@keyframes hover {
- 50% {
- transform: translateY(-3px);
- }
- 100% {
- transform: translateY(-6px);
- }
-}
-@keyframes card {
- 0% {
- transform: translateY(6px);
- opacity: .3;
- }
- 50% {
- transform: translateY(3px);
- opacity: .8;
- }
- 100% {
- transform: translateY(6px);
- opacity: .3;
- }
-}
-.card {
- /* display: inline-block;
- position: relative;
- transition-duration: 0.2s;
- transition-property: transform;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
- transform: translateZ(0); */
- margin-bottom: 25px !important;
- box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-}
-/* .card:before {
- pointer-events: none;
- position: absolute;
- z-index: -1;
- content: '';
- top: 100%;
- left: 5%;
- height: 10px;
- width: 90%;
- opacity: 0;
- background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
- transition-duration: 0.2s;
- transition-property: transform opacity;
-} */
-/* .card:hover {
- transform: translateY(-3px);
- animation-name: hover;
- animation-duration: 1s;
- animation-delay: 0.2s;
- animation-timing-function: linear;
- animation-iteration-count: 1;
- animation-direction: alternate;
-}
-.card:hover:before {
- opacity: .4;
- transform: translateY(3px);
- animation-name: card;
- animation-duration: 1s;
- animation-delay: .2s;
- animation-timing-function: linear;
- animation-iteration-count: 1;
- animation-direction: alternate;
-} */
-.card-body{
- padding: 20px !important;
-}
-
-/*Main Container*/
-.main-container{
- padding: 0 !important;
-}
-/*Page Title*/
-.page-title{
- padding: 21px 30px;
- background:#fff;
- border-left: solid 1px #FAFAFA;
- margin-bottom: 30px;
- -webkit-box-shadow: 0 4px 10px 0 #eef0f5;
- box-shadow: 0 4px 10px 0 #eef0f5;
- position: relative;
- z-index: 8;
-}
-.page-title h2{
- font-size: 16px;
- font-weight: bold;
-}
-.page-title h2 span{
- color: #BABBC3;
- font-size: 14px;
-}
-/*Content*/
-.body-container{
- padding: 0 30px !important;
-}
-.search-filter-col{
- padding-right: 0 !important;
- border-bottom: solid 1px #ECEDF2 !important;
-}
-/**Packages Filter**/
-.packagesFilter{
- margin-top: 12px;
-}
-.packagesFilter .dropdown-toggle{
- height: 36px !important;
-}
-.packagesFilter .dropdown-toggle:focus ~ .dropdown-text::after{
- border-color: transparent transparent #1B3E6F transparent;
-}
-.packagesFilter .dropdown-text{
- background: transparent;
- border: 0;
- box-shadow: none;
- text-indent: 14px;
- line-height: 30px;
- font-size: 12px;
-}
-.packagesFilter .dropdown-text::after{
- right: 12px;
- border-color: #1B3E6F transparent transparent transparent;
-}
-.packagesFilter .dropdown-toggle:hover ~ .dropdown-text,
-.packagesFilter .dropdown-toggle:focus ~ .dropdown-text{
- background-color: transparent;
- box-shadow: none;
- border-radius: 0;
-}
-.packagesFilter .dropdown-toggle:focus ~ .dropdown-text{
- background: #fff;
- box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
-}
-.packagesFilter .dropdown-text::after{
- top: 12px;
-}
-.packagesFilter .dropdown-content{
- padding: 6px 0 15px;
- background: #fff;
- box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
- border: 0;
- border-top-left-radius: 0;
- border-top-right-radius: 0;
- border-bottom-left-radius: 2px;
- border-bottom-right-radius: 2px;
-}
-.packagesFilter .dropdown-content:hover,
-.packagesFilter .dropdown-toggle:focus ~ .dropdown-content{
- top: 30px;
-}
-.packagesFilter .form-control{
- padding: 12px 9px 12px 38px !important;
- border: 0 !important;
- border-bottom: solid 1px #D7E7F9 !important;
- background: url(../src/assets/img/icon-search.svg) 15px center no-repeat;
- background-size: 4%;
- border-radius: 0 !important;
- color: #1B3E6F;
- font-size: 13px;
-}
-.packagesFilter .form-control::placeholder{
- color: #BABBC3;
-}
-.packagesFilter .form-control:focus{
- box-shadow: none !important;
- border-bottom: solid 1px #1B3E6F !important;
-}
-.packagesFilter .custom-checkbox{
- margin-left: 8px;
-}
-.packagesFilter .custom-control-label{
- line-height: 28px !important;
- font-size: 14px !important;
- text-indent: 6px !important;
-}
-/**Packages Sort**/
-.sort-packages{
- font-size: 12px;
- font-weight: bold;
- color: #C3CDDB;
-}
-.sort-packages .dropdown{
- width: 88px;
-}
-.sort-packages .dropdown-text{
- background: transparent;
- border: 0;
- box-shadow: none;
- color: #1B3E6F;
-}
-.sort-packages .dropdown-text::after{
- border-color: #1B3E6F transparent transparent transparent;
-}
-.sort-packages .dropdown-toggle:focus ~ .dropdown-text::after{
- border-color: transparent transparent #1B3E6F transparent;
-}
-.sort-packages .dropdown-toggle:hover ~ .dropdown-text,
-.sort-packages .dropdown-toggle:focus ~ .dropdown-text{
- box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
- background: #fff;
-}
-.sort-packages .dropdown-content:hover,
-.sort-packages .dropdown-toggle:focus ~ .dropdown-content{
- top: 30px;
-}
-.sort-packages .dropdown-content{
- width: 88px;
- padding: 6px 0;
- background: #fff;
- border-radius: 2px;
- border: 0;
- box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
-}
-.sort-packages .dropdown-content a{
- color: #1B3E6F;
- font-size: 12px;
-}
-.sort-packages .dropdown-content a:hover{
- background-color: #F4F9FE;
- text-decoration: unset;
-}
-/**Pagination**/
-.page-item .page-link,
-.page-item.disabled .page-link{
- background: transparent !important;
- border: 0;
- color: #1B3E6F !important;
- font-size: 14px;
-}
-.page-link:hover{
- color: #fff !important;
- background-color: #C3CDDB !important;
- border-radius: 100%;
-}
-/**Packages Cards***/
-/***Package Info Card***/
-.packages-card .card{
- margin: 0 9px;
- border-radius: 2px;
- border: 0;
- box-shadow: 0 2px 6px 0 rgba(47, 83, 151, 0.1);
-}
-.packages-card .card-title{
- margin-bottom: 0 !important;
- font-size: 15px;
- font-weight: bold;
-}
-.packages-card p{
- font-size: 14px;
- color: #D0D7E4;
-}
-/***Add Package Card***/
-.addPaackage-card{
- padding: 10px 0;
- background: #F4F9FE !important;
- border: solid 1px #D7E7F9 !important;
-}
-.addPaackage-card img{
- margin-bottom: 12px;
- margin-top: 8px;
-}
-.addPaackage-card a{
- margin-bottom: 20px;
- padding: 10px 10px 10px 32px;
- font-weight: bold;
- font-size: 10px;
- text-transform: uppercase;
- border-radius: 2px;
- border-width: .5px;
- border-style: solid;
- background-position: 10px center;
- background-repeat: no-repeat;
-}
-.addPaackage-card a:hover{
- text-decoration: unset;
-}
-.btn-create-package,
-.btn-create-package:hover{
- background-color: #1B3E6F;
- border-color: #1B3E6F;
- color: #fff;
- background-image: url(../src/assets/img/icon-create-white.svg);
-}
-.btn-import-package,
-.btn-import-package:hover{
- color: #1B3E6F;
- background-image: url(../src/assets/img/icon-import-blue.svg);
-}
-/***Actions Menu***/
-.packages-card .dropdown{
- width: auto;
- float: right;
-}
-.packages-card .dropdown-text{
- background: transparent;
- border: 0;
- box-shadow: none;
- text-indent: 0;
- line-height: unset;
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
- opacity: .6;
-}
-.packages-card .dropdown-text::after{
- display: none;
-}
-.packages-card .dropdown-text img{
- padding: 9px 7px;
-}
-.packages-card .dropdown-content{
- right: 0;
- width: 120px;
- padding: 6px 0;
- border: 0;
- text-indent: 0;
- border-radius: 2px;
- border-top-left-radius: 0;
- border-top-right-radius: 0;
- background: #1B3E6F;
-}
-.packages-card .dropdown-content a{
- padding-left: 45px;
- color: #fff;
- font-size: 13px;
- background-position: 20px center;
- background-size: 10%;
- background-repeat: no-repeat;
-}
-.packages-card .dropdown-content a:hover{
- background-color: #172B4D;
- text-decoration: unset;
-}
-.packages-card .action-clone a,
-.packages-card .action-clone a:hover{
- background-image: url(../src/assets/img/icon-clone-sm.svg);
-}
-.packages-card .action-archive a,
-.packages-card .action-archive a:hover{
- background-image: url(../src/assets/img/icon-archive-sm.svg);
-}
-.packages-card .action-delete a,
-.packages-card .action-delete a:hover{
- background-image: url(../src/assets/img/icon-delete-sm.svg);
-}
-.packages-card .dropdown-content:hover,
-.packages-card .dropdown-toggle:focus ~ .dropdown-content{
- top: 24px;
-}
-.packages-card .dropdown-toggle:hover ~ .dropdown-text{
- background: transparent;
- opacity: 1;
-}
-.packages-card .dropdown-toggle:focus ~ .dropdown-text{
- opacity: 1;
- background: #1B3E6F;
- box-shadow: none;
-}
-/***Contributers***/
-ul.package-contributers{
- margin-bottom: 0 !important;
- padding-left: 0 !important;
-}
-.package-contributers li{
- list-style: none;
- display: inline-block;
-}
-.package-contributers li{
- margin-left: -5px;
-}
-.package-contributers li:first-child{
- margin-left: 0;
-}
-.package-contributers li:last-child{
- margin-left: 9px;
-}
-.package-contributers button{
- padding: 0 !important;
- border-radius: 100%;
- border: 0 !important;
- /*Hover Effect*/
- -webkit-transition: box-shadow 0.2s ease;
- -moz-transition: box-shadow 0.2s ease;
- transition: box-shadow 0.2s ease;
- -webkit-backface-visibility: hidden;
- backface-visibility: hidden;
- display: inline-block;
- position: relative;
-}
-.package-contributers button:before{
- -webkit-transition: all 0.2s ease;
- -moz-transition: all 0.2s ease;
- transition: all 0.2s ease;
- border-radius: 50%;
- bottom: 0;
- box-shadow: 0 0 0 2px #fff;
- content: "";
- left: 0;
- position: absolute;
- right: 0;
- top: 0;
-}
-.package-contributers button:hover{
- box-shadow: 0 0 0 2px #D7E7F9;
- text-decoration: none;
-}
-.package-contributers button:hover:before{
- -webkit-transform: scale(0.925);
- -moz-transform: scale(0.925);
- -ms-transform: scale(0.925);
- -o-transform: scale(0.925);
- transform: scale(0.925);
- box-shadow: 0 0 0 1px #D7E7F9;
- opacity: 0.5;
-}
-.package-contributers button img{
- width: 28px;
- height: 28px;
- object-fit: cover;
- vertical-align: top;
- border-radius: 100%;
-}
-.package-contributers a{
- font-size: 12px;
- color: #1273EB;
-}
-.package-contributers a:hover{
- text-decoration: unset;
-}
-/***Package Footer***/
-.packages-card .card-footer{
- padding: 0 20px !important;
- background: transparent !important;
- border-top-color: #F7F6F6 !important;
-}
-.packages-card .card-footer .col:first-child{
- border-right: solid 1px #F7F6F6;
-}
-.packages-card .card-footer .btn{
- background-color: transparent !important;
- color: #C3CDDB !important;
- border: 0;
- font-size: 13px;
- opacity: .7;
-}
-.packages-card .card-footer .btn:hover{
- opacity: 1;
-}
-.btn-card-config,
-.btn-card-topology{
- padding: 15px 0 15px 28px !important;
- background-size: 16%;
- background-position: left center;
- background-repeat: no-repeat;
-}
-.btn-card-config{
- background-image: url(../src/assets/img/icon-btn-card-config.svg);
-}
-.btn-card-topology{
- background-image: url(../src/assets/img/icon-btn-card-topology.svg);
-}
-.icon-deployed{
- margin-right: 5px;
- display: inline;
- background: url(../src/assets/img/icon-deploy.svg) center center no-repeat;
-}
-
-
-
-
-
-
-
-
-
-
-/* Border Fade */
-.border-fade {
- display: inline-block;
- transition-duration: 0.3s;
- transition-property: box-shadow;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
- transform: translateZ(0);
- box-shadow: inset 0 0 0 4px #ececec, 0 0 1px rgba(0, 0, 0, 0);
- /* Hack to improve aliasing on mobile/tablet devices */
-}
-.border-fade:hover {
- box-shadow: inset 0 0 0 4px #666, 0 0 1px rgba(0, 0, 0, 0);
- /* Hack to improve aliasing on mobile/tablet devices */
-}
-/*Content*/
-
-/**Title Action Buttons**/
-.page-title-actions li{
- display: inline-block;
- text-align: center;
-}
-.title-action{
- -webkit-transition: box-shadow 0.2s ease;
- -moz-transition: box-shadow 0.2s ease;
- transition: box-shadow 0.2s ease;
- -webkit-backface-visibility: hidden;
- backface-visibility: hidden;
- border-radius: 50%;
- color: #6a75eb;
- display: inline-block;
- font-size: 0.889em;
- height: 4em;
- margin: 0 1em 1em;
- position: relative;
- text-align: center;
- text-transform: lowercase;
- width: 4em;
- line-height: 4em;
-}
-
-.title-action:before{
- -webkit-transition: all 0.2s ease;
- -moz-transition: all 0.2s ease;
- transition: all 0.2s ease;
- border-radius: 50%;
- bottom: 0;
- box-shadow: 0 0 0 1px #000;
- content: "";
- left: 0;
- position: absolute;
- right: 0;
- top: 0;
-}
-.title-action:hover{
- box-shadow: 0 0 0 7px #07819b;
- text-decoration: none;
-}
-.title-action:hover:before{
- -webkit-transform: scale(0.925);
- -moz-transform: scale(0.925);
- -ms-transform: scale(0.925);
- -o-transform: scale(0.925);
- transform: scale(0.925);
- box-shadow: 0 0 0 1px #07819b;
- opacity: 0.5;
-}
-
-/*Animation Button*/
-/**Float**/
-.float {
- display: inline-block;
- transition-duration: 0.3s;
- transition-property: transform;
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
- transform: translateZ(0);
- box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-}
-.float:hover {
- transform: translateY(-5px);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/cds-ui/client/src/app/common/core/store/models/catalog.model.ts b/cds-ui/client/src/app/common/core/store/models/catalog.model.ts
index 2344f3336..6a86185a6 100644
--- a/cds-ui/client/src/app/common/core/store/models/catalog.model.ts
+++ b/cds-ui/client/src/app/common/core/store/models/catalog.model.ts
@@ -19,11 +19,13 @@
*/
export interface ICatalog {
- Model_Name: string;
- User_id: string;
- _tags: string;
- _type: string;
- Derived_From: string;
- _description : string;
- definition: object[];
+ modelName: string;
+ derivedFrom: string;
+ definitionType : string;
+ definition: object;
+ description: string;
+ version: String;
+ tags: String;
+ creationDate: String;
+ updatedBy: String;
} \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html
index 8c71edfa7..ba32a2ede 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.html
@@ -23,26 +23,26 @@
<mat-card-content>
<form [formGroup]="CatalogFormData" (ngSubmit)="CreateCatalog()">
<mat-form-field class="form-field">
- <input matInput placeholder="Model Name" formControlName="Model_Name">
+ <input matInput placeholder="Model Name" formControlName="modelName">
</mat-form-field>
<mat-form-field class="form-field" >
- <input matInput placeholder="User Id" formControlName="User_id">
+ <input matInput placeholder="User Id" formControlName="updatedBy">
</mat-form-field>
<mat-form-field class="form-field">
- <input matInput placeholder="Tags" formControlName="_tags">
+ <input matInput placeholder="Tags" formControlName="tags">
</mat-form-field>
<mat-form-field class="form-field">
- <mat-select matInput placeholder="Definition Type" formControlName="_type">
- <mat-option [value]="item" *ngFor="let item of definitionType">{{item.definitionType}}</mat-option>
+ <mat-select matInput placeholder="Definition Type" formControlName="definitionType">
+ <mat-option [value]="item" *ngFor="let item of definitionType">{{item}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field" >
- <mat-select matInput placeholder="Derived From" formControlName="Derived_From">
- <mat-option [value]="item" *ngFor="let item of derivedFrom">{{item.derivedFrom}}</mat-option>
+ <mat-select matInput placeholder="Derived From" formControlName="derivedFrom">
+ <mat-option [value]="item" *ngFor="let item of derivedFrom">{{item}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="form-field" >
- <textarea matInput placeholder="Description" formControlName="_description"></textarea>
+ <textarea matInput placeholder="Description" formControlName="description"></textarea>
</mat-form-field>
<br>
<div >
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts
index 91c6f2835..3b8294db9 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/create-catalog/create-catalog.component.ts
@@ -41,21 +41,21 @@ export class CreateCatalogComponent implements OnInit {
@ViewChild(JsonEditorComponent) editor: JsonEditorComponent;
options = new JsonEditorOptions();
data:any;
- derivedFrom: any[] = [{derivedFrom: 'tosca.nodes.Component'},{derivedFrom:'tosca.nodes.VNF'},{derivedFrom:'tosca.nodes.Artifact'},{derivedFrom:'tosca.nodes.ResourceSource'}, {derivedFrom:'tosca.nodes.Workflow'},{derivedFrom:'tosca.nodes.Root'}];
- definitionType: any[] = [{definitionType: 'node_type'}];
+ derivedFrom: any[] = ['tosca.nodes.Component','tosca.nodes.VNF','tosca.nodes.Artifact','tosca.nodes.ResourceSource','tosca.nodes.Workflow','tosca.nodes.Root'];
+ definitionType: any[] = ['node_type'];
ccState: Observable<ICatalogState>;
catalog: ICatalog;
constructor(private formBuilder: FormBuilder, private store: Store<IAppState>, private catalogCreateService: CreateCatalogService, private alertService: NotificationHandlerService) {
this.ccState = this.store.select('catalog');
this.CatalogFormData = this.formBuilder.group({
- Model_Name: ['', Validators.required],
- User_id: ['', Validators.required],
- _tags: ['', Validators.required],
- _type: ['', Validators.required],
- Derived_From: ['', Validators.required],
- _description : ['', Validators.required]
- });
+ modelName: ['', Validators.required],
+ updatedBy: ['', Validators.required],
+ tags: ['', Validators.required],
+ definitionType: ['', Validators.required],
+ derivedFrom: ['', Validators.required],
+ description : ['', Validators.required]
+ });
}
ngOnInit() {
this.options.mode = 'text';
@@ -90,8 +90,14 @@ export class CreateCatalogComponent implements OnInit {
// })
}
CreateCatalog(){
- this.catalog = Object.assign({}, this.CatalogFormData.value);
- this.catalog.definition=this.data;
+ this.catalog.modelName=this.CatalogFormData.controls['modelName'].value;
+ this.catalog.updatedBy=this.CatalogFormData.controls['updatedBy'].value
+ this.catalog.tags=this.CatalogFormData.controls['tags'].value
+ this.catalog.definitionType=this.CatalogFormData.controls['definitionType'].value
+ this.catalog.derivedFrom=this.CatalogFormData.controls['derivedFrom'].value
+ this.catalog.description=this.CatalogFormData.controls['description'].value
+ this.catalog.definition=this.data;
+ console.log(this.catalog);
let catalogState = {
catalog: this.catalog
}
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html
index ca4a679ed..34502bc95 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.html
@@ -21,27 +21,30 @@
<div>
<h1 mat-dialog-title>Details</h1>
<mat-dialog-content [formGroup]="CatalogFormData">
- <mat-form-field class="form-field">
- <input matInput placeholder="Model Name" formControlName="Model_Name">
- </mat-form-field>
- <mat-form-field class="form-field" >
- <input matInput placeholder="User Id" formControlName="User_id">
- </mat-form-field>
- <mat-form-field class="form-field">
- <input matInput placeholder="Tags" formControlName="_tags">
- </mat-form-field>
- <mat-form-field class="form-field">
+ <mat-form-field class="form-field">
+ <input matInput placeholder="Model Name" formControlName="modelName">
+ </mat-form-field>
+ <mat-form-field class="form-field" >
+ <input matInput placeholder="User Id" formControlName="updatedBy">
+ </mat-form-field>
+ <mat-form-field class="form-field">
+ <input matInput placeholder="Tags" formControlName="tags">
+ </mat-form-field>
+ <mat-form-field class="form-field">
<!-- <mat-select matInput placeholder="Definition Type" formControlName="_type">
<mat-option [value]="item" *ngFor="let item of definitionType">{{item.definitionType}}</mat-option>
</mat-select> -->
- <input matInput placeholder="Definition Type" formControlName="_type">
- </mat-form-field>
- <mat-form-field class="form-field" >
+ <input matInput placeholder="Definition Type" formControlName="definitionType">
+ </mat-form-field>
+ <mat-form-field class="form-field" >
<!-- <mat-select matInput placeholder="Derived From" formControlName="Derived_From">
<mat-option [value]="item" *ngFor="let item of derivedFrom">{{item.derivedFrom}}</mat-option>
</mat-select> -->
- <input matInput placeholder="Derived From" formControlName="Derived_From">
- </mat-form-field>
+ <input matInput placeholder="Derived From" formControlName="derivedFrom">
+ </mat-form-field>
+ <mat-form-field class="form-field" >
+ <textarea matInput placeholder="Definition" formControlName="definition"></textarea>
+ </mat-form-field>
<br>
</mat-dialog-content>
<mat-dialog-actions *ngIf="!isDisabled">
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts
index 215f311e9..b2748d871 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/catalog-data-dialog/catalog-data-dialog.component.ts
@@ -62,12 +62,13 @@ export class CatalogDataDialogComponent implements OnInit{
this.ccState = this.store.select('catalog');
this.CatalogFormData = this.formBuilder.group({
- Model_Name: [{value:this.property[0], disabled: this.isDisabled}, Validators.required],
- User_id: [{value:this.property[8], disabled: this.isDisabled}, Validators.required],
- _tags: [{value:this.property[6], disabled: this.isDisabled}, Validators.required],
- _type: [{value:this.property[2], disabled: this.isDisabled}, Validators.required],
- Derived_From: [{value:this.property[1], disabled: this.isDisabled}, Validators.required],
- });
+ modelName: [{value:this.property[0], disabled: this.isDisabled}, Validators.required],
+ derivedFrom: [{value:this.property[1], disabled: this.isDisabled}, Validators.required],
+ definitionType: [{value:this.property[2], disabled: this.isDisabled}, Validators.required],
+ definition: [{value:JSON.stringify(this.property[3]), disabled: this.isDisabled}, Validators.required],
+ tags: [{value:this.property[6], disabled: this.isDisabled}, Validators.required],
+ updatedBy: [{value:this.property[8], disabled: this.isDisabled}, Validators.required],
+ });
}
ngOnInit(){
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html
index c8452e2ff..5262f1744 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.html
@@ -19,7 +19,7 @@
*/-->
<form class="search-form" [formGroup]="myControl">
<mat-form-field class="search-full-width">
- <input matInput type="text" [(ngModel)]="searchText" placeholder="Search Catalog" formControlName="search_input">
+ <input matInput type="text" placeholder="Search Catalog" formControlName="search_input" #searchText>
<button matSuffix mat-icon-button (click)="fetchCatalogByName()">
<mat-icon>search</mat-icon>
</button>
diff --git a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts
index 717e1088f..3fb4530e6 100644
--- a/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts
+++ b/cds-ui/client/src/app/feature-modules/controller-catalog/search-catalog/search-catalog.component.ts
@@ -109,19 +109,20 @@ export class SearchCatalogComponent implements OnInit {
if(result == undefined || result == null){
console.log("dialogbox is closed");
}else{
- this.catalog.Model_Name=result['Model_Name'];
- this.catalog.User_id=result['User_id'];
- this.catalog._tags=result['_tags'];
- this.catalog._type=result['_type'];
- this.catalog.Derived_From=result['Derived_From'];
- console.log(this.catalog);
- this.catalogCreateService.saveCatalog(this.catalog)
- .subscribe(response=>{
+ this.catalog.modelName=result['modelName'];
+ this.catalog.derivedFrom=result['derivedFrom'];
+ this.catalog.definitionType=result['definitionType'];
+ this.catalog.definition=result['definition'];
+ this.catalog.tags=result['tags'];
+ this.catalog.updatedBy=result['updatedBy'];
+ console.log(this.catalog);
+ this.catalogCreateService.saveCatalog(this.catalog)
+ .subscribe(response=>{
this.alertService.success("save success"+ response)
- },
- error=>{
- this.alertService.error('Error saving resources');
- })
+ },
+ error=>{
+ this.alertService.error('Error saving resources');
+ })
}
});
}
diff --git a/cds-ui/client-frankfurt/README.md b/cds-ui/designer-client/README.md
index de895422e..444e36963 100644
--- a/cds-ui/client-frankfurt/README.md
+++ b/cds-ui/designer-client/README.md
@@ -1,4 +1,4 @@
-# ClientFrankfurt
+# designer-client
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.9.
diff --git a/cds-ui/client-frankfurt/angular.json b/cds-ui/designer-client/angular.json
index 97052b879..954ad4ec9 100644
--- a/cds-ui/client-frankfurt/angular.json
+++ b/cds-ui/designer-client/angular.json
@@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
- "client-frankfurt": {
+ "designer-client": {
"projectType": "application",
"schematics": {},
"root": "",
@@ -13,7 +13,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
- "outputPath": "dist/client-frankfurt",
+ "outputPath": "dist/designer-client",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
@@ -28,10 +28,17 @@
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/@angular/material/prebuilt-themes/purple-green.css",
"./node_modules/font-awesome/css/font-awesome.css",
+ "./node_modules/jointjs/css/layout.css",
+ "./node_modules/jointjs/css/themes/material.css",
+ "./node_modules/jointjs/css/themes/default.css",
"src/assets/css/orangeHelvetica.css"
],
"scripts": [
+ "./node_modules/jquery/dist/jquery.min.js",
+ "./node_modules/lodash/index.js",
+ "./node_modules/backbone/backbone.js",
+ "./node_modules/jointjs/dist/joint.js"
]
},
"configurations": {
@@ -69,18 +76,18 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
- "browserTarget": "client-frankfurt:build"
+ "browserTarget": "designer-client:build"
},
"configurations": {
"production": {
- "browserTarget": "client-frankfurt:build:production"
+ "browserTarget": "designer-client:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
- "browserTarget": "client-frankfurt:build"
+ "browserTarget": "designer-client:build"
}
},
"test": {
@@ -124,16 +131,16 @@
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
- "devServerTarget": "client-frankfurt:serve"
+ "devServerTarget": "designer-client:serve"
},
"configurations": {
"production": {
- "devServerTarget": "client-frankfurt:serve:production"
+ "devServerTarget": "designer-client:serve:production"
}
}
}
}
}
},
- "defaultProject": "client-frankfurt"
+ "defaultProject": "designer-client"
} \ No newline at end of file
diff --git a/cds-ui/client-frankfurt/browserslist b/cds-ui/designer-client/browserslist
index 80848532e..80848532e 100644
--- a/cds-ui/client-frankfurt/browserslist
+++ b/cds-ui/designer-client/browserslist
diff --git a/cds-ui/client-frankfurt/e2e/protractor.conf.js b/cds-ui/designer-client/e2e/protractor.conf.js
index 73e4e6806..73e4e6806 100644
--- a/cds-ui/client-frankfurt/e2e/protractor.conf.js
+++ b/cds-ui/designer-client/e2e/protractor.conf.js
diff --git a/cds-ui/client-frankfurt/e2e/src/app.e2e-spec.ts b/cds-ui/designer-client/e2e/src/app.e2e-spec.ts
index 3f88c1b54..e399c42a3 100644
--- a/cds-ui/client-frankfurt/e2e/src/app.e2e-spec.ts
+++ b/cds-ui/designer-client/e2e/src/app.e2e-spec.ts
@@ -10,7 +10,7 @@ describe('workspace-project App', () => {
it('should display welcome message', () => {
page.navigateTo();
- expect(page.getTitleText()).toEqual('client-frankfurt app is running!');
+ expect(page.getTitleText()).toEqual('designer-client app is running!');
});
afterEach(async () => {
diff --git a/cds-ui/client-frankfurt/e2e/src/app.po.ts b/cds-ui/designer-client/e2e/src/app.po.ts
index f8bd473c7..f8bd473c7 100644
--- a/cds-ui/client-frankfurt/e2e/src/app.po.ts
+++ b/cds-ui/designer-client/e2e/src/app.po.ts
diff --git a/cds-ui/client-frankfurt/e2e/tsconfig.json b/cds-ui/designer-client/e2e/tsconfig.json
index 39b800f78..39b800f78 100644
--- a/cds-ui/client-frankfurt/e2e/tsconfig.json
+++ b/cds-ui/designer-client/e2e/tsconfig.json
diff --git a/cds-ui/client-frankfurt/karma.conf.js b/cds-ui/designer-client/karma.conf.js
index a0f1a8708..45660e8cb 100644
--- a/cds-ui/client-frankfurt/karma.conf.js
+++ b/cds-ui/designer-client/karma.conf.js
@@ -16,7 +16,7 @@ module.exports = function (config) {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
- dir: require('path').join(__dirname, './coverage/client-frankfurt'),
+ dir: require('path').join(__dirname, './coverage/designer-client'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
diff --git a/cds-ui/client-frankfurt/package.json b/cds-ui/designer-client/package.json
index c1ba7ffec..78e26a4c8 100644
--- a/cds-ui/client-frankfurt/package.json
+++ b/cds-ui/designer-client/package.json
@@ -1,5 +1,5 @@
{
- "name": "client-frankfurt",
+ "name": "designer-client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
@@ -31,7 +31,11 @@
"ng-sidebar": "^9.1.1",
"rxjs": "~6.4.0",
"tslib": "^1.10.0",
- "zone.js": "~0.9.1"
+ "zone.js": "~0.9.1",
+ "jquery": "^3.1.1",
+ "backbone": "^1.4.0",
+ "jointjs": "^3.0.4",
+ "lodash": "^3.10.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.9",
@@ -41,6 +45,10 @@
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
+ "@types/backbone": "^1.4.1",
+ "@types/jointjs": "^2.0.0",
+ "@types/jquery": "^3.3.31",
+ "@types/lodash": "^3.10.1",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-marbles": "^0.6.0",
diff --git a/cds-ui/client-frankfurt/proxy.conf.json b/cds-ui/designer-client/proxy.conf.json
index 11ed26767..11ed26767 100644
--- a/cds-ui/client-frankfurt/proxy.conf.json
+++ b/cds-ui/designer-client/proxy.conf.json
diff --git a/cds-ui/client-frankfurt/src/app/app-routing.module.ts b/cds-ui/designer-client/src/app/app-routing.module.ts
index e55393b03..c6e42cb0b 100644
--- a/cds-ui/client-frankfurt/src/app/app-routing.module.ts
+++ b/cds-ui/designer-client/src/app/app-routing.module.ts
@@ -24,6 +24,7 @@ import {Routes, RouterModule} from '@angular/router';
const routes: Routes = [
{path: 'packages', loadChildren: './modules/feature-modules/packages/packages.module#PackagesModule'},
+ // { path: '', component: MainAppComponent },
{
path: '',
redirectTo: 'packages',
diff --git a/cds-ui/client-frankfurt/src/app/app.component.css b/cds-ui/designer-client/src/app/app.component.css
index e69de29bb..e69de29bb 100644
--- a/cds-ui/client-frankfurt/src/app/app.component.css
+++ b/cds-ui/designer-client/src/app/app.component.css
diff --git a/cds-ui/designer-client/src/app/app.component.html b/cds-ui/designer-client/src/app/app.component.html
new file mode 100644
index 000000000..693dba7c3
--- /dev/null
+++ b/cds-ui/designer-client/src/app/app.component.html
@@ -0,0 +1,7 @@
+<router-outlet></router-outlet>
+<!-- <app-header></app-header>
+<div class="new-wrapper">
+ <div class="container-fluid main-container">
+ <router-outlet></router-outlet>
+ </div>
+</div> -->
diff --git a/cds-ui/client-frankfurt/src/app/app.component.spec.ts b/cds-ui/designer-client/src/app/app.component.spec.ts
index b015063ad..037b400b6 100644
--- a/cds-ui/client-frankfurt/src/app/app.component.spec.ts
+++ b/cds-ui/designer-client/src/app/app.component.spec.ts
@@ -41,16 +41,16 @@ describe('AppComponent', () => {
expect(app).toBeTruthy();
});
- it(`should have as title 'client-frankfurt'`, () => {
+ it(`should have as title 'designer-client'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
- expect(app.title).toEqual('client-frankfurt');
+ expect(app.title).toEqual('designer-client');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
- expect(compiled.querySelector('.content span').textContent).toContain('client-frankfurt app is running!');
+ expect(compiled.querySelector('.content span').textContent).toContain('designer-client app is running!');
});
});
diff --git a/cds-ui/client-frankfurt/src/app/app.component.ts b/cds-ui/designer-client/src/app/app.component.ts
index f60f622ce..03d91759b 100644
--- a/cds-ui/client-frankfurt/src/app/app.component.ts
+++ b/cds-ui/designer-client/src/app/app.component.ts
@@ -28,5 +28,5 @@ import { Component } from '@angular/core';
})
export class AppComponent {
- title = 'client-frankfurt';
+ title = 'designer-client';
}
diff --git a/cds-ui/client-frankfurt/src/app/app.module.ts b/cds-ui/designer-client/src/app/app.module.ts
index c52da5cb9..20b9b4d7b 100644
--- a/cds-ui/client-frankfurt/src/app/app.module.ts
+++ b/cds-ui/designer-client/src/app/app.module.ts
@@ -30,6 +30,9 @@ import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {MatTabsModule} from '@angular/material/tabs';
import {ApiService} from './common/core/services/api.service';
import {HttpClientModule} from '@angular/common/http';
+import {PackagesModule} from './modules/feature-modules/packages/packages.module';
+import { SidebarModule } from 'ng-sidebar';
+import {SharedModulesModule} from './modules/shared-modules/shared-modules.module';
@NgModule({
declarations: [
@@ -43,6 +46,8 @@ import {HttpClientModule} from '@angular/common/http';
NoopAnimationsModule,
MatTabsModule,
HttpClientModule,
+ PackagesModule,
+ SharedModulesModule,
],
providers: [ApiService],
diff --git a/cds-ui/client-frankfurt/src/app/common/constants/app-constants.ts b/cds-ui/designer-client/src/app/common/constants/app-constants.ts
index 11d0598d9..cfe8061f3 100644
--- a/cds-ui/client-frankfurt/src/app/common/constants/app-constants.ts
+++ b/cds-ui/designer-client/src/app/common/constants/app-constants.ts
@@ -88,13 +88,16 @@ export const GlobalContants = {
export const BlueprintURLs = {
getAllBlueprints: '/controllerblueprint/all',
+ getPagedBlueprints: '/controllerblueprint/paged',
searchByTag: '/controllerblueprint/searchByTags/',
save: '/controllerblueprint/create-blueprint',
publish: '/controllerblueprint/publish',
enrich: '/controllerblueprint/enrich-blueprint',
download: '/controllerblueprint/download-blueprint/',
deploy: '/controllerblueprint/deploy-blueprint',
- getMetaDate: '/controllerblueprint/meta-data/'
+ getMetaDate: '/controllerblueprint/meta-data/',
+ countOfAllBluePrints: '/controllerblueprint/list/count',
+ getMetaDatePageable: '/controllerblueprint/metadata/paged'
};
export const ResourceDictionaryURLs = {
diff --git a/cds-ui/designer-client/src/app/common/core/services/api.service.ts b/cds-ui/designer-client/src/app/common/core/services/api.service.ts
new file mode 100644
index 000000000..de8aab886
--- /dev/null
+++ b/cds-ui/designer-client/src/app/common/core/services/api.service.ts
@@ -0,0 +1,51 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
+
+Modifications Copyright (C) 2019 Orange
+
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {Injectable} from '@angular/core';
+import {HttpClient, HttpHeaders, HttpResponse, HttpHeaderResponse, HttpParams} from '@angular/common/http';
+import {Observable, of} from 'rxjs';
+
+@Injectable()
+export class ApiService {
+
+ constructor(private httpClient: HttpClient) {
+ }
+
+ get(url: string, params?: {}): Observable<any> {
+ console.log('params', params);
+ let httpParams = new HttpParams();
+ for (const key in params) {
+ if (params.hasOwnProperty(key)) {
+ httpParams = httpParams.append(key, params[key]);
+ }
+ }
+ const options = {params: httpParams};
+ return this.httpClient.get(url, options);
+ }
+
+ post(url: string, body: any | null, options?: any): Observable<any> {
+
+ return this.httpClient.post(url, body, options);
+ }
+}
diff --git a/cds-ui/designer-client/src/app/common/core/services/api.typed.service.ts b/cds-ui/designer-client/src/app/common/core/services/api.typed.service.ts
new file mode 100644
index 000000000..2f3778c1a
--- /dev/null
+++ b/cds-ui/designer-client/src/app/common/core/services/api.typed.service.ts
@@ -0,0 +1,51 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
+
+Modifications Copyright (C) 2019 Orange
+
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 { Injectable } from '@angular/core';
+import { HttpClient, HttpHeaders, HttpResponse, HttpHeaderResponse, HttpParams } from '@angular/common/http';
+import { Observable, of } from 'rxjs';
+
+@Injectable()
+export class ApiService<T> {
+
+ constructor(private httpClient: HttpClient) {
+ }
+
+ get(url: string, params?: {}): Observable<T[]> {
+ console.log('params', params);
+ let httpParams = new HttpParams();
+ for (const key in params) {
+ if (params.hasOwnProperty(key)) {
+ httpParams = httpParams.append(key, params[key]);
+ }
+ }
+ const options = {params: httpParams};
+ return this.httpClient.get<T[]>(url, options);
+ }
+
+ post(url: string, body: any | null, options?: any): Observable<any> {
+
+ return this.httpClient.post(url, body, options);
+ }
+}
diff --git a/cds-ui/designer-client/src/app/common/core/stores/Store.ts b/cds-ui/designer-client/src/app/common/core/stores/Store.ts
new file mode 100644
index 000000000..1d5b0afc1
--- /dev/null
+++ b/cds-ui/designer-client/src/app/common/core/stores/Store.ts
@@ -0,0 +1,22 @@
+import {Observable, BehaviorSubject} from 'rxjs';
+import { Injectable } from '@angular/core';
+
+export class Store<T> {
+ state$: Observable<T>;
+ private subject: BehaviorSubject<T>;
+
+ protected constructor(initialState: T) {
+ this.subject = new BehaviorSubject(initialState);
+ this.state$ = this.subject.asObservable();
+ }
+
+ get state(): T {
+ return this.subject.getValue();
+ }
+
+ protected setState(nextState: T): void {
+ console.log('setting state', this.subject);
+ this.subject.next(nextState);
+ }
+
+}
diff --git a/cds-ui/designer-client/src/app/common/model/page.ts b/cds-ui/designer-client/src/app/common/model/page.ts
new file mode 100644
index 000000000..7c3a0c4f3
--- /dev/null
+++ b/cds-ui/designer-client/src/app/common/model/page.ts
@@ -0,0 +1,21 @@
+export class Page<T> {
+ content: T[];
+ pageable: {
+ sort: {
+ unsorted: boolean,
+ sorted: boolean,
+ empty: boolean
+ };
+
+ offset: number,
+ pageSize: number,
+ pageNumber: number,
+ paged: boolean,
+ unpaged: boolean,
+ };
+ totalPages: number;
+ totalElements: number;
+ last: boolean;
+ first: boolean;
+ empty: boolean;
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/blueprint.page.mock.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/blueprint.page.mock.ts
new file mode 100644
index 000000000..9e0ce71d2
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/blueprint.page.mock.ts
@@ -0,0 +1,50 @@
+import { BluePrintPage } from './model/BluePrint.model';
+export function getBluePrintPageMock(): BluePrintPage {
+ return {
+ content: [
+ {
+ id: 'bc0dabea-3112-4202-a4b9-6a525bcc19a9',
+ artifactUUId: null,
+ artifactType: 'SDNC_MODEL',
+ artifactVersion: '1.0.0',
+ artifactDescription: 'Controller Blueprint for vLB_CDS123:1.0.0',
+ internalVersion: null,
+ createdDate: '2019-10-30T13:55:16.000Z',
+ artifactName: 'vLB_CDS123',
+ published: 'N',
+ updatedBy: 'Abdelmuhaimen Seaudi',
+ tags: 'test, vDNS-CDS, SCALE-OUT, MARCO'
+ },
+ {
+ id: 'a741913f-2b1b-4eb8-94b3-8c6b08928f0a',
+ artifactUUId: null,
+ artifactType: 'SDNC_MODEL',
+ artifactVersion: '1.0.0',
+ artifactDescription: 'Controller Blueprint for vLB_CDS12312312:1.0.0',
+ internalVersion: null,
+ createdDate: '2019-10-30T14:58:04.000Z',
+ artifactName: 'vLB_CDS12312312',
+ published: 'N',
+ updatedBy: 'Abdelmuhaimen Seaudi',
+ tags: 'test, vDNS-CDS, SCALE-OUT, MARCO'
+ }
+ ],
+ pageable: {
+ sort: {
+ sorted: true,
+ unsorted: false,
+ empty: false
+ },
+ offset: 0,
+ pageSize: 2,
+ pageNumber: 0,
+ paged: true,
+ unpaged: false
+ },
+ last: false,
+ totalElements: 4,
+ totalPages: 2,
+ first: true,
+ empty: false
+ };
+}
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.css
index d41bf5222..067d30d7f 100644
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.css
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.css
@@ -184,7 +184,7 @@ button.rotate{
.input-search-controller{
height: 50px;
padding-left: 30px;
- background: url(/assets/img/icon-search-light.svg) #fff 10px center no-repeat;
+ background: url(src/assets/img/icon-search-light.svg) #fff 10px center no-repeat;
border-radius: 0;
border: 0;
border-bottom: solid 1px #D7E7F9;
@@ -333,7 +333,7 @@ p.compType-4{
padding-left: 36px;
border: 0;
font-size: 14px;
- background: url(/assets/img/icon-drag.svg) #fff 20px center no-repeat;
+ background: url(src/assets/img/icon-drag.svg) #fff 20px center no-repeat;
}
/*CANVAS*/
@@ -344,6 +344,7 @@ p.compType-4{
background:#F4F9FE;
border: solid 1px #E8EFF8;
box-shadow: 0 2px 6px rgba(47, 83, 151, .1);
+ margin-left: 20em;
}
.editBar .btn-group{
box-shadow: 0 2px 6px rgba(47, 83, 151, .15);
@@ -365,10 +366,10 @@ p.compType-4{
padding-left: 30px;
}
.viewBtns .topologySource{
- background-image: url(/assets/img/icon-topologyView-active.svg);
+ background-image: url(src/assets/img/icon-topologyView-active.svg);
}
.viewBtns .topologyView{
- background-image: url(/assets/img/icon-topologySource.svg);
+ background-image: url(src/assets/img/icon-topologySource.svg);
}
.card.actionContainer{
margin: 20px 20px 40px 60px;
@@ -391,6 +392,7 @@ p.compType-4{
background: #C3CDDB;
}
.actionContainer .card-body{
+ min-height: 170px;
padding: 15px 20px !important;
border: solid 1px #C3CDDB;
background: #fff;
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
index 0d55439dd..991e126c0 100644
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.html
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
@@ -126,7 +126,7 @@
</div>
</ng-sidebar>
<!-- Page content -->
- <div ng-sidebar-content>
+ <div ng-sidebar-content id="paper">
<button class="rotate" (click)="_toggleSidebar1()">
<span>
Controller
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.spec.ts
index 3b767cb81..3b767cb81 100644
--- a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/designer/designer.component.spec.ts
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.spec.ts
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
new file mode 100644
index 000000000..547c1e574
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
@@ -0,0 +1,128 @@
+import { Component, OnInit, ViewEncapsulation } from '@angular/core';
+import * as $ from 'jquery';
+import * as _ from 'lodash';
+import * as joint from '../../../../../../node_modules/jointjs/dist/joint.js';
+
+@Component({
+ selector: 'app-designer',
+ templateUrl: './designer.component.html',
+ styleUrls: ['./designer.component.css'],
+ encapsulation: ViewEncapsulation.None
+})
+export class DesignerComponent implements OnInit {
+
+ private controllerSideBar: boolean;
+ private attributesSideBar: boolean;
+ public graph: any;
+ public paper: any;
+
+ constructor() {
+ this.controllerSideBar = true;
+ this.attributesSideBar = false;
+ }
+ private _toggleSidebar1() {
+ this.controllerSideBar = !this.controllerSideBar;
+ }
+ private _toggleSidebar2() {
+ this.attributesSideBar = !this.attributesSideBar;
+ }
+
+
+ ngOnInit() {
+ this.attachEditorBarToCanvas();
+ }
+
+ attachEditorBarToCanvas() {
+ this.graph = new joint.dia.Graph,
+ this.paper = new joint.dia.Paper({
+ el: $('#paper'),
+ model: this.graph,
+ height: 720,
+ width: 1200,
+ gridSize: 2,
+ drawGrid: true,
+ cellViewNamespace: joint.shapes
+ });
+
+ this.paper.setGrid({
+ name: 'dot',
+ args:
+ { color: 'black', thickness: 2, scaleFactor: 8 }
+
+ }).drawGrid();
+
+
+ joint.shapes["html"] = {};
+ joint.shapes["html"].Element = joint.shapes.basic.Rect.extend({
+ defaults: joint.util.deepSupplement({
+ type: 'html.Element'
+ }, joint.shapes.basic.Rect.prototype.defaults)
+ });
+
+ joint.shapes["html"].ElementView = joint.dia.ElementView.extend({
+
+ template: [
+ '<div>',
+ '<div id="editbar" class="editBar text-center">',
+ '<div class="btn-group mr-2" role="group" aria-label="First group">',
+ '<button type="button" class="btn btn-secondary tooltip-bottom" data-tooltip="Undo">',
+ '<img src="/assets/img/icon-undoActive.svg">',
+ '</button>',
+ '<button type="button" class="btn btn-secondary tooltip-bottom" data-tooltip="Redo">',
+ '<img src="/assets/img/icon-redo.svg">',
+ '</button>',
+ '</div>',
+ '<div class="btn-group mr-2" role="group" aria-label="Second group">',
+ '<button type="button" class="btn btn-secondary tooltip-bottom" data-tooltip="Zoom Out">',
+ '<img src="/assets/img/icon-zoomOut.svg">',
+ '</button>',
+ '<button type="button" class="btn btn-secondary pl-0 pr-0">100%</button>',
+ '<button type="button" class="btn btn-secondary tooltip-bottom" data-tooltip="Zoom In">',
+ '<img src="/assets/img/icon-zoomIn.svg">',
+ '</button>',
+ '</div>',
+ '<div class="btn-group viewBtns" role="group" aria-label="Third group">',
+ '<button type="button" class="btn btn-secondary topologySource active">View</button>',
+ '<button type="button" class="btn btn-secondary topologyView">Source</button>',
+ '</div>',
+ '</div>',
+ '</div>'
+ ].join(''),
+
+ initialize: function() {
+ _.bindAll(this, 'updateBox');
+ joint.dia.ElementView.prototype.initialize.apply(this, arguments);
+
+ this.$box = $(_.template(this.template)());
+ // Prevent paper from handling pointerdown.
+ this.$box.find('input,select').on('mousedown click', function(evt) {
+ evt.stopPropagation();
+ });
+ this.model.on('change', this.updateBox, this);
+
+ this.updateBox();
+ },
+ render: function() {
+ joint.dia.ElementView.prototype.render.apply(this, arguments);
+ this.paper.$el.prepend(this.$box);
+ this.updateBox();
+ return this;
+ },
+ updateBox: function() {
+ // Set the position and dimension of the box so that it covers the JointJS element.
+ var bbox = this.model.getBBox();
+ this.$box.css({
+ width: bbox.width,
+ height: bbox.height,
+ left: bbox.x,
+ top: bbox.y,
+ transform: 'rotate(' + (this.model.get('angle') || 0) + 'deg)'
+ });
+ }
+ });
+
+ var el1 = new joint.shapes["html"].Element({});
+ this.graph.addCells([el1]);
+ }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/model/BluePrint.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/model/BluePrint.model.ts
new file mode 100644
index 000000000..46dab88f8
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/model/BluePrint.model.ts
@@ -0,0 +1,58 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 { Page } from 'src/app/common/model/page';
+
+export class BlueprintModel {
+
+
+ constructor(id: string, artifactUUId: null, artifactType: string,
+ artifactVersion: string, artifactDescription: string,
+ internalVersion: null, createdDate: string, artifactName: string,
+ published: string, updatedBy: string, tags: string) {
+ this.id = id;
+ this.artifactUUId = artifactUUId;
+ this.artifactType = artifactType;
+ this.artifactVersion = artifactVersion;
+ this.artifactDescription = artifactDescription;
+ this.internalVersion = internalVersion;
+ this.createdDate = createdDate;
+ this.artifactName = artifactName;
+ this.published = published;
+ this.updatedBy = updatedBy;
+ this.tags = tags;
+ }
+
+ id: string;
+ artifactUUId?: null;
+ artifactType: string;
+ artifactVersion: string;
+ artifactDescription: string;
+ internalVersion?: null;
+ createdDate: string;
+ artifactName: string;
+ published: string;
+ updatedBy: string;
+ tags: string;
+}
+
+export class BluePrintPage extends Page<BlueprintModel> {
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts
new file mode 100644
index 000000000..068e93160
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/model/packages-dashboard.state.ts
@@ -0,0 +1,33 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {BluePrintPage} from './BluePrint.model';
+
+export class PackagesDashboardState {
+
+ page: BluePrintPage;
+ command: string;
+ currentPage = 0;
+ totalPackages: number;
+ tags: string[];
+ sortBy = 'DATE';
+ totalPackagesWithoutSearchorFilters: number;
+}
diff --git a/cds-ui/client-frankfurt/src/assets/.gitkeep b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.css
index e69de29bb..e69de29bb 100644
--- a/cds-ui/client-frankfurt/src/assets/.gitkeep
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.css
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html
new file mode 100644
index 000000000..6ce3a53a1
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.html
@@ -0,0 +1,18 @@
+<div class="dropdown packagesFilter w-100">
+ <input class="dropdown-toggle" type="text">
+ <div class="dropdown-text">ALL PACKAGES TAGS</div>
+ <ul class="dropdown-content w-100">
+ <li>
+ <div class="form-group">
+ <input type="text" (input)="reloadChanges($event)" class="form-control" placeholder="Search" autofocus>
+ </div>
+ </li>
+ <li *ngFor="let tag of viewedTags">
+ <div class="custom-control custom-checkbox">
+ <input type="checkbox" (click)="reloadPackages($event)" class="custom-control-input" id={{tag}}>
+ <label class="custom-control-label" for={{tag}}>{{tag}}</label>
+ </div>
+ </li>
+ </ul>
+</div>
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts
new file mode 100644
index 000000000..8285d8962
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.spec.ts
@@ -0,0 +1,45 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { TagsFilteringComponent } from './filter-by-tags.component';
+
+describe('SearchByTagsComponent', () => {
+ let component: TagsFilteringComponent;
+ let fixture: ComponentFixture<TagsFilteringComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ TagsFilteringComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(TagsFilteringComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts
new file mode 100644
index 000000000..b4007215a
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/filter-by-tags/filter-by-tags.component.ts
@@ -0,0 +1,100 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {Component, OnDestroy, OnInit} from '@angular/core';
+import {PackagesStore} from '../../packages.store';
+import {BlueprintModel, BluePrintPage} from '../../model/BluePrint.model';
+
+@Component({
+ selector: 'app-filter-by-tags',
+ templateUrl: './filter-by-tags.component.html',
+ styleUrls: ['./filter-by-tags.component.css']
+})
+
+export class TagsFilteringComponent implements OnInit {
+
+ page: BluePrintPage;
+ tags: string[] = [];
+ viewedTags: string[] = [];
+ searchTag = '';
+ viewedPackages: BlueprintModel[] = [];
+ private checkBoxTages = '';
+
+
+ constructor(private packagesStore: PackagesStore,
+ ) {
+ this.packagesStore.state$.subscribe(state => {
+ console.log(state);
+ if (state.page) {
+ this.viewedPackages = state.page.content;
+ this.viewedPackages.forEach(element => {
+ element.tags.split(',').forEach(tag => {
+ this.tags.push(tag.trim());
+ });
+ this.tags = this.tags.filter((value, index, self) => self.indexOf(value) === index);
+ this.assignTags();
+
+ });
+ }
+ });
+ }
+
+ ngOnInit() {
+
+ }
+
+ reloadChanges(event: any) {
+ this.searchTag = event.target.value;
+ this.filterItem(this.searchTag);
+ }
+
+ private assignTags() {
+ this.viewedTags = this.tags;
+ }
+
+ private filterItem(value) {
+ if (!value) {
+ this.assignTags();
+ }
+ this.viewedTags = this.tags.filter(
+ item => item.toLowerCase().indexOf(value.toLowerCase()) > -1
+ );
+ }
+
+ reloadPackages(event: any) {
+
+ if (!event.target.checked) {
+ this.checkBoxTages = this.checkBoxTages.replace(event.target.id + ',', '')
+ .replace(event.target.id, '');
+ } else {
+ this.checkBoxTages += event.target.id.trim() + ',';
+ }
+ console.log(this.checkBoxTages);
+ if (!this.checkBoxTages.includes(',')) {
+ return;
+ }
+ this.viewedPackages = [];
+ // this.packagesStore.getPagesFilterByTags(this.checkBoxTages);
+ // this.viewedPackages = this.viewedPackages.filter((value, index, self) => self.indexOf(value) === index);
+ }
+
+
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.css
index e69de29bb..e69de29bb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.css
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html
new file mode 100644
index 000000000..18428d4b4
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.html
@@ -0,0 +1,104 @@
+<div class="row packages-card">
+ <div class="col-lg-3 col-md-6">
+ <!--Add Package Card-->
+ <div class="card addPaackage-card">
+ <div class="card-body text-center">
+ <img src="/assets/img/icon-addPackage.svg">
+ </div>
+ <div class="card-footer row">
+ <div class="col">
+ <a href="#" role="button" aria-pressed="true" class="btn-create-package float">Create Package
+ </a>
+ </div>
+ <div class="col">
+ <a href="#" role="button" aria-pressed="true" class="btn-import-package float">Import Package
+ </a>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-lg-3 col-md-6" *ngFor="let bluePrint of viewedPackages">
+
+ <!--Card 1-->
+ <div>
+ <div class="card">
+ <div class="card-body">
+ <div class="row">
+ <div class="col-9 pr-0">
+ <h5 class="card-title" [routerLink]="['/packages/package', bluePrint.id]" (click)="testDispatch(bluePrint)">
+ <img class="icon-deployed" src="/assets/img/icon-deploy.svg">
+ {{bluePrint.artifactName}}
+ </h5>
+
+ </div>
+ <div class="col-3">
+
+ <div class="dropdown">
+ <input class="dropdown-toggle" type="text">
+ <div class="dropdown-text">
+ <img src="/assets/img/icon-menuDots.svg" title="Actions">
+ </div>
+ <ul class="dropdown-content">
+ <li class="action-clone">
+ <a href="#">Clone</a>
+ </li>
+ <li class="action-archive">
+ <a href="#">Archive</a>
+ </li>
+ <li class="action-delete">
+ <a href="#">Delete</a>
+ </li>
+ </ul>
+ </div>
+
+ </div>
+ </div>
+ <div class="row">
+ <div class="col">
+ <p class="mb-0">Last modified {{ bluePrint.createdDate | date:'short' }}
+ </p>
+ <p>By {{bluePrint.updatedBy}}</p>
+ <ul class="package-contributers">
+ <li>
+ <button type="button" class="border-fade" data-toggle="tooltip"
+ data-placement="bottom"
+ title="User name">
+ <img src="/assets/img/img-user1.jpeg">
+ </button>
+ </li>
+ <li>
+ <button type="button" data-toggle="tooltip" data-placement="bottom"
+ title="User name">
+ <img src="/assets/img/img-user2.jpg">
+ </button>
+ </li>
+ <li>
+ <button type="button" data-toggle="tooltip" data-placement="bottom"
+ title="User name">
+ <img src="/assets/img/img-user3.jpg">
+ </button>
+ </li>
+ <li>
+ <a href="">5 contributors</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ <div class="card-footer">
+ <div class="row">
+ <div class="col">
+ <button type="button" class="btn btn-card-topology">Topology View
+ </button>
+ </div>
+ <div class="col">
+ <button type="button" class="btn btn-card-config">Configuration</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ </div>
+
+ </div>
+ </div>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.spec.ts
new file mode 100644
index 000000000..f45f25996
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.spec.ts
@@ -0,0 +1,36 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { PackageListComponent } from './package-list.component';
+import { PackagesStore } from '../../packages.store';
+import { getBluePrintPageMock } from '../../blueprint.page.mock';
+import { of } from 'rxjs';
+
+describe('PackageListComponent', () => {
+ let component: PackageListComponent;
+ let fixture: ComponentFixture<PackageListComponent>;
+ let store: Partial<PackagesStore>;
+
+ beforeEach(async(() => {
+
+ store = { state$: of(getBluePrintPageMock()) };
+
+ TestBed.configureTestingModule({
+ declarations: [ PackageListComponent ],
+ providers: [{ provide: PackagesStore, useValue: store }]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PackageListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+
+ // TODO create another test with store in mind
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts
new file mode 100644
index 000000000..c7ec0af20
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-list/package-list.component.ts
@@ -0,0 +1,32 @@
+import {Component, OnInit} from '@angular/core';
+import {BlueprintModel} from '../../model/BluePrint.model';
+import {PackagesStore} from '../../packages.store';
+
+@Component({
+ selector: 'app-packages-list',
+ templateUrl: './package-list.component.html',
+ styleUrls: ['./package-list.component.css']
+})
+export class PackageListComponent implements OnInit {
+
+ viewedPackages: BlueprintModel[] = [];
+
+
+ constructor(private packagesStore: PackagesStore) {
+ console.log('PackageListComponent');
+ this.packagesStore.state$.subscribe(state => {
+ console.log(state);
+ if (state.page) {
+ this.viewedPackages = state.page.content;
+ }
+ });
+ }
+
+ ngOnInit() {
+ this.packagesStore.getAll();
+ }
+
+ testDispatch(bluePrint: BlueprintModel) {
+ console.log(bluePrint.id);
+ }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.css
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.css
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.html
new file mode 100644
index 000000000..b5245f757
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.html
@@ -0,0 +1,7 @@
+<!--Package Paginator-->
+<div class="col package-paginator pr-0">
+ <ngb-pagination [collectionSize]="totalCount" [(page)]="pageNumber" [pageSize]="pageSize" class="float-right"
+ (pageChange)="getPageFromService($event)"
+
+ ></ngb-pagination>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.spec.ts
new file mode 100644
index 000000000..ce7f99f62
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { PackagePaginationComponent } from './package-pagination.component';
+
+describe('PackagePaginationComponent', () => {
+ let component: PackagePaginationComponent;
+ let fixture: ComponentFixture<PackagePaginationComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ PackagePaginationComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PackagePaginationComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
new file mode 100644
index 000000000..49f91316b
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/package-pagination/package-pagination.component.ts
@@ -0,0 +1,41 @@
+import {Component, OnInit, ChangeDetectionStrategy} from '@angular/core';
+import {PackagesStore} from '../../packages.store';
+import {map} from 'rxjs/operators';
+
+@Component({
+ selector: 'app-package-pagination',
+ templateUrl: './package-pagination.component.html',
+ styleUrls: ['./package-pagination.component.css'],
+})
+export class PackagePaginationComponent implements OnInit {
+ pageNumber: number;
+ totalCount: number;
+ pageSize: number;
+ previousPage: number;
+
+ constructor(private packagesStore: PackagesStore) {
+ this.pageSize = packagesStore.pageSize;
+
+ this.packagesStore.state$
+ .subscribe(state => {
+ this.pageNumber = state.currentPage;
+ this.totalCount = state.totalPackages;
+ });
+ }
+
+ ngOnInit() {
+ }
+
+ public getPageFromService(page) {
+ console.log('getPageFromService', page);
+ if (isNaN(page)) {
+ page = 1;
+ console.log('page change to first...', page);
+ }
+ if (this.previousPage !== page) {
+ this.packagesStore.getPage(page - 1, this.packagesStore.pageSize);
+ this.previousPage = page;
+ }
+ }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dahsboard.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dahsboard.component.spec.ts
new file mode 100644
index 000000000..fe156b6cb
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dahsboard.component.spec.ts
@@ -0,0 +1,44 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { PackagesDashboardComponent } from './packages-dashboard.component';
+
+describe('PackagesDashboardComponent', () => {
+ let component: PackagesDashboardComponent;
+ let fixture: ComponentFixture<PackagesDashboardComponent>;
+
+ beforeEach(async(() => {
+
+
+ TestBed.configureTestingModule({
+ declarations: [PackagesDashboardComponent ],
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(PackagesDashboardComponent);
+ component = fixture.componentInstance;
+ }));
+
+ fit('should create', () => {
+ fixture.detectChanges();
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.css
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.css
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.html
new file mode 100644
index 000000000..ac510893b
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.html
@@ -0,0 +1,61 @@
+<app-header>
+</app-header>
+<div class="new-wrapper">
+ <div class="container-fluid main-container">
+
+ <div class="container-fluid body-container">
+ <nav class="row">
+ <!--Nav Tabs-->
+ <div class="col pr-0">
+ <div class="nav nav-tabs " id="nav-tab" role="tablist">
+ <a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home"
+ role="tab" aria-controls="nav-home"
+ aria-selected="true">All</a>
+ <a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile"
+ role="tab" aria-controls="nav-profile"
+ aria-selected="false">Deployed</a>
+ <a class="nav-item nav-link" id="nav-contact-tab" data-toggle="tab" href="#nav-contact"
+ role="tab" aria-controls="nav-contact"
+ aria-selected="false">Under Construction</a>
+ <a class="nav-item nav-link" id="nav-contact1-tab" data-toggle="tab" href="#nav-contact1"
+ role="tab" aria-controls="nav-contact1"
+ aria-selected="false">Archived</a>
+ </div>
+ </div>
+ <!--Nav Search & Filter-->
+ <div class="col search-filter-col">
+ <div class="row">
+ <div class="col-7">
+ <app-packages-search></app-packages-search>
+ </div>
+ <div class="col-5 pl-2">
+ <app-filter-by-tags class="w-100"></app-filter-by-tags>
+ </div>
+
+ </div>
+ </div>
+ </nav>
+ <div class="row mt-4">
+ <div class="col">
+ <div class="tab-content" id="nav-tabContent">
+ <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
+ <div class="row">
+ <div class="col sort-packages">
+
+ </div>
+ <app-package-pagination></app-package-pagination>
+
+ </div>
+ <app-packages-list></app-packages-list>
+
+ </div>
+ <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">...</div>
+ <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">...</div>
+ <div class="tab-pane fade" id="nav-contact1" role="tabpanel" aria-labelledby="nav-contact1-tab">...
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.ts
new file mode 100644
index 000000000..4e33a9df1
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/packages-dashboard.component.ts
@@ -0,0 +1,37 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {Component, OnInit} from '@angular/core';
+import {PackagesStore} from '../packages.store';
+
+@Component({
+ selector: 'app-packages-dashboard',
+ templateUrl: './packages-dashboard.component.html',
+ styleUrls: ['./packages-dashboard.component.css']
+})
+export class PackagesDashboardComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+
+ console.log('PackagesDashboardComponent');
+ }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.css b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.css
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.css
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.html
new file mode 100644
index 000000000..e7c605fd1
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.html
@@ -0,0 +1,4 @@
+<div class="searchBox">
+ <input class="searchInput" [ngClass]="{'searchBox-expanded': searchQuery}" (input)="searchPackages($event)" type="text" name="" placeholder="Search packages">
+ <button class="searchButton" href="#"></button>
+</div> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.spec.ts
new file mode 100644
index 000000000..7e50c55cc
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { PackagesSearchComponent } from './search-by-packages.component';
+
+describe('PackagesSearchComponent', () => {
+ let component: PackagesSearchComponent;
+ let fixture: ComponentFixture<PackagesSearchComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [PackagesSearchComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PackagesSearchComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.ts
new file mode 100644
index 000000000..91304e5c2
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-dashboard/search-by-packages/search-by-packages.component.ts
@@ -0,0 +1,25 @@
+import {Component, OnInit} from '@angular/core';
+import {PackagesStore} from '../../packages.store';
+
+@Component({
+ selector: 'app-packages-search',
+ templateUrl: './search-by-packages.component.html',
+ styleUrls: ['./search-by-packages.component.css']
+})
+export class PackagesSearchComponent implements OnInit {
+
+ private searchQuery = '';
+
+ constructor(private packagesStore: PackagesStore) {
+ }
+
+ ngOnInit() {
+ }
+
+
+ searchPackages(event: any) {
+ this.searchQuery = event.target.value;
+ this.searchQuery = this.searchQuery.trim();
+ this.packagesStore.search(this.searchQuery);
+ }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-list.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-list.service.ts
new file mode 100644
index 000000000..e8a98099c
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages-list.service.ts
@@ -0,0 +1,66 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {Injectable} from '@angular/core';
+import {Observable} from 'rxjs';
+import {ApiService} from '../../../common/core/services/api.typed.service';
+import {BlueprintURLs} from '../../../common/constants/app-constants';
+import {BlueprintModel, BluePrintPage} from './model/BluePrint.model';
+
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PackagesListService {
+ packages: BlueprintModel[] = [];
+ private numberOfPackages: number;
+
+ constructor(private api: ApiService<BluePrintPage>) {
+ }
+
+ getPagedPackages(pageNumber: number, pageSize: number, sortBy: string): Observable<BluePrintPage[]> {
+ return this.api.get(BlueprintURLs.getPagedBlueprints, {
+ offset: pageNumber,
+ limit: pageSize,
+ sort: sortBy
+ });
+ }
+
+ searchByTags(keyword: string): Observable<any> {
+ return this.api.get(BlueprintURLs.getMetaDate + '/' + keyword);
+ }
+
+ getCountOfAllPackages(observable: Observable<number>) {
+ observable.subscribe(data => {
+ this.numberOfPackages = data;
+ console.log(data);
+ });
+ }
+
+ getPagedPackagesByKeyWord(keyWord: string, pageNumber: number, pageSize: number, sortBy: string) {
+
+ return this.api.get(BlueprintURLs.getMetaDatePageable + '/' + keyWord, {
+ offset: pageNumber,
+ limit: pageSize,
+ sort: sortBy
+ });
+ }
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts
new file mode 100644
index 000000000..f24ae8b00
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.module.ts
@@ -0,0 +1,36 @@
+import {NgModule} from '@angular/core';
+import {CommonModule} from '@angular/common';
+import {ApiService} from '../../../common/core/services/api.typed.service';
+import {PackagesRoutingModule} from './packages.routing.module';
+import {NgbPaginationModule} from '@ng-bootstrap/ng-bootstrap';
+import { SharedModulesModule } from '../../shared-modules/shared-modules.module';
+import { PackagesDashboardComponent } from './packages-dashboard/packages-dashboard.component';
+import { PackageListComponent } from './packages-dashboard/package-list/package-list.component';
+import { DesignerComponent } from './designer/designer.component';
+import { SidebarModule } from 'ng-sidebar';
+import { PackagePaginationComponent } from './packages-dashboard/package-pagination/package-pagination.component';
+import { PackagesSearchComponent } from './packages-dashboard/search-by-packages/search-by-packages.component';
+import { TagsFilteringComponent } from './packages-dashboard/filter-by-tags/filter-by-tags.component';
+
+
+
+@NgModule({
+ declarations: [PackagesDashboardComponent,
+ TagsFilteringComponent,
+ PackageListComponent,
+ DesignerComponent,
+ PackagePaginationComponent,
+ PackagesSearchComponent,
+ ],
+ imports: [
+ CommonModule,
+ PackagesRoutingModule,
+ NgbPaginationModule,
+ SharedModulesModule,
+ SidebarModule.forRoot(),
+ ],
+ providers: [ApiService],
+ bootstrap: []
+})
+export class PackagesModule {
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.routing.module.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.routing.module.ts
new file mode 100644
index 000000000..83044dde5
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.routing.module.ts
@@ -0,0 +1,20 @@
+import {NgModule} from '@angular/core';
+import {Routes, RouterModule} from '@angular/router';
+import {PackagesDashboardComponent} from './packages-dashboard/packages-dashboard.component';
+import {DesignerComponent} from './designer/designer.component';
+
+
+const routes: Routes = [
+ {
+ path: '',
+ component: PackagesDashboardComponent
+ },
+ {path: 'designer', component: DesignerComponent},
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class PackagesRoutingModule {
+}
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.spec.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.spec.ts
new file mode 100644
index 000000000..b091ed90e
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.spec.ts
@@ -0,0 +1,44 @@
+import { TestBed } from '@angular/core/testing';
+import { PackagesStore } from './packages.store';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { PackagesListService } from './packages-list.service';
+import { of } from 'rxjs';
+import { BluePrintPage } from './model/BluePrint.model';
+import { getBluePrintPageMock } from './blueprint.page.mock';
+
+describe('PackagesStore', () => {
+ let store: PackagesStore;
+
+ const MOCK_BLUEPRINTS_PAGE: BluePrintPage = getBluePrintPageMock();
+
+ let httpMock: HttpTestingController;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ HttpClientTestingModule
+ ],
+ providers: [
+ PackagesStore,
+ PackagesListService
+ ]
+ });
+ httpMock = TestBed.get(HttpTestingController);
+
+ });
+
+ it('should correctly get page of packages', () => {
+ const packagesServiceSpy = jasmine.createSpyObj('PackagesListService', ['getPagedPackages']);
+
+ // set the value to return when the `getPagedPackages` spy is called.
+ packagesServiceSpy.getPagedPackages.and.returnValue(of([MOCK_BLUEPRINTS_PAGE]));
+ store = new PackagesStore(packagesServiceSpy);
+
+ store.getPagedPackages(0, 2);
+ store.state$.subscribe(page => {
+ expect(store.state).toEqual(MOCK_BLUEPRINTS_PAGE);
+ });
+
+ });
+});
+
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.ts
new file mode 100644
index 000000000..d770bf737
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.store.ts
@@ -0,0 +1,104 @@
+/*
+============LICENSE_START==========================================
+===================================================================
+Copyright (C) 2019 Orange. All rights reserved.
+===================================================================
+
+Unless otherwise specified, all software contained herein is licensed
+under the Apache License, Version 2.0 (the License);
+you may not use this software 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 {Injectable} from '@angular/core';
+import {BluePrintPage} from './model/BluePrint.model';
+import {Store} from '../../../common/core/stores/Store';
+import {PackagesListService} from './packages-list.service';
+import {PackagesDashboardState} from './model/packages-dashboard.state';
+
+
+@Injectable({
+ providedIn: 'root'
+})
+export class PackagesStore extends Store<PackagesDashboardState> {
+ // TDOD fixed for now as there is no requirement to change it from UI
+ public pageSize = 5;
+
+ constructor(private packagesServiceList: PackagesListService) {
+ super(new PackagesDashboardState());
+ }
+
+ public getAll() {
+ console.log('getting all packages...');
+ this.getPagedPackages(0, this.pageSize);
+ }
+
+ public search(command: string) {
+ if (command) {
+ this.searchPagedPackages(command, 0, this.pageSize);
+ } else {
+ this.getPagedPackages(0, this.pageSize);
+ }
+ }
+
+ public getPage(pageNumber: number, pageSize: number) {
+ if (this.isCommandExist()) {
+ this.searchPagedPackages(this.state.command, pageNumber, pageSize);
+ } else {
+ this.getPagedPackages(pageNumber, pageSize);
+ }
+ }
+
+ public sortPagedPackages(sortBy: string) {
+ if (this.isCommandExist()) {
+ this.searchPagedPackages(this.state.command, this.state.currentPage, this.pageSize, sortBy);
+ } else {
+ this.getPagedPackages(this.state.currentPage, this.pageSize, sortBy);
+ }
+
+ }
+
+ private getPagedPackages(pageNumber: number, pageSize: number, sortBy: string = this.state.sortBy) {
+
+ this.packagesServiceList.getPagedPackages(pageNumber, pageSize, sortBy)
+ .subscribe((pages: BluePrintPage[]) => {
+ this.setState({
+ ...this.state,
+ page: pages[0],
+ command: '',
+ totalPackages: pages[0].totalElements,
+ currentPage: pageNumber,
+ // this param is set only in get all as it represents the total number of pacakges in the server
+ totalPackagesWithoutSearchorFilters: pages[0].totalElements,
+ sortBy
+ });
+ });
+ }
+
+ private searchPagedPackages(keyWord: string, pageNumber: number, pageSize: number, sortBy: string = this.state.sortBy) {
+ this.packagesServiceList.getPagedPackagesByKeyWord(keyWord, pageNumber, pageSize, sortBy)
+ .subscribe((pages: BluePrintPage[]) => {
+ this.setState({
+ ...this.state,
+ page: pages[0],
+ command: keyWord,
+ totalPackages: pages[0].totalElements,
+ currentPage: pageNumber,
+ sortBy
+ });
+ });
+ }
+
+ private isCommandExist() {
+ return this.state.command;
+ }
+}
diff --git a/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.css b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.css
new file mode 100644
index 000000000..240f9dfae
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.css
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html
new file mode 100644
index 000000000..541b38d1a
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.html
@@ -0,0 +1,72 @@
+<div class="primary-nav">
+ <img class="logo-icon open-panel nav-toggle" src="../assets/img/logo-icon.svg" title="CDS">
+ <nav role="navigation" class="menu">
+ <img class="logotype" src="../assets/img/logo-text.svg">
+ <div class="overflow-container">
+ <ul class="menu-dropdown">
+ <li class="active">
+ <a href="packages/list">Packages</a>
+ <span class="icon">
+ <!-- <i class="fa fa-dashboard"></i> -->
+ <img src="../assets/img/icon-nav-packages.svg">
+ </span>
+ </li>
+ <li class="menu-hasdropdown">
+ <a href="#">Data Dictionary</a>
+ <span class="icon">
+ <img src="../assets/img/icon-nav-dictionary.svg">
+ </span>
+ <label title="toggle menu" for="settings">
+ <span class="downarrow">
+ <i class="fa fa-caret-down"></i>
+ </span>
+ </label>
+ <input type="checkbox" class="sub-menu-checkbox" id="settings" />
+ <ul class="sub-menu-dropdown">
+ <li>
+ <a href="">Link</a>
+ </li>
+ <li>
+ <a href="">Link</a>
+ </li>
+ <li>
+ <a href="">Link</a>
+ </li>
+ </ul>
+ </li>
+ <!-- <li>
+ <a href="#">Favourites</a>
+ <span class="icon">
+ <i class="fa fa-heart"></i>
+ </span>
+ </li>
+ <li>
+ <a href="#">Messages</a>
+ <span class="icon">
+ <i class="fa fa-envelope"></i>
+ </span>
+ </li> -->
+ </ul>
+ </div>
+ <ul class="menu-dropdown userProfile">
+ <li>
+ <div class="dropdown">
+ <input class="dropdown-toggle" type="text">
+ <div class="dropdown-text">User name</div>
+ <ul class="dropdown-content">
+ <li>
+ <a href="#">Settings</a>
+ </li>
+ <li>
+ <a href="#">Projects</a>
+ </li>
+ <li>
+ <a href="#">Log out</a>
+ </li>
+ </ul>
+ </div>
+ </li>
+ </ul>
+
+ </nav>
+</div>
diff --git a/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.spec.ts b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.spec.ts
new file mode 100644
index 000000000..2d0479d7d
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { HeaderComponent } from './header.component';
+
+describe('HeaderComponent', () => {
+ let component: HeaderComponent;
+ let fixture: ComponentFixture<HeaderComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ HeaderComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(HeaderComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.ts b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.ts
new file mode 100644
index 000000000..3ee4d0f65
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/shared-modules/header/header.component.ts
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-header',
+ templateUrl: './header.component.html',
+ styleUrls: ['./header.component.css']
+})
+export class HeaderComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/cds-ui/designer-client/src/app/modules/shared-modules/shared-modules.module.ts b/cds-ui/designer-client/src/app/modules/shared-modules/shared-modules.module.ts
new file mode 100644
index 000000000..6b6d39689
--- /dev/null
+++ b/cds-ui/designer-client/src/app/modules/shared-modules/shared-modules.module.ts
@@ -0,0 +1,13 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { HeaderComponent } from './header/header.component';
+
+
+
+@NgModule({
+ declarations: [HeaderComponent],
+ imports: [
+ CommonModule
+ ], exports : [HeaderComponent]
+})
+export class SharedModulesModule { }
diff --git a/cds-ui/designer-client/src/assets/.gitkeep b/cds-ui/designer-client/src/assets/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/.gitkeep
diff --git a/cds-ui/client-frankfurt/src/assets/css/bootstrap.min.css b/cds-ui/designer-client/src/assets/css/bootstrap.min.css
index 92e3fe871..92e3fe871 100644
--- a/cds-ui/client-frankfurt/src/assets/css/bootstrap.min.css
+++ b/cds-ui/designer-client/src/assets/css/bootstrap.min.css
diff --git a/cds-ui/designer-client/src/assets/css/designer.css b/cds-ui/designer-client/src/assets/css/designer.css
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/css/designer.css
diff --git a/cds-ui/client-frankfurt/src/assets/css/font-awesome.min.css b/cds-ui/designer-client/src/assets/css/font-awesome.min.css
index 540440ce8..540440ce8 100644
--- a/cds-ui/client-frankfurt/src/assets/css/font-awesome.min.css
+++ b/cds-ui/designer-client/src/assets/css/font-awesome.min.css
diff --git a/cds-ui/client-frankfurt/src/assets/css/orangeHelvetica.css b/cds-ui/designer-client/src/assets/css/orangeHelvetica.css
index b2f0939c8..b2f0939c8 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/css/orangeHelvetica.css
+++ b/cds-ui/designer-client/src/assets/css/orangeHelvetica.css
diff --git a/cds-ui/designer-client/src/assets/css/style1.css b/cds-ui/designer-client/src/assets/css/style1.css
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/css/style1.css
diff --git a/cds-ui/designer-client/src/assets/css/style2.css b/cds-ui/designer-client/src/assets/css/style2.css
new file mode 100644
index 000000000..df65e6753
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/css/style2.css
@@ -0,0 +1,3 @@
+body {
+ background: black
+} \ No newline at end of file
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.eot b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.eot
index 818d20ed3..818d20ed3 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.eot
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.eot
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.svg b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.svg
index 28057ceff..28057ceff 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.svg
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.svg
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.ttf b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.ttf
index 007f6d19a..007f6d19a 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.ttf
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.ttf
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.woff b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.woff
index 79d02e3c5..79d02e3c5 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.woff
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.woff
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.woff2 b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.woff2
index 8ad6b5531..8ad6b5531 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue55_W1G.woff2
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue55_W1G.woff2
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.eot b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.eot
index f5a075df8..f5a075df8 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.eot
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.eot
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.svg b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.svg
index bb5811c01..bb5811c01 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.svg
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.svg
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.ttf b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.ttf
index 01ebe37bc..01ebe37bc 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.ttf
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.ttf
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.woff b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.woff
index 96ba6a6fc..96ba6a6fc 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.woff
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.woff
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.woff2 b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.woff2
index 81b0c4d35..81b0c4d35 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/HelvNeue75_W1G.woff2
+++ b/cds-ui/designer-client/src/assets/fonts/HelvNeue75_W1G.woff2
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.eot b/cds-ui/designer-client/src/assets/fonts/icon-orange.eot
index 6561ccce7..6561ccce7 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.eot
+++ b/cds-ui/designer-client/src/assets/fonts/icon-orange.eot
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.svg b/cds-ui/designer-client/src/assets/fonts/icon-orange.svg
index 72d0d46c7..72d0d46c7 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.svg
+++ b/cds-ui/designer-client/src/assets/fonts/icon-orange.svg
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.ttf b/cds-ui/designer-client/src/assets/fonts/icon-orange.ttf
index a2dbfc839..a2dbfc839 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.ttf
+++ b/cds-ui/designer-client/src/assets/fonts/icon-orange.ttf
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.woff b/cds-ui/designer-client/src/assets/fonts/icon-orange.woff
index 629ec7e60..629ec7e60 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.woff
+++ b/cds-ui/designer-client/src/assets/fonts/icon-orange.woff
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.woff2 b/cds-ui/designer-client/src/assets/fonts/icon-orange.woff2
index 82cd64dfd..82cd64dfd 100644..100755
--- a/cds-ui/client-frankfurt/src/assets/fonts/icon-orange.woff2
+++ b/cds-ui/designer-client/src/assets/fonts/icon-orange.woff2
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/android-chrome-192x192.png b/cds-ui/designer-client/src/assets/img/favicon/android-chrome-192x192.png
index fdb1149d8..fdb1149d8 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/android-chrome-192x192.png
+++ b/cds-ui/designer-client/src/assets/img/favicon/android-chrome-192x192.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/android-chrome-512x512.png b/cds-ui/designer-client/src/assets/img/favicon/android-chrome-512x512.png
index 864c20eda..864c20eda 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/android-chrome-512x512.png
+++ b/cds-ui/designer-client/src/assets/img/favicon/android-chrome-512x512.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/apple-touch-icon.png b/cds-ui/designer-client/src/assets/img/favicon/apple-touch-icon.png
index 14d6c061a..14d6c061a 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/apple-touch-icon.png
+++ b/cds-ui/designer-client/src/assets/img/favicon/apple-touch-icon.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/browserconfig.xml b/cds-ui/designer-client/src/assets/img/favicon/browserconfig.xml
index b3930d0f0..b3930d0f0 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/browserconfig.xml
+++ b/cds-ui/designer-client/src/assets/img/favicon/browserconfig.xml
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/favicon-16x16.png b/cds-ui/designer-client/src/assets/img/favicon/favicon-16x16.png
index d49e691f2..d49e691f2 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/favicon-16x16.png
+++ b/cds-ui/designer-client/src/assets/img/favicon/favicon-16x16.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/favicon-32x32.png b/cds-ui/designer-client/src/assets/img/favicon/favicon-32x32.png
index 0814cc10b..0814cc10b 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/favicon-32x32.png
+++ b/cds-ui/designer-client/src/assets/img/favicon/favicon-32x32.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/favicon.ico b/cds-ui/designer-client/src/assets/img/favicon/favicon.ico
index 748fd3404..748fd3404 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/favicon.ico
+++ b/cds-ui/designer-client/src/assets/img/favicon/favicon.ico
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/mstile-150x150.png b/cds-ui/designer-client/src/assets/img/favicon/mstile-150x150.png
index 9ef285ee3..9ef285ee3 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/mstile-150x150.png
+++ b/cds-ui/designer-client/src/assets/img/favicon/mstile-150x150.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/safari-pinned-tab.svg b/cds-ui/designer-client/src/assets/img/favicon/safari-pinned-tab.svg
index f7b52bd6f..f7b52bd6f 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/safari-pinned-tab.svg
+++ b/cds-ui/designer-client/src/assets/img/favicon/safari-pinned-tab.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/favicon/site.webmanifest b/cds-ui/designer-client/src/assets/img/favicon/site.webmanifest
index b20abb7cb..b20abb7cb 100644
--- a/cds-ui/client-frankfurt/src/assets/img/favicon/site.webmanifest
+++ b/cds-ui/designer-client/src/assets/img/favicon/site.webmanifest
diff --git a/cds-ui/designer-client/src/assets/img/icon-add-hover.svg b/cds-ui/designer-client/src/assets/img/icon-add-hover.svg
new file mode 100644
index 000000000..66a8e1b88
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-add-hover.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>icon-add-hover</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="icon-add-hover">
+ <circle id="Oval" fill="#103D73" cx="10" cy="10" r="10"></circle>
+ <path d="M13.75,9.375 L10.625,9.375 L10.625,6.25 C10.625,5.905 10.345,5.625 10,5.625 C9.655,5.625 9.375,5.905 9.375,6.25 L9.375,9.375 L6.25,9.375 C5.905,9.375 5.625,9.655 5.625,10 C5.625,10.345 5.905,10.625 6.25,10.625 L9.375,10.625 L9.375,13.75 C9.375,14.095 9.655,14.375 10,14.375 C10.345,14.375 10.625,14.095 10.625,13.75 L10.625,10.625 L13.75,10.625 C14.095,10.625 14.375,10.345 14.375,10 C14.375,9.655 14.095,9.375 13.75,9.375 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero"></path>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-add.svg b/cds-ui/designer-client/src/assets/img/icon-add.svg
new file mode 100644
index 000000000..13020ba0f
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-add.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>Shape</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-1400.000000, -199.000000)" fill="#103D73" fill-rule="nonzero">
+ <g id="action-attributes" transform="translate(1044.000000, 60.000000)">
+ <g id="actions" transform="translate(36.000000, 0.000000)">
+ <g id="STEPS" transform="translate(0.000000, 131.000000)">
+ <g id="title">
+ <path d="M330,8 C324.476863,8 320,12.4768627 320,18 C320,23.5231373 324.476863,28 330,28 C335.523137,28 340,23.5224837 340,18 C340,12.4775163 335.523137,8 330,8 Z M330,26.75 C325.167484,26.75 321.25,22.8325163 321.25,18 C321.25,13.1674837 325.167484,9.25 330,9.25 C334.832516,9.25 338.75,13.1674837 338.75,18 C338.75,22.8325163 334.832516,26.75 330,26.75 Z M333.75,17.375 L330.625,17.375 L330.625,14.25 C330.625,13.905 330.345,13.625 330,13.625 C329.655,13.625 329.375,13.905 329.375,14.25 L329.375,17.375 L326.25,17.375 C325.905,17.375 325.625,17.655 325.625,18 C325.625,18.345 325.905,18.625 326.25,18.625 L329.375,18.625 L329.375,21.75 C329.375,22.095 329.655,22.375 330,22.375 C330.345,22.375 330.625,22.095 330.625,21.75 L330.625,18.625 L333.75,18.625 C334.095,18.625 334.375,18.345 334.375,18 C334.375,17.655 334.095,17.375 333.75,17.375 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-addPackage.svg b/cds-ui/designer-client/src/assets/img/icon-addPackage.svg
index fcc8675ce..fcc8675ce 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-addPackage.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-addPackage.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-archive-sm.svg b/cds-ui/designer-client/src/assets/img/icon-archive-sm.svg
index 53683e9f1..53683e9f1 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-archive-sm.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-archive-sm.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-btn-card-config.svg b/cds-ui/designer-client/src/assets/img/icon-btn-card-config.svg
index 4e9130e9b..4e9130e9b 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-btn-card-config.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-btn-card-config.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-btn-card-topology.svg b/cds-ui/designer-client/src/assets/img/icon-btn-card-topology.svg
index 68a875321..68a875321 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-btn-card-topology.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-btn-card-topology.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-clone-sm.svg b/cds-ui/designer-client/src/assets/img/icon-clone-sm.svg
index e532ccf8a..e532ccf8a 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-clone-sm.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-clone-sm.svg
diff --git a/cds-ui/designer-client/src/assets/img/icon-close.svg b/cds-ui/designer-client/src/assets/img/icon-close.svg
new file mode 100644
index 000000000..bdd51b26f
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-close.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="10px" height="10px" viewBox="0 0 10 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>Path</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-1057.000000, -73.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="action-attributes" transform="translate(1044.000000, 60.000000)">
+ <g id="close">
+ <path d="M18.8808333,17.996875 L22.8108333,14.066875 C23.055,13.8229167 23.055,13.4270833 22.8108333,13.183125 C22.5666667,12.9389583 22.17125,12.9389583 21.9270833,13.183125 L17.9970833,17.113125 L14.066875,13.183125 C13.8227083,12.9389583 13.4272917,12.9389583 13.183125,13.183125 C12.9389583,13.4270833 12.9389583,13.8229167 13.183125,14.066875 L17.1133333,17.996875 L13.183125,21.926875 C12.9389583,22.1708333 12.9389583,22.5666667 13.183125,22.810625 C13.3052083,22.9325 13.4652083,22.9935417 13.625,22.9935417 C13.7847917,22.9935417 13.9447917,22.9325 14.066875,22.8104167 L17.9970833,18.8804167 L21.9270833,22.8104167 C22.0491667,22.9325 22.2091667,22.9935417 22.3689583,22.9935417 C22.52875,22.9935417 22.68875,22.9325 22.8108333,22.8104167 C23.055,22.5664583 23.055,22.170625 22.8108333,21.9266667 L18.8808333,17.996875 Z" id="Path"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType1-sm.svg b/cds-ui/designer-client/src/assets/img/icon-comType1-sm.svg
new file mode 100644
index 000000000..d0dd6aed9
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType1-sm.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="21px" height="21px" viewBox="0 0 21 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>browser</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-55.000000, -632.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="controller" transform="translate(0.000000, 60.000000)">
+ <g id="functions" transform="translate(0.000000, 479.000000)">
+ <g id="list" transform="translate(8.000000, 51.000000)">
+ <g id="1" transform="translate(12.000000, 32.000000)">
+ <g id="txt" transform="translate(35.000000, 10.000000)">
+ <g id="browser">
+ <path d="M21.0000051,0.39034364 C20.9994786,0.29701568 20.9615913,0.207858845 20.8946802,0.142685701 C20.8275953,0.0776863856 20.7373957,0.0424059852 20.6440678,0.044547851 L0.355932203,0.044547851 C0.262604288,0.0422321924 0.172230877,0.0776863856 0.105319805,0.142685701 C0.0384086886,0.207685061 0.000347590042,0.29701568 -5.13814986e-06,0.39034364 L-5.13814986e-06,17.159999 C-0.00104277013,17.3591681 0.156763131,17.5232306 0.355932203,17.5298348 L5.23487982,17.5298348 L5.40554656,17.912879 C5.46654862,18.0503509 5.60784396,18.1341201 5.75782903,18.1216069 L6.47264799,18.0673828 C6.73994471,18.3993313 7.04999502,18.6944353 7.39480435,18.9448739 L7.37377516,19.657781 C7.36943029,19.8086351 7.46067267,19.9459332 7.60144661,20.0001573 L9.11989375,20.5863678 C9.2601463,20.6404181 9.41934258,20.6006191 9.51753676,20.4866095 L9.98104809,19.9494091 C10.4045865,19.9888606 10.8310795,19.9779115 11.2520111,19.916388 L11.7481959,20.4339496 C11.8516039,20.5417025 12.0109739,20.573507 12.1477506,20.5137215 L13.639607,19.8609475 C13.7777741,19.8004667 13.8629337,19.6593452 13.8518108,19.5088387 L13.7993247,18.7940198 C14.1316208,18.526723 14.4270723,18.2164989 14.6776847,17.8715158 L15.3911133,17.892545 C15.5409246,17.9005396 15.6790916,17.8115566 15.7336632,17.6718253 L15.7911894,17.5298348 L20.6440678,17.5298348 C20.8432369,17.5230568 21.0010428,17.3591681 21.0000051,17.159999 L21.0000051,4.16360731 C21.0000051,4.16239078 21.0000051,4.16134799 21.0000051,4.16013141 C21.0000051,4.15891483 21.0000051,4.15787209 21.0000051,4.15665551 L21.0000051,0.39034364 Z M20.2881356,0.756529716 L20.2881356,3.82644497 L0.711864407,3.82644497 L0.711864407,0.756529716 L20.2881356,0.756529716 Z M14.5063228,17.1542638 C14.3836235,17.1502665 14.2675285,17.2102257 14.1997484,17.312591 C13.9348848,17.7102341 13.6029363,18.0588668 13.2186755,18.3428479 C13.1204814,18.4153204 13.0664311,18.5333273 13.0752946,18.6549838 L13.1234359,19.3094958 L12.0900506,19.7615367 L11.6362718,19.2882928 C11.5535454,19.2019167 11.4329317,19.1629866 11.3152725,19.1845372 C10.841681,19.2712609 10.3574881,19.2837742 9.88007315,19.2215556 C9.76137118,19.2060878 9.64284296,19.2514483 9.564809,19.3419955 L9.14248708,19.8314023 L8.09293898,19.4266337 L8.11223019,18.7724692 C8.11587988,18.6499437 8.05592061,18.5340225 7.95390296,18.4658948 C7.55625995,18.2010312 7.20762712,17.8690827 6.92364608,17.4848219 C6.85099974,17.3868015 6.73316673,17.3327513 6.61151017,17.3416148 L5.95682436,17.3895822 L5.81605037,17.0678877 C5.80683925,17.0333024 5.79241425,17.0001076 5.77312299,16.9696934 L5.50478348,16.356197 L5.97802733,15.9024182 C6.06440349,15.8196918 6.10333358,15.6990781 6.08178295,15.5815926 C5.99505927,15.1080012 5.98254603,14.6238083 6.04476462,14.1463933 C6.06005858,14.0276913 6.01487188,13.9091631 5.92432468,13.8309554 L5.4349179,13.4086335 L5.8396865,12.3590853 L6.49385096,12.3783766 C6.61655026,12.3823739 6.73264534,12.3224146 6.80042537,12.2200493 C7.06528899,11.8222325 7.3972375,11.4735997 7.7814983,11.1897924 C7.87969248,11.1171461 7.93374269,10.9993131 7.92487918,10.8774828 L7.87673793,10.2229708 L8.91012315,9.77092987 L9.36407574,10.2441737 C9.44680217,10.3305498 9.56741589,10.3694799 9.68490137,10.3479293 C10.1586666,10.2612056 10.6428595,10.2486924 11.1202744,10.310911 C11.2389764,10.326205 11.3575047,10.2810183 11.4357124,10.1904711 L11.8580343,9.7010643 L12.9075824,10.1058329 L12.8882912,10.7598236 C12.8846415,10.8825228 12.944427,10.9984441 13.0466184,11.0665718 C13.4442614,11.3312616 13.7928943,11.6633839 14.0767015,12.0476447 C14.1493479,12.145665 14.2671809,12.1997153 14.3888374,12.1908517 L15.0433495,12.1427105 L15.4955641,13.1760958 L15.0221465,13.6298745 C14.9359441,13.712601 14.897014,13.8332147 14.9183908,13.9507002 C15.0051145,14.4242916 15.0176278,14.9084845 14.9555829,15.3858994 C14.9401152,15.5046014 14.9853019,15.6231297 15.0760229,15.7013374 L15.5654297,16.1236593 L15.1603135,17.1732074 L14.5063228,17.1542638 Z M16.0659593,16.8179704 L16.3195263,16.1533782 C16.3735765,16.0120829 16.3339513,15.8520177 16.2199417,15.7522593 L15.6827413,15.2870101 C15.7223666,14.8632978 15.7114175,14.4362834 15.6498941,14.0151781 L16.1674556,13.5184719 C16.2750347,13.4150639 16.3068392,13.2555201 16.2470538,13.1187434 L15.5944534,11.6268869 C15.5339728,11.4885461 15.3928512,11.4033865 15.2423448,11.4145094 L14.527352,11.4669955 C14.2602291,11.1346994 13.9503525,10.8392479 13.6055432,10.5884617 L13.6265725,9.8750331 C13.6309173,9.72417903 13.5396749,9.58688094 13.398901,9.53248311 L11.8804539,8.94644629 C11.7402013,8.89239608 11.581005,8.93219513 11.4828109,9.04603083 L11.0191257,9.58357886 C10.5955873,9.5439536 10.1689205,9.55490265 9.74798893,9.61642611 L9.25180414,9.09869073 C9.14856992,8.99093782 8.98902606,8.95913336 8.85224942,9.01891885 L7.36039295,9.67151912 C7.2222259,9.73199979 7.13706632,9.87329513 7.1481892,10.0238016 L7.20067532,10.7386206 C6.86837924,11.0059173 6.57310149,11.3161414 6.32231526,11.6609507 L5.60888671,11.6400953 C5.45785885,11.6352291 5.32038697,11.7264715 5.26633675,11.867593 L4.68047373,13.3860401 C4.62642346,13.5262927 4.66622251,13.6854889 4.78005826,13.7836832 L5.31743247,14.2473682 C5.2778072,14.6707329 5.2887563,15.0973997 5.35027972,15.5181574 L4.83289195,16.014516 C4.72496525,16.120531 4.69333454,16.2819865 4.75312002,16.4210226 L4.92343914,16.8179704 L0.711864407,16.8179704 L0.711864407,4.53830938 L20.2881356,4.53830938 L20.2881356,16.8179704 L16.0659593,16.8179704 Z" id="Shape"></path>
+ <path d="M4.59635694,3.39804025 C5.19264767,3.39804025 5.67788336,2.8969892 5.67788336,2.28105964 C5.67788336,1.66513009 5.19282145,1.16425286 4.59635694,1.16425286 C3.99989242,1.16425286 3.51483051,1.66513009 3.51483051,2.28105964 C3.51483051,2.8969892 4.00006621,3.39804025 4.59635694,3.39804025 Z M4.59635694,1.87594344 C4.80021849,1.87594344 4.96601896,2.05773305 4.96601896,2.28088586 C4.96601896,2.50403867 4.80021849,2.68600206 4.59635694,2.68600206 C4.39266917,2.68600206 4.22669492,2.50438623 4.22669492,2.28105964 C4.22669492,2.05773305 4.39266917,1.87594344 4.59635694,1.87594344 Z" id="Shape"></path>
+ <path d="M6.95406017,3.39804025 C7.55017712,3.39804025 8.03541282,2.8969892 8.03541282,2.28105964 C8.03541282,1.66513009 7.55052468,1.16425286 6.95406017,1.16425286 C6.35759566,1.16425286 5.87288136,1.66513009 5.87288136,2.28105964 C5.87288136,2.8969892 6.35776949,3.39804025 6.95406017,3.39804025 Z M6.95406017,1.87594344 C7.15774794,1.87594344 7.32354841,2.05773305 7.32354841,2.28088586 C7.32354841,2.50403867 7.15774794,2.68600206 6.95406017,2.68600206 C6.75019862,2.68600206 6.58474576,2.50438623 6.58474576,2.28105964 C6.58474576,2.05773305 6.75037241,1.87594344 6.95406017,1.87594344 Z" id="Shape"></path>
+ <path d="M2.23865366,3.39804025 C2.83494439,3.39804025 3.32018008,2.8969892 3.32018008,2.28105964 C3.32018008,1.66513009 2.83511817,1.16425286 2.23865366,1.16425286 C1.64218914,1.16425286 1.15730106,1.66530392 1.15730106,2.28105964 C1.15730106,2.89681541 1.64236293,3.39804025 2.23865366,3.39804025 Z M2.23865366,1.87594344 C2.44234142,1.87594344 2.60831568,2.05773305 2.60831568,2.28088586 C2.60831568,2.50403867 2.44234142,2.68600206 2.23865366,2.68600206 C2.03496589,2.68600206 1.86916546,2.50421245 1.86916546,2.28088586 C1.86916546,2.05738548 2.03496589,1.87594344 2.23865366,1.87594344 Z" id="Shape"></path>
+ <path d="M10.5,11.3416893 C8.6087626,11.3416893 7.0755429,12.874909 7.0755429,14.7663202 C7.0755429,16.6575576 8.6087626,18.1907773 10.5,18.1907773 C12.3912374,18.1907773 13.9244571,16.6575576 13.9244571,14.7663202 C13.9223716,12.875778 12.3903684,11.3439486 10.5,11.3416893 Z M10.5,17.4789129 C9.00188692,17.4789129 7.78740731,16.2644333 7.78740731,14.7663202 C7.78740731,13.2680333 9.00188692,12.0535537 10.5,12.0535537 C11.9981131,12.0535537 13.2125927,13.2680333 13.2125927,14.7663202 C13.2110285,16.2637381 11.9974179,17.4771749 10.5,17.4789129 Z" id="Shape"></path>
+ <path d="M10.5,13.0556558 C9.55525026,13.0556558 8.7893356,13.8215704 8.7893356,14.7663202 C8.7893356,15.7108961 9.55525026,16.4768108 10.5,16.4768108 C11.4447497,16.4768108 12.2104906,15.7110699 12.2104906,14.7663202 C12.2094478,13.8220918 11.4442283,13.0568724 10.5,13.0556558 L10.5,13.0556558 Z M10.5,15.7649464 C9.94837458,15.7649464 9.5012,15.3177718 9.5012,14.7663202 C9.5012,14.2146948 9.94837458,13.7675202 10.5,13.7675202 C11.0516254,13.7675202 11.4986262,14.2146948 11.4986262,14.7663202 C11.4981048,15.317598 11.0512778,15.7642512 10.5,15.7649464 L10.5,15.7649464 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType1.svg b/cds-ui/designer-client/src/assets/img/icon-comType1.svg
new file mode 100644
index 000000000..aab6e1ed1
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType1.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="36px" height="36px" viewBox="0 0 36 36" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>browser</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-535.000000, -232.000000)" fill="#FFFFFF" fill-rule="nonzero">
+ <g id="workflow-container" transform="translate(401.000000, 137.000000)">
+ <g id="component" transform="translate(30.000000, 70.000000)">
+ <g id="config-assign">
+ <g id="Group-4" transform="translate(37.000000, 25.000000)">
+ <g id="browser" transform="translate(67.000000, 0.000000)">
+ <path d="M36.0000088,0.669160525 C35.9991062,0.509169737 35.9341565,0.356329449 35.8194518,0.244604059 C35.7044492,0.133176661 35.5498212,0.0726959746 35.3898305,0.0763677445 L0.610169492,0.0763677445 C0.45017878,0.0723980441 0.295252932,0.133176661 0.180548237,0.244604059 C0.0658434661,0.356031534 0.000595868644,0.509169737 -8.80825691e-06,0.669160525 L-8.80825691e-06,29.4171411 C-0.00178760593,29.7585739 0.268736797,30.0398239 0.610169492,30.0511454 L8.97407969,30.0511454 L9.26665124,30.7077926 C9.3712262,30.9434587 9.61344679,31.0870631 9.87056405,31.0656118 L11.095968,30.9726563 C11.5541909,31.5417108 12.0857058,32.0476033 12.6768074,32.4769267 L12.6407574,33.6990532 C12.6333091,33.9576602 12.7897246,34.1930284 13.0310513,34.2859839 L15.6341036,35.2909163 C15.8745365,35.3835739 16.1474444,35.315347 16.3157773,35.1199021 L17.1103682,34.198987 C17.8364341,34.2666182 18.5675649,34.2478483 19.2891618,34.1423795 L20.1397643,35.0296279 C20.3170352,35.2143472 20.590241,35.2688691 20.8247153,35.1663797 L23.3821835,34.0473385 C23.6190413,33.9436573 23.7650292,33.7017347 23.7459614,33.4437235 L23.6559852,32.2183197 C24.2256356,31.7600966 24.7321239,31.2282839 25.1617453,30.6368843 L26.3847656,30.6729343 C26.641585,30.6866393 26.8784428,30.534097 26.9719941,30.2945577 L27.0706104,30.0511454 L35.3898305,30.0511454 C35.7312632,30.0395259 36.0017876,29.7585739 36.0000088,29.4171411 L36.0000088,7.13761253 C36.0000088,7.13552705 36.0000088,7.13373941 36.0000088,7.13165385 C36.0000088,7.12956829 36.0000088,7.12778072 36.0000088,7.12569516 L36.0000088,0.669160525 Z M34.779661,1.29690808 L34.779661,6.55961995 L1.22033898,6.55961995 L1.22033898,1.29690808 L34.779661,1.29690808 Z M24.867982,29.4073093 C24.6576403,29.4004568 24.4586203,29.5032441 24.3424258,29.6787275 C23.8883739,30.3604012 23.3193194,30.9580574 22.6605866,31.4448822 C22.4922537,31.5691208 22.3995962,31.7714182 22.4147907,31.9799722 L22.4973186,33.1019928 L20.7258011,33.87692 L19.9478946,33.0656449 C19.8060779,32.9175715 19.5993114,32.8508343 19.3976099,32.887778 C18.5857389,33.0364473 17.7556939,33.0578986 16.9372683,32.9512381 C16.7337792,32.924722 16.5305879,33.0024828 16.3968154,33.1577066 L15.672835,33.9966896 L13.8736097,33.3028006 L13.9066803,32.1813758 C13.9129369,31.9713321 13.8101496,31.7726099 13.6352622,31.6558197 C12.9535885,31.2017678 12.3559322,30.6327132 11.8691076,29.9739804 C11.744571,29.8059454 11.5425715,29.7132879 11.3340174,29.7284826 L10.2116989,29.8107124 L9.97037207,29.259236 C9.95458157,29.199947 9.929853,29.1430416 9.89678227,29.090903 L9.43677168,28.0391949 L10.2480469,27.2612884 C10.3961203,27.1194716 10.4628576,26.9127053 10.4259136,26.7113017 C10.2772445,25.8994306 10.2557932,25.0693856 10.3624536,24.25096 C10.3886719,24.0474708 10.3112089,23.8442797 10.1559852,23.7102093 L9.31700212,22.9862288 L10.0108911,21.1870034 L11.1323159,21.2200742 C11.3426576,21.2269267 11.5416777,21.1241393 11.6578721,20.948656 C12.111924,20.2666843 12.6809786,19.669028 13.3397114,19.1825013 C13.5080442,19.0579648 13.6007018,18.8559653 13.5855072,18.6471133 L13.5029793,17.5250927 L15.2744968,16.7501655 L16.0527013,17.5614407 C16.194518,17.709514 16.4012844,17.7762513 16.6026881,17.7393074 C17.414857,17.5906382 18.2449021,17.5691869 19.0633276,17.6758475 C19.2668167,17.7020657 19.470008,17.6246028 19.6040784,17.469379 L20.3280588,16.6303959 L22.1272841,17.324285 L22.0942135,18.4454118 C22.0879568,18.6557534 22.1904462,18.8544756 22.3656316,18.9712659 C23.0473053,19.4250199 23.6449616,19.9943724 24.1314883,20.6531051 C24.2560249,20.8211401 24.4580244,20.9137977 24.6665784,20.898603 L25.7885991,20.8160752 L26.5638242,22.5875927 L25.7522511,23.3654992 C25.6044756,23.5073159 25.5377383,23.7140824 25.5743843,23.915486 C25.7230535,24.727357 25.7445047,25.5574021 25.6381422,26.3758276 C25.6116261,26.5793167 25.689089,26.782508 25.8446107,26.9165784 L26.6835937,27.6405588 L25.9891089,29.4397841 L24.867982,29.4073093 Z M27.5416446,28.8308064 L27.9763308,27.6915055 C28.0689883,27.449285 28.0010593,27.1748875 27.8056144,27.0038731 L26.8846994,26.206303 C26.9526284,25.4799391 26.9338585,24.7479144 26.8283898,24.0260196 L27.7156382,23.1745233 C27.9000596,22.9972524 27.9545816,22.7237487 27.8520922,22.4892744 L26.7333488,19.9318061 C26.6296676,19.6946504 26.3877449,19.5486626 26.1297339,19.5677304 L24.904032,19.6577066 C24.446107,19.0880561 23.9148901,18.5815678 23.3237884,18.1516486 L23.3598385,16.9286282 C23.3672868,16.6700212 23.2108713,16.434653 22.9695445,16.3413996 L20.3664923,15.3367651 C20.1260593,15.2441076 19.8531515,15.3123345 19.6848186,15.5074814 L18.8899298,16.4289923 C18.1638639,16.3610633 17.4324351,16.3798331 16.7108382,16.4853019 L15.8602357,15.5977555 C15.6832627,15.4130363 15.409759,15.3585143 15.1752847,15.4610037 L12.6178165,16.5797471 C12.3809587,16.6834282 12.2349708,16.9256488 12.2540386,17.18366 L12.3440148,18.4090638 C11.7743644,18.8672868 11.268174,19.3990996 10.8382547,19.9902013 L9.61523436,19.9544492 C9.35632945,19.946107 9.12066338,20.1025225 9.02800586,20.3444452 L8.02366925,22.9474974 C7.93101165,23.1879303 7.99923859,23.4608382 8.19438559,23.6291711 L9.11559852,24.4240598 C9.04766949,25.1498279 9.06643937,25.8812566 9.17190808,26.6025556 L8.28495763,27.453456 C8.09994043,27.635196 8.04571635,27.9119769 8.14820575,28.1503244 L8.44018139,28.8308064 L1.22033898,28.8308064 L1.22033898,7.77995893 L34.779661,7.77995893 L34.779661,28.8308064 L27.5416446,28.8308064 Z" id="Shape"></path>
+ <path d="M7.87946903,5.82521186 C8.90168171,5.82521186 9.73351434,4.96626719 9.73351434,3.91038796 C9.73351434,2.85450872 8.90197963,1.99586204 7.87946903,1.99586204 C6.85695844,1.99586204 6.02542373,2.85450872 6.02542373,3.91038796 C6.02542373,4.96626719 6.85725636,5.82521186 7.87946903,5.82521186 Z M7.87946903,3.21590303 C8.22894597,3.21590303 8.51317536,3.52754237 8.51317536,3.91009004 C8.51317536,4.29263771 8.22894597,4.60457497 7.87946903,4.60457497 C7.53029001,4.60457497 7.24576271,4.29323354 7.24576271,3.91038796 C7.24576271,3.52754237 7.53029001,3.21590303 7.87946903,3.21590303 Z" id="Shape"></path>
+ <path d="M11.921246,5.82521186 C12.9431608,5.82521186 13.7749934,4.96626719 13.7749934,3.91038796 C13.7749934,2.85450872 12.9437566,1.99586204 11.921246,1.99586204 C10.8987354,1.99586204 10.0677966,2.85450872 10.0677966,3.91038796 C10.0677966,4.96626719 10.8990334,5.82521186 11.921246,5.82521186 Z M11.921246,3.21590303 C12.270425,3.21590303 12.5546544,3.52754237 12.5546544,3.91009004 C12.5546544,4.29263771 12.270425,4.60457497 11.921246,4.60457497 C11.5717691,4.60457497 11.2881356,4.29323354 11.2881356,3.91038796 C11.2881356,3.52754237 11.572067,3.21590303 11.921246,3.21590303 Z" id="Shape"></path>
+ <path d="M3.83769198,5.82521186 C4.85990466,5.82521186 5.69173729,4.96626719 5.69173729,3.91038796 C5.69173729,2.85450872 4.86020258,1.99586204 3.83769198,1.99586204 C2.81518139,1.99586204 1.98394467,2.85480671 1.98394467,3.91038796 C1.98394467,4.96596928 2.81547931,5.82521186 3.83769198,5.82521186 Z M3.83769198,3.21590303 C4.18687101,3.21590303 4.47139831,3.52754237 4.47139831,3.91009004 C4.47139831,4.29263771 4.18687101,4.60457497 3.83769198,4.60457497 C3.48851296,4.60457497 3.20428365,4.29293563 3.20428365,3.91009004 C3.20428365,3.52694654 3.48851296,3.21590303 3.83769198,3.21590303 Z" id="Shape"></path>
+ <path d="M18,19.4428959 C14.7578787,19.4428959 12.1295021,22.0712725 12.1295021,25.3136917 C12.1295021,28.5558131 14.7578787,31.1841896 18,31.1841896 C21.2421213,31.1841896 23.8704979,28.5558131 23.8704979,25.3136917 C23.8669227,22.0727622 21.2406316,19.4467691 18,19.4428959 Z M18,29.9638506 C15.4318061,29.9638506 13.3498411,27.8818856 13.3498411,25.3136917 C13.3498411,22.7452 15.4318061,20.6632349 18,20.6632349 C20.5681939,20.6632349 22.6501589,22.7452 22.6501589,25.3136917 C22.6474775,27.8806939 20.5670021,29.9608713 18,29.9638506 Z" id="Shape"></path>
+ <path d="M18,22.3811242 C16.380429,22.3811242 15.0674324,23.6941208 15.0674324,25.3136917 C15.0674324,26.9329648 16.380429,28.2459614 18,28.2459614 C19.619571,28.2459614 20.9322696,26.9332627 20.9322696,25.3136917 C20.930482,23.6950146 19.6186772,22.3832097 18,22.3811242 L18,22.3811242 Z M18,27.0256224 C17.0543564,27.0256224 16.2877714,26.2590373 16.2877714,25.3136917 C16.2877714,24.3680482 17.0543564,23.6014632 18,23.6014632 C18.9456436,23.6014632 19.7119306,24.3680482 19.7119306,25.3136917 C19.7110368,26.2587394 18.9450477,27.0244306 18,27.0256224 L18,27.0256224 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType2-sm.svg b/cds-ui/designer-client/src/assets/img/icon-comType2-sm.svg
new file mode 100644
index 000000000..b28bd927a
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType2-sm.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="19px" height="21px" viewBox="0 0 19 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>database0</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-55.000000, -682.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="controller" transform="translate(0.000000, 60.000000)">
+ <g id="functions" transform="translate(0.000000, 479.000000)">
+ <g id="list" transform="translate(8.000000, 51.000000)">
+ <g id="2" transform="translate(12.000000, 82.000000)">
+ <g id="txt" transform="translate(35.000000, 10.000000)">
+ <g id="database0">
+ <path d="M18.831139,3.18252756 C18.3980759,1.57817465 15.1747851,0 9.53636343,0 C3.8979418,0 0.674276991,1.57817465 0.241587873,3.18252756 C0.21017397,3.23750189 0.186987518,3.29771187 0.186987518,3.36577533 L0.186987518,3.55276285 L0.186987518,7.85347576 L0.186987518,8.04046328 L0.186987518,8.2274508 L0.186987518,12.3411762 L0.186987518,12.5281637 L0.186987518,12.7151512 L0.186987518,17.2028517 C0.186987518,17.2634356 0.203068445,17.3206538 0.230742597,17.3715144 C0.672407115,19.2021222 4.62382735,20.568627 9.53636343,20.568627 C14.4376803,20.568627 18.3827429,19.2077318 18.8389925,17.3838556 C18.8689105,17.3303772 18.8857393,17.2686713 18.8857393,17.2028517 L18.8857393,12.7151512 L18.8857393,12.5281637 L18.8857393,12.3411762 L18.8857393,8.2274508 L18.8857393,8.04046328 L18.8857393,7.85347576 L18.8857393,3.55276285 L18.8857393,3.36577533 C18.8857393,3.29771187 18.8625529,3.23750189 18.831139,3.18252756 Z M18.1082452,12.7095416 C18.0977739,12.7547926 18.0831889,12.7996696 18.0648641,12.8452945 C18.0499051,12.8823181 18.0315804,12.9193416 18.0113857,12.9563651 C17.9863294,13.0023641 17.9582812,13.048363 17.9249975,13.0943619 C17.9003151,13.1291416 17.872267,13.1635473 17.8430969,13.197953 C17.8015857,13.2469437 17.7574567,13.2959345 17.707344,13.3445512 C17.677052,13.3740953 17.6437682,13.4032653 17.6101105,13.4328093 C17.5487786,13.4862878 17.4848289,13.5393922 17.4133996,13.5921227 C17.3827337,13.6149352 17.3498239,13.6369997 17.317288,13.6594382 C17.2327697,13.7177783 17.1445116,13.7757444 17.047652,13.8325886 C17.0222217,13.8479216 16.9949216,13.8625066 16.9683693,13.8774656 C16.8569248,13.9402935 16.7406185,14.0027473 16.6149629,14.0633312 C16.598882,14.0711847 16.5820531,14.0786642 16.5655982,14.0861437 C16.4253576,14.1523373 16.2787594,14.217409 16.1220638,14.2802368 C16.1175761,14.2821066 16.1130884,14.2836025 16.1086007,14.2854724 C15.2593034,14.6246678 14.1729059,14.9100107 12.9070004,15.0969982 C12.9006429,15.0977462 12.8942853,15.0984941 12.8879277,15.0996161 C12.6418521,15.1358916 12.389419,15.1680535 12.1302543,15.1964756 C12.0879951,15.2009633 12.0434921,15.2039551 12.0008589,15.2084428 C11.774604,15.2320032 11.5457313,15.2536938 11.310127,15.2708966 C11.2024222,15.2787501 11.0894818,15.2824899 10.9799071,15.2892214 C10.8026429,15.2996927 10.6272486,15.3112859 10.4454967,15.3176435 C10.1485606,15.3269929 9.84564078,15.3329765 9.53636343,15.3329765 C9.22708607,15.3329765 8.92416629,15.3269929 8.62685614,15.3165216 C8.44510427,15.310164 8.26970998,15.2981968 8.09244581,15.2880995 C7.98287113,15.2817419 7.86993067,15.2776282 7.76222585,15.2697747 C7.52662158,15.2525719 7.29774886,15.2308813 7.07149396,15.2073209 C7.02886081,15.2028332 6.98435778,15.1998414 6.9420986,15.1953537 C6.6829339,15.1669316 6.43050075,15.1343957 6.18442518,15.0984941 C6.1780676,15.0977462 6.17171003,15.0969982 6.16535245,15.0958763 C4.89944695,14.9088888 3.81304947,14.6235458 2.96375216,14.2843505 C2.95926446,14.2828546 2.95477676,14.2809847 2.95028906,14.2791148 C2.79359352,14.216287 2.64662133,14.1512154 2.50675467,14.0850218 C2.49067374,14.0771683 2.47347089,14.0696888 2.45738996,14.0622093 C2.33173435,14.0016254 2.21542812,13.9395455 2.10398355,13.8763437 C2.0778053,13.8613847 2.05013115,13.8467997 2.02470085,13.8314667 C1.92784131,13.7746225 1.8395832,13.7166564 1.75506485,13.6583163 C1.72290299,13.6358778 1.68961921,13.6138132 1.65895326,13.5910008 C1.58752403,13.5382703 1.5235743,13.4851658 1.46224239,13.4316874 C1.42895861,13.4025174 1.39530086,13.3733473 1.36500888,13.3434293 C1.31489623,13.2948125 1.27076717,13.2461958 1.22925594,13.1968311 C1.20008589,13.1624254 1.17203776,13.1280197 1.14735541,13.09324 C1.11444561,13.0472411 1.08639748,13.0012421 1.06096718,12.9552432 C1.04077253,12.9182197 1.02282172,12.8811962 1.00748875,12.8441726 C0.989163971,12.7989216 0.974578945,12.7536707 0.964107644,12.7084197 C0.950270567,12.6489577 0.934937591,12.5883737 0.934937591,12.5281637 C0.934937591,12.4859045 0.939799266,12.4436454 0.946530817,12.4017602 C0.955880193,12.3452899 0.950644542,12.2888197 0.934937591,12.2353413 L0.934937591,9.45895059 C0.945408892,9.46867395 0.958498018,9.47802332 0.969343294,9.48774667 C1.05086985,9.55954988 1.13389231,9.63097911 1.22738607,9.69979052 C2.63615003,10.7652454 5.45330398,11.5932261 9.53636343,11.5932261 C13.60222,11.5932261 16.4122684,10.7719769 17.827016,9.71287964 C17.9399565,9.63060514 18.0416777,9.5457128 18.1374153,9.45932457 L18.1377893,9.45895059 L18.1377893,12.2353413 C18.1220823,12.2888197 18.1168467,12.3452899 18.126196,12.4017602 C18.1333016,12.4436454 18.1377893,12.4859045 18.1377893,12.5281637 C18.1377893,12.5883737 18.1224563,12.6489577 18.1082452,12.7095416 Z M18.1377893,4.97125016 L18.1377893,7.74764083 C18.1220823,7.80111926 18.1168467,7.85758949 18.126196,7.91405972 C18.1333016,7.95594492 18.1377893,7.9982041 18.1377893,8.04046328 C18.1377893,8.10067326 18.1224563,8.16125722 18.1082452,8.22184117 C18.0977739,8.26709215 18.0831889,8.31196916 18.0648641,8.35759411 C18.0499051,8.39461764 18.0315804,8.43164117 18.0113857,8.4686647 C17.9863294,8.51466363 17.9582812,8.56066256 17.9249975,8.60666149 C17.9003151,8.64144117 17.872267,8.67584687 17.8430969,8.71025257 C17.8015857,8.7592433 17.7574567,8.80823403 17.707344,8.85685079 C17.677052,8.88639481 17.6437682,8.91556487 17.6101105,8.94510889 C17.5487786,8.99858732 17.4848289,9.05169178 17.4133996,9.10442226 C17.3827337,9.12723474 17.3498239,9.14929926 17.317288,9.17173777 C17.2327697,9.23007787 17.1445116,9.288044 17.047652,9.34488821 C17.0222217,9.36022119 16.9949216,9.37480621 16.9683693,9.38976521 C16.8569248,9.45259302 16.7406185,9.51504685 16.6149629,9.57563081 C16.598882,9.58348428 16.5820531,9.59096378 16.5655982,9.59844328 C16.4253576,9.66463686 16.2787594,9.72970852 16.1220638,9.79253633 C16.1175761,9.7944062 16.1130884,9.7959021 16.1086007,9.79777198 C15.2593034,10.1369673 14.1729059,10.4223103 12.9070004,10.6092978 C12.9006429,10.6100458 12.8942853,10.6107937 12.8879277,10.6119156 C12.6418521,10.6481912 12.389419,10.6803531 12.1302543,10.7087752 C12.0879951,10.7132629 12.0434921,10.7162547 12.0008589,10.7207424 C11.774604,10.7443028 11.5457313,10.7659933 11.310127,10.7831962 C11.2024222,10.7910497 11.0894818,10.7947894 10.9799071,10.801521 C10.8026429,10.8119923 10.6272486,10.8235855 10.4454967,10.8299431 C10.1485606,10.8392925 9.84564078,10.8452761 9.53636343,10.8452761 C9.22708607,10.8452761 8.92416629,10.8392925 8.62685614,10.8288212 C8.44510427,10.8224636 8.26970998,10.8104964 8.09244581,10.8003991 C7.98287113,10.7940415 7.86993067,10.7899277 7.76222585,10.7820743 C7.52662158,10.7648714 7.29774886,10.7431809 7.07149396,10.7196204 C7.02886081,10.7151327 6.98435778,10.7121409 6.9420986,10.7076532 C6.6829339,10.6792311 6.43050075,10.6466953 6.18442518,10.6107937 C6.1780676,10.6100458 6.17171003,10.6092978 6.16535245,10.6081759 C4.89944695,10.4211884 3.81304947,10.1358454 2.96375216,9.79665005 C2.95926446,9.79515415 2.95477676,9.79328428 2.95028906,9.7914144 C2.79359352,9.7285866 2.64662133,9.66351494 2.50675467,9.59732136 C2.49067374,9.58946788 2.47347089,9.58198838 2.45738996,9.57450888 C2.33173435,9.51392493 2.21542812,9.45184507 2.10398355,9.38864329 C2.0778053,9.37368429 2.05013115,9.35909926 2.02470085,9.34376628 C1.92784131,9.28692208 1.8395832,9.22895595 1.75506485,9.17061584 C1.72290299,9.14817734 1.68961921,9.12611281 1.65895326,9.10330034 C1.58752403,9.05056986 1.5235743,8.9974654 1.46224239,8.94398697 C1.42895861,8.91481692 1.39530086,8.88564686 1.36500888,8.85572886 C1.31489623,8.80711211 1.27076717,8.75849535 1.22925594,8.70913065 C1.20008589,8.67472494 1.17203776,8.64031924 1.14735541,8.60553956 C1.11444561,8.55954063 1.08639748,8.5135417 1.06096718,8.46754277 C1.04077253,8.43051924 1.02282172,8.39349572 1.00748875,8.35647219 C0.989163971,8.31122121 0.974578945,8.26597023 0.964107644,8.22071925 C0.950270567,8.16125722 0.934937591,8.10067326 0.934937591,8.04046328 C0.934937591,7.9982041 0.939799266,7.95594492 0.946530817,7.91405972 C0.955880193,7.85758949 0.950644542,7.80111926 0.934937591,7.74764083 L0.934937591,4.97125016 C0.979814595,5.01201344 1.03104918,5.05202877 1.07966593,5.09241807 C1.10659213,5.11485657 1.13164846,5.13729507 1.16007056,5.15973358 C1.27226307,5.24799169 1.39343099,5.33512787 1.52469622,5.4200202 C1.5519964,5.43759703 1.58266235,5.45479988 1.61108446,5.47237671 C1.72103312,5.54081414 1.83733935,5.60775567 1.95962919,5.67357528 C2.00488017,5.69788365 2.05013115,5.72181806 2.09687803,5.74575246 C2.23337892,5.81531182 2.37661136,5.8830013 2.5273233,5.94844693 C2.55200565,5.9592922 2.57444415,5.97051146 2.59950048,5.98098276 C2.77489477,6.05540379 2.96113434,6.12645905 3.15485341,6.19527045 C3.20833184,6.21434318 3.26442809,6.23229398 3.31940242,6.25099273 C3.47348014,6.30297526 3.6327935,6.35271394 3.79771649,6.40095672 C3.85717853,6.41815957 3.91551863,6.43611038 3.97647656,6.45256528 C4.19525196,6.51314923 4.42113288,6.57074139 4.65823305,6.62384584 C4.69076888,6.63132534 4.72592253,6.63730895 4.75883234,6.64441447 C4.96788438,6.69003943 5.1847899,6.7322986 5.40767903,6.77193996 C5.48322198,6.78540306 5.55988687,6.79811821 5.63692572,6.81083336 C5.84896957,6.84561304 6.06737099,6.87740092 6.29138204,6.90657097 C6.34897419,6.91405047 6.40394852,6.9226519 6.46228863,6.92975742 C6.74052606,6.96341518 7.02848683,6.99221125 7.32430109,7.01689361 C7.39722622,7.02287721 7.47314315,7.02736491 7.54719021,7.03260056 C7.78391641,7.04980341 8.02587826,7.06401446 8.27344973,7.07523371 C8.36357771,7.07934744 8.45333172,7.08346116 8.54532958,7.08682694 C8.86769606,7.09767222 9.19604614,7.10552569 9.53636343,7.10552569 C9.87668071,7.10552569 10.2050308,7.09767222 10.5273973,7.08682694 C10.6190212,7.08346116 10.7087752,7.07934744 10.7992771,7.07523371 C11.0468486,7.06401446 11.2888104,7.04980341 11.5255366,7.03260056 C11.5995837,7.02699093 11.6751267,7.02287721 11.7484258,7.01689361 C12.04424,6.99258523 12.3322008,6.96341518 12.6104382,6.92975742 C12.6687783,6.9226519 12.7237527,6.91405047 12.7813448,6.90657097 C13.0053559,6.87740092 13.2233833,6.84561304 13.4358011,6.81083336 C13.51284,6.79811821 13.5895049,6.78540306 13.6650478,6.77193996 C13.887937,6.7322986 14.1048425,6.69003943 14.3138945,6.64441447 C14.3468043,6.63730895 14.381958,6.63095137 14.4144938,6.62384584 C14.651594,6.57074139 14.8774749,6.51277526 15.0962503,6.45256528 C15.1572082,6.4357364 15.2155483,6.41815957 15.2750104,6.40095672 C15.4399334,6.35271394 15.5992467,6.30297526 15.7533244,6.25099273 C15.8082988,6.23229398 15.864395,6.21434318 15.9178734,6.19527045 C16.1115925,6.12645905 16.2982061,6.05540379 16.4732264,5.98098276 C16.4982827,5.97051146 16.5207212,5.9592922 16.5454036,5.94844693 C16.6961155,5.88262732 16.8393479,5.81531182 16.9758488,5.74575246 C17.0225957,5.72181806 17.0682207,5.69788365 17.1130977,5.67357528 C17.2353875,5.60812965 17.3516937,5.54118811 17.4616424,5.47237671 C17.4900645,5.45479988 17.5207305,5.43759703 17.5480306,5.4200202 C17.6792959,5.33512787 17.8004638,5.24836566 17.9126563,5.15973358 C17.9407044,5.13729507 17.9657607,5.11485657 17.9930609,5.09241807 C18.0416777,5.05202877 18.0929123,5.01201344 18.1377893,4.97125016 Z M9.53636343,0.747950073 C14.605595,0.747950073 18.1377893,2.22589942 18.1377893,3.55276285 C18.1377893,4.87962627 14.605595,6.35757562 9.53636343,6.35757562 C4.46713181,6.35757562 0.934937591,4.87962627 0.934937591,3.55276285 C0.934937591,2.22589942 4.46713181,0.747950073 9.53636343,0.747950073 Z M18.1377893,17.0917811 C18.1325536,17.108236 18.1288139,17.1250649 18.1258221,17.1422677 C17.9137782,18.4358474 14.411502,19.8206769 9.53636343,19.8206769 C4.66122485,19.8206769 1.15894864,18.4358474 0.946904792,17.1422677 C0.943912992,17.1254388 0.939799266,17.1089839 0.934937591,17.093277 L0.934937591,13.946651 C0.945408892,13.9563744 0.958498018,13.9657238 0.969343294,13.9754471 C1.05086985,14.0472503 1.13389231,14.1186795 1.22738607,14.187491 C2.63615003,15.2529458 5.45330398,16.0809266 9.53636343,16.0809266 C13.60222,16.0809266 16.4122684,15.2596774 17.827016,14.2005801 C17.9399565,14.1183056 18.0416777,14.0334132 18.1374153,13.947025 L18.1377893,13.946651 L18.1377893,17.0917811 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType2.svg b/cds-ui/designer-client/src/assets/img/icon-comType2.svg
new file mode 100644
index 000000000..e1f75962e
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType2.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="36px" height="39px" viewBox="0 0 36 39" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>database0</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-839.000000, -232.000000)" fill="#FFFFFF" fill-rule="nonzero">
+ <g id="workflow-container" transform="translate(401.000000, 137.000000)">
+ <g id="component" transform="translate(30.000000, 70.000000)">
+ <g id="execute" transform="translate(304.000000, 0.000000)">
+ <g id="Group-4" transform="translate(43.000000, 25.000000)">
+ <g id="database0" transform="translate(61.000000, 0.000000)">
+ <path d="M35.544,6.00705882 C34.7265882,2.97882353 28.6425882,0 18,0 C7.35741176,0 1.27270588,2.97882353 0.456,6.00705882 C0.396705882,6.11082353 0.352941176,6.22447059 0.352941176,6.35294118 L0.352941176,6.70588235 L0.352941176,14.8235294 L0.352941176,15.1764706 L0.352941176,15.5294118 L0.352941176,23.2941176 L0.352941176,23.6470588 L0.352941176,24 L0.352941176,32.4705882 C0.352941176,32.5849412 0.383294118,32.6929412 0.435529412,32.7889412 C1.26917647,36.2442353 8.72752941,38.8235294 18,38.8235294 C27.2512941,38.8235294 34.6976471,36.2548235 35.5588235,32.8122353 C35.6152941,32.7112941 35.6470588,32.5948235 35.6470588,32.4705882 L35.6470588,24 L35.6470588,23.6470588 L35.6470588,23.2941176 L35.6470588,15.5294118 L35.6470588,15.1764706 L35.6470588,14.8235294 L35.6470588,6.70588235 L35.6470588,6.35294118 C35.6470588,6.22447059 35.6032941,6.11082353 35.544,6.00705882 Z M34.1795294,23.9894118 C34.1597647,24.0748235 34.1322353,24.1595294 34.0976471,24.2456471 C34.0694118,24.3155294 34.0348235,24.3854118 33.9967059,24.4552941 C33.9494118,24.5421176 33.8964706,24.6289412 33.8336471,24.7157647 C33.7870588,24.7814118 33.7341176,24.8463529 33.6790588,24.9112941 C33.6007059,25.0037647 33.5174118,25.0962353 33.4228235,25.188 C33.3656471,25.2437647 33.3028235,25.2988235 33.2392941,25.3545882 C33.1235294,25.4555294 33.0028235,25.5557647 32.868,25.6552941 C32.8101176,25.6983529 32.748,25.74 32.6865882,25.7823529 C32.5270588,25.8924706 32.3604706,26.0018824 32.1776471,26.1091765 C32.1296471,26.1381176 32.0781176,26.1656471 32.028,26.1938824 C31.8176471,26.3124706 31.5981176,26.4303529 31.3609412,26.5447059 C31.3305882,26.5595294 31.2988235,26.5736471 31.2677647,26.5877647 C31.0030588,26.7127059 30.7263529,26.8355294 30.4305882,26.9541176 C30.4221176,26.9576471 30.4136471,26.9604706 30.4051765,26.964 C28.8021176,27.6042353 26.7515294,28.1428235 24.3621176,28.4957647 C24.3501176,28.4971765 24.3381176,28.4985882 24.3261176,28.5007059 C23.8616471,28.5691765 23.3851765,28.6298824 22.896,28.6835294 C22.8162353,28.692 22.7322353,28.6976471 22.6517647,28.7061176 C22.2247059,28.7505882 21.7927059,28.7915294 21.348,28.824 C21.1447059,28.8388235 20.9315294,28.8458824 20.7247059,28.8585882 C20.3901176,28.8783529 20.0590588,28.9002353 19.716,28.9122353 C19.1555294,28.9298824 18.5837647,28.9411765 18,28.9411765 C17.4162353,28.9411765 16.8444706,28.9298824 16.2832941,28.9101176 C15.9402353,28.8981176 15.6091765,28.8755294 15.2745882,28.8564706 C15.0677647,28.8444706 14.8545882,28.8367059 14.6512941,28.8218824 C14.2065882,28.7894118 13.7745882,28.7484706 13.3475294,28.704 C13.2670588,28.6955294 13.1830588,28.6898824 13.1032941,28.6814118 C12.6141176,28.6277647 12.1376471,28.5663529 11.6731765,28.4985882 C11.6611765,28.4971765 11.6491765,28.4957647 11.6371765,28.4936471 C9.24776471,28.1407059 7.19717647,27.6021176 5.59411765,26.9618824 C5.58564706,26.9590588 5.57717647,26.9555294 5.56870588,26.952 C5.27294118,26.8334118 4.99552941,26.7105882 4.73152941,26.5856471 C4.70117647,26.5708235 4.66870588,26.5567059 4.63835294,26.5425882 C4.40117647,26.4282353 4.18164706,26.3110588 3.97129412,26.1917647 C3.92188235,26.1635294 3.86964706,26.136 3.82164706,26.1070588 C3.63882353,25.9997647 3.47223529,25.8903529 3.31270588,25.7802353 C3.252,25.7378824 3.18917647,25.6962353 3.13129412,25.6531765 C2.99647059,25.5536471 2.87576471,25.4534118 2.76,25.3524706 C2.69717647,25.2974118 2.63364706,25.2423529 2.57647059,25.1858824 C2.48188235,25.0941176 2.39858824,25.0023529 2.32023529,24.9091765 C2.26517647,24.8442353 2.21223529,24.7792941 2.16564706,24.7136471 C2.10352941,24.6268235 2.05058824,24.54 2.00258824,24.4531765 C1.96447059,24.3832941 1.93058824,24.3134118 1.90164706,24.2435294 C1.86705882,24.1581176 1.83952941,24.0727059 1.81976471,23.9872941 C1.79364706,23.8750588 1.76470588,23.7607059 1.76470588,23.6470588 C1.76470588,23.5672941 1.77388235,23.4875294 1.78658824,23.4084706 C1.80423529,23.3018824 1.79435294,23.1952941 1.76470588,23.0943529 L1.76470588,17.8538824 C1.78447059,17.8722353 1.80917647,17.8898824 1.82964706,17.9082353 C1.98352941,18.0437647 2.14023529,18.1785882 2.31670588,18.3084706 C4.97576471,20.3195294 10.2931765,21.8823529 18,21.8823529 C25.6743529,21.8823529 30.9783529,20.3322353 33.6487059,18.3331765 C33.8618824,18.1778824 34.0538824,18.0176471 34.2345882,17.8545882 L34.2352941,17.8538824 L34.2352941,23.0943529 C34.2056471,23.1952941 34.1957647,23.3018824 34.2134118,23.4084706 C34.2268235,23.4875294 34.2352941,23.5672941 34.2352941,23.6470588 C34.2352941,23.7607059 34.2063529,23.8750588 34.1795294,23.9894118 Z M34.2352941,9.38329412 L34.2352941,14.6237647 C34.2056471,14.7247059 34.1957647,14.8312941 34.2134118,14.9378824 C34.2268235,15.0169412 34.2352941,15.0967059 34.2352941,15.1764706 C34.2352941,15.2901176 34.2063529,15.4044706 34.1795294,15.5188235 C34.1597647,15.6042353 34.1322353,15.6889412 34.0976471,15.7750588 C34.0694118,15.8449412 34.0348235,15.9148235 33.9967059,15.9847059 C33.9494118,16.0715294 33.8964706,16.1583529 33.8336471,16.2451765 C33.7870588,16.3108235 33.7341176,16.3757647 33.6790588,16.4407059 C33.6007059,16.5331765 33.5174118,16.6256471 33.4228235,16.7174118 C33.3656471,16.7731765 33.3028235,16.8282353 33.2392941,16.884 C33.1235294,16.9849412 33.0028235,17.0851765 32.868,17.1847059 C32.8101176,17.2277647 32.748,17.2694118 32.6865882,17.3117647 C32.5270588,17.4218824 32.3604706,17.5312941 32.1776471,17.6385882 C32.1296471,17.6675294 32.0781176,17.6950588 32.028,17.7232941 C31.8176471,17.8418824 31.5981176,17.9597647 31.3609412,18.0741176 C31.3305882,18.0889412 31.2988235,18.1030588 31.2677647,18.1171765 C31.0030588,18.2421176 30.7263529,18.3649412 30.4305882,18.4835294 C30.4221176,18.4870588 30.4136471,18.4898824 30.4051765,18.4934118 C28.8021176,19.1336471 26.7515294,19.6722353 24.3621176,20.0251765 C24.3501176,20.0265882 24.3381176,20.028 24.3261176,20.0301176 C23.8616471,20.0985882 23.3851765,20.1592941 22.896,20.2129412 C22.8162353,20.2214118 22.7322353,20.2270588 22.6517647,20.2355294 C22.2247059,20.28 21.7927059,20.3209412 21.348,20.3534118 C21.1447059,20.3682353 20.9315294,20.3752941 20.7247059,20.388 C20.3901176,20.4077647 20.0590588,20.4296471 19.716,20.4416471 C19.1555294,20.4592941 18.5837647,20.4705882 18,20.4705882 C17.4162353,20.4705882 16.8444706,20.4592941 16.2832941,20.4395294 C15.9402353,20.4275294 15.6091765,20.4049412 15.2745882,20.3858824 C15.0677647,20.3738824 14.8545882,20.3661176 14.6512941,20.3512941 C14.2065882,20.3188235 13.7745882,20.2778824 13.3475294,20.2334118 C13.2670588,20.2249412 13.1830588,20.2192941 13.1032941,20.2108235 C12.6141176,20.1571765 12.1376471,20.0957647 11.6731765,20.028 C11.6611765,20.0265882 11.6491765,20.0251765 11.6371765,20.0230588 C9.24776471,19.6701176 7.19717647,19.1315294 5.59411765,18.4912941 C5.58564706,18.4884706 5.57717647,18.4849412 5.56870588,18.4814118 C5.27294118,18.3628235 4.99552941,18.24 4.73152941,18.1150588 C4.70117647,18.1002353 4.66870588,18.0861176 4.63835294,18.072 C4.40117647,17.9576471 4.18164706,17.8404706 3.97129412,17.7211765 C3.92188235,17.6929412 3.86964706,17.6654118 3.82164706,17.6364706 C3.63882353,17.5291765 3.47223529,17.4197647 3.31270588,17.3096471 C3.252,17.2672941 3.18917647,17.2256471 3.13129412,17.1825882 C2.99647059,17.0830588 2.87576471,16.9828235 2.76,16.8818824 C2.69717647,16.8268235 2.63364706,16.7717647 2.57647059,16.7152941 C2.48188235,16.6235294 2.39858824,16.5317647 2.32023529,16.4385882 C2.26517647,16.3736471 2.21223529,16.3087059 2.16564706,16.2430588 C2.10352941,16.1562353 2.05058824,16.0694118 2.00258824,15.9825882 C1.96447059,15.9127059 1.93058824,15.8428235 1.90164706,15.7729412 C1.86705882,15.6875294 1.83952941,15.6021176 1.81976471,15.5167059 C1.79364706,15.4044706 1.76470588,15.2901176 1.76470588,15.1764706 C1.76470588,15.0967059 1.77388235,15.0169412 1.78658824,14.9378824 C1.80423529,14.8312941 1.79435294,14.7247059 1.76470588,14.6237647 L1.76470588,9.38329412 C1.84941176,9.46023529 1.94611765,9.53576471 2.03788235,9.612 C2.08870588,9.65435294 2.136,9.69670588 2.18964706,9.73905882 C2.40141176,9.90564706 2.63011765,10.0701176 2.87788235,10.2303529 C2.92941176,10.2635294 2.98729412,10.296 3.04094118,10.3291765 C3.24847059,10.4583529 3.468,10.5847059 3.69882353,10.7089412 C3.78423529,10.7548235 3.86964706,10.8 3.95788235,10.8451765 C4.21552941,10.9764706 4.48588235,11.1042353 4.77035294,11.2277647 C4.81694118,11.2482353 4.85929412,11.2694118 4.90658824,11.2891765 C5.23764706,11.4296471 5.58917647,11.5637647 5.95482353,11.6936471 C6.05576471,11.7296471 6.16164706,11.7635294 6.26541176,11.7988235 C6.55623529,11.8969412 6.85694118,11.9908235 7.16823529,12.0818824 C7.28047059,12.1143529 7.39058824,12.1482353 7.50564706,12.1792941 C7.91858824,12.2936471 8.34494118,12.4023529 8.79247059,12.5025882 C8.85388235,12.5167059 8.92023529,12.528 8.98235294,12.5414118 C9.37694118,12.6275294 9.78635294,12.7072941 10.2070588,12.7821176 C10.3496471,12.8075294 10.4943529,12.8315294 10.6397647,12.8555294 C11.04,12.9211765 11.4522353,12.9811765 11.8750588,13.0362353 C11.9837647,13.0503529 12.0875294,13.0665882 12.1976471,13.08 C12.7228235,13.1435294 13.2663529,13.1978824 13.8247059,13.2444706 C13.9623529,13.2557647 14.1056471,13.2642353 14.2454118,13.2741176 C14.6922353,13.3065882 15.1489412,13.3334118 15.6162353,13.3545882 C15.7863529,13.3623529 15.9557647,13.3701176 16.1294118,13.3764706 C16.7378824,13.3969412 17.3576471,13.4117647 18,13.4117647 C18.6423529,13.4117647 19.2621176,13.3969412 19.8705882,13.3764706 C20.0435294,13.3701176 20.2129412,13.3623529 20.3837647,13.3545882 C20.8510588,13.3334118 21.3077647,13.3065882 21.7545882,13.2741176 C21.8943529,13.2635294 22.0369412,13.2557647 22.1752941,13.2444706 C22.7336471,13.1985882 23.2771765,13.1435294 23.8023529,13.08 C23.9124706,13.0665882 24.0162353,13.0503529 24.1249412,13.0362353 C24.5477647,12.9811765 24.9592941,12.9211765 25.3602353,12.8555294 C25.5056471,12.8315294 25.6503529,12.8075294 25.7929412,12.7821176 C26.2136471,12.7072941 26.6230588,12.6275294 27.0176471,12.5414118 C27.0797647,12.528 27.1461176,12.516 27.2075294,12.5025882 C27.6550588,12.4023529 28.0814118,12.2929412 28.4943529,12.1792941 C28.6094118,12.1475294 28.7195294,12.1143529 28.8317647,12.0818824 C29.1430588,11.9908235 29.4437647,11.8969412 29.7345882,11.7988235 C29.8383529,11.7635294 29.9442353,11.7296471 30.0451765,11.6936471 C30.4108235,11.5637647 30.7630588,11.4296471 31.0934118,11.2891765 C31.1407059,11.2694118 31.1830588,11.2482353 31.2296471,11.2277647 C31.5141176,11.1035294 31.7844706,10.9764706 32.0421176,10.8451765 C32.1303529,10.8 32.2164706,10.7548235 32.3011765,10.7089412 C32.532,10.5854118 32.7515294,10.4590588 32.9590588,10.3291765 C33.0127059,10.296 33.0705882,10.2635294 33.1221176,10.2303529 C33.3698824,10.0701176 33.5985882,9.90635294 33.8103529,9.73905882 C33.8632941,9.69670588 33.9105882,9.65435294 33.9621176,9.612 C34.0538824,9.53576471 34.1505882,9.46023529 34.2352941,9.38329412 Z M18,1.41176471 C27.5682353,1.41176471 34.2352941,4.20141176 34.2352941,6.70588235 C34.2352941,9.21035294 27.5682353,12 18,12 C8.43176471,12 1.76470588,9.21035294 1.76470588,6.70588235 C1.76470588,4.20141176 8.43176471,1.41176471 18,1.41176471 Z M34.2352941,32.2609412 C34.2254118,32.292 34.2183529,32.3237647 34.2127059,32.3562353 C33.8124706,34.7978824 27.2018824,37.4117647 18,37.4117647 C8.79811765,37.4117647 2.18752941,34.7978824 1.78729412,32.3562353 C1.78164706,32.3244706 1.77388235,32.2934118 1.76470588,32.2637647 L1.76470588,26.3244706 C1.78447059,26.3428235 1.80917647,26.3604706 1.82964706,26.3788235 C1.98352941,26.5143529 2.14023529,26.6491765 2.31670588,26.7790588 C4.97576471,28.7901176 10.2931765,30.3529412 18,30.3529412 C25.6743529,30.3529412 30.9783529,28.8028235 33.6487059,26.8037647 C33.8618824,26.6484706 34.0538824,26.4882353 34.2345882,26.3251765 L34.2352941,26.3244706 L34.2352941,32.2609412 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType3-sm.svg b/cds-ui/designer-client/src/assets/img/icon-comType3-sm.svg
new file mode 100644
index 000000000..f823d8c19
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType3-sm.svg
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>server</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-55.000000, -800.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="controller" transform="translate(0.000000, 60.000000)">
+ <g id="functions" transform="translate(0.000000, 479.000000)">
+ <g id="list" transform="translate(8.000000, 51.000000)">
+ <g id="4" transform="translate(12.000000, 200.000000)">
+ <g id="txt" transform="translate(35.000000, 10.000000)">
+ <g id="server">
+ <path d="M3.5,2.023 C2.673,2.023 2,2.696 2,3.523 C2,4.35 2.673,5.023 3.5,5.023 C4.327,5.023 5,4.35 5,3.523 C5,2.696 4.327,2.023 3.5,2.023 Z M3.5,4.35633333 C3.04066667,4.35633333 2.66666667,3.98266667 2.66666667,3.523 C2.66666667,3.06333333 3.04066667,2.68966667 3.5,2.68966667 C3.95933333,2.68966667 4.33333333,3.06333333 4.33333333,3.523 C4.33333333,3.98266667 3.95933333,4.35633333 3.5,4.35633333 Z" id="Shape"></path>
+ <circle id="Oval" cx="16.6666667" cy="3.023" r="1"></circle>
+ <circle id="Oval" cx="15.3333333" cy="3.023" r="1"></circle>
+ <circle id="Oval" cx="17.3333333" cy="4.023" r="1"></circle>
+ <circle id="Oval" cx="16" cy="4.023" r="1"></circle>
+ <circle id="Oval" cx="14" cy="3.023" r="1"></circle>
+ <circle id="Oval" cx="14.6666667" cy="4.023" r="1"></circle>
+ <circle id="Oval" cx="12.6666667" cy="3.023" r="1"></circle>
+ <circle id="Oval" cx="13.3333333" cy="4.023" r="1"></circle>
+ <circle id="Oval" cx="11.3333333" cy="3.023" r="1"></circle>
+ <circle id="Oval" cx="12" cy="4.023" r="1"></circle>
+ <path d="M20,5.48666667 L20,1.559 C20,0.712 19.311,0.023 18.464,0.023 L1.536,0.023 C0.689,0.023 0,0.712 0,1.559 L0,5.48666667 C0,5.97633333 0.234333333,6.408 0.592333333,6.68933333 C0.234333333,6.971 0,7.40266667 0,7.89233333 L0,11.82 C0,12.667 0.689,13.356 1.536,13.356 L10,13.356 L18.464,13.356 C19.311,13.356 20,12.667 20,11.82 L20,7.89233333 C20,7.40266667 19.7656667,6.971 19.4076667,6.68966667 C19.7656667,6.408 20,5.97633333 20,5.48666667 Z M19.3333333,7.89233333 L19.3333333,11.82 C19.3333333,12.2993333 18.9433333,12.6893335 18.464,12.6893335 L1.536,12.6893335 C1.05666667,12.6896667 0.666666667,12.2996667 0.666666667,11.82 L0.666666667,7.89233333 C0.666666667,7.413 1.05666667,7.023 1.536,7.023 L18.4636667,7.023 C18.9433333,7.023 19.3333333,7.413 19.3333333,7.89233333 Z M1.536,6.35633333 C1.05666667,6.35633333 0.666666667,5.96633333 0.666666667,5.48666667 L0.666666667,1.559 C0.666666667,1.07966667 1.05666667,0.689666667 1.536,0.689666667 L18.4636667,0.689666667 C18.9433333,0.689666667 19.3333333,1.07966667 19.3333333,1.559 L19.3333333,5.48666667 C19.3333333,5.966 18.9433333,6.356 18.464,6.356 L1.536,6.356 L1.536,6.35633333 Z" id="Shape"></path>
+ <path d="M3.5,11.3563333 C4.327,11.3563333 5,10.6833333 5,9.85633333 C5,9.02933333 4.327,8.35633333 3.5,8.35633333 C2.673,8.35633333 2,9.029 2,9.85633333 C2,10.6836667 2.673,11.3563333 3.5,11.3563333 Z M3.5,9.023 C3.95933333,9.023 4.33333333,9.39666667 4.33333333,9.85633333 C4.33333333,10.316 3.95933333,10.6896667 3.5,10.6896667 C3.04066667,10.6896667 2.66666667,10.316 2.66666667,9.85633333 C2.66666667,9.39666667 3.04066667,9.023 3.5,9.023 Z" id="Shape"></path>
+ <path d="M10.491,16.8183333 C10.5673333,16.8613333 10.6373333,16.9143333 10.6996667,16.9753333 C10.7646667,17.039 10.849,17.0706667 10.933,17.0706667 C11.0193333,17.0706667 11.1056667,17.037 11.171,16.9706667 C11.3,16.839 11.2976667,16.6283333 11.1663333,16.4993333 C11.0626667,16.3976667 10.9463333,16.3103333 10.82,16.2383333 C10.659,16.148 10.4563333,16.2033333 10.3656667,16.364 C10.275,16.524 10.331,16.7273333 10.491,16.8183333 Z" id="Path"></path>
+ <path d="M10.5013333,18.5553333 C10.4263333,18.5993333 10.3456667,18.6326667 10.2616667,18.6553333 C10.084,18.7033333 9.97866667,18.886 10.0263333,19.064 C10.0666667,19.2126667 10.201,19.3106667 10.348,19.3106667 C10.3766667,19.3106667 10.4056667,19.307 10.435,19.2993333 C10.5756667,19.2613333 10.711,19.205 10.8366667,19.1316667 C10.9956667,19.039 11.0496667,18.8346667 10.957,18.6756667 C10.8643333,18.5163333 10.6603333,18.463 10.5013333,18.5553333 Z" id="Path"></path>
+ <path d="M11.3333333,17.3483333 C11.1493333,17.3483333 11,17.5053333 11,17.6893333 C11,17.7773333 10.9886667,17.864 10.9663333,17.9476667 C10.9186667,18.1253333 11.0246667,18.308 11.2023333,18.3556667 C11.231,18.3633333 11.26,18.367 11.2883333,18.367 C11.4356667,18.367 11.5703333,18.2686667 11.6103333,18.1196667 C11.6476667,17.9803333 11.6666667,17.8353333 11.6666667,17.6896667 L11.6666667,17.674 C11.6666667,17.4896667 11.5173333,17.3483333 11.3333333,17.3483333 Z" id="Path"></path>
+ <path d="M9.50333333,18.5573333 C9.42766667,18.514 9.358,18.461 9.29633333,18.3996667 C9.16566667,18.2696667 8.955,18.271 8.825,18.401 C8.695,18.5316667 8.69566667,18.7426667 8.82633333,18.8723333 C8.92966667,18.975 9.046,19.0636667 9.17233333,19.136 C9.22466667,19.166 9.28133333,19.18 9.33766667,19.18 C9.45333333,19.18 9.56566667,19.1196667 9.62733333,19.0123333 C9.71833333,18.8526667 9.663,18.649 9.50333333,18.5573333 Z" id="Path"></path>
+ <path d="M9.55566667,16.0833333 C9.41566667,16.1216667 9.281,16.179 9.15566667,16.2526667 C8.997,16.346 8.944,16.5503333 9.03733333,16.709 C9.09966667,16.8143333 9.211,16.8733333 9.325,16.8733333 C9.38233333,16.8733333 9.44066667,16.8586667 9.49366667,16.8273333 C9.569,16.783 9.64933333,16.749 9.73333333,16.7256667 C9.91066667,16.677 10.015,16.4933333 9.966,16.316 C9.91666667,16.1386667 9.73333333,16.035 9.55566667,16.0833333 Z" id="Path"></path>
+ <path d="M9,17.6896667 C9,17.6036667 9.011,17.5186667 9.03233333,17.4366667 C9.07866667,17.2586667 8.972,17.0766667 8.79366667,17.03 C8.61533333,16.984 8.43333333,17.0903333 8.387,17.2686667 C8.35133333,17.4053333 8.33333333,17.547 8.33333333,17.6966667 L8.66666667,17.6973333 L8.33333333,17.6973333 C8.33333333,17.8816667 8.48233333,18.0266672 8.66666667,18.0266672 C8.851,18.027 9,17.874 9,17.6896667 Z" id="Path"></path>
+ <circle id="Oval" cx="16.6666667" cy="9.35633333" r="1"></circle>
+ <circle id="Oval" cx="15.3333333" cy="9.35633333" r="1"></circle>
+ <circle id="Oval" cx="17.3333333" cy="10.3563333" r="1"></circle>
+ <circle id="Oval" cx="16" cy="10.3563333" r="1"></circle>
+ <circle id="Oval" cx="14" cy="9.35633333" r="1"></circle>
+ <circle id="Oval" cx="14.6666667" cy="10.3563333" r="1"></circle>
+ <circle id="Oval" cx="12.6666667" cy="9.35633333" r="1"></circle>
+ <circle id="Oval" cx="13.3333333" cy="10.3563333" r="1"></circle>
+ <circle id="Oval" cx="11.3333333" cy="9.35633333" r="1"></circle>
+ <circle id="Oval" cx="12" cy="10.3563333" r="1"></circle>
+ <path d="M7.33333333,17.3563333 L7,17.3563333 C6.816,17.3563333 6.66666667,17.5053333 6.66666667,17.6896667 C6.66666667,17.874 6.816,18.023 7,18.023 L7.33333333,18.023 C7.51733333,18.023 7.66666667,17.874 7.66666667,17.6896667 C7.66666667,17.5053333 7.51733333,17.3563333 7.33333333,17.3563333 Z" id="Path"></path>
+ <path d="M4.66666667,17.3563333 L4.33333333,17.3563333 C4.14933333,17.3563333 4,17.5053333 4,17.6896667 C4,17.874 4.14933333,18.023 4.33333333,18.023 L4.66666667,18.023 C4.85066667,18.023 5,17.874 5,17.6896667 C5,17.5053333 4.85066667,17.3563333 4.66666667,17.3563333 Z" id="Path"></path>
+ <path d="M6,17.3563333 L5.66666667,17.3563333 C5.48266667,17.3563333 5.33333333,17.5053333 5.33333333,17.6896667 C5.33333333,17.874 5.48266667,18.023 5.66666667,18.023 L6,18.023 C6.184,18.023 6.33333333,17.874 6.33333333,17.6896667 C6.33333333,17.5053333 6.184,17.3563333 6,17.3563333 Z" id="Path"></path>
+ <path d="M0.666666667,17.3563333 L0.333333333,17.3563333 C0.149333333,17.3563333 0,17.5053333 0,17.6896667 C0,17.874 0.149333333,18.023 0.333333333,18.023 L0.666666667,18.023 C0.850666667,18.023 1,17.874 1,17.6896667 C1,17.5053333 0.850666667,17.3563333 0.666666667,17.3563333 Z" id="Path"></path>
+ <path d="M2,17.3563333 L1.66666667,17.3563333 C1.48266667,17.3563333 1.33333333,17.5053333 1.33333333,17.6896667 C1.33333333,17.874 1.48266667,18.023 1.66666667,18.023 L2,18.023 C2.184,18.023 2.33333333,17.874 2.33333333,17.6896667 C2.33333333,17.5053333 2.184,17.3563333 2,17.3563333 Z" id="Path"></path>
+ <path d="M3.33333333,17.3563333 L3,17.3563333 C2.816,17.3563333 2.66666667,17.5053333 2.66666667,17.6896667 C2.66666667,17.874 2.816,18.023 3,18.023 L3.33333333,18.023 C3.51733333,18.023 3.66666667,17.874 3.66666667,17.6896667 C3.66666667,17.5053333 3.51733333,17.3563333 3.33333333,17.3563333 Z" id="Path"></path>
+ <path d="M13,17.3563333 L12.6666667,17.3563333 C12.4826667,17.3563333 12.3333333,17.5053333 12.3333333,17.6896667 C12.3333333,17.874 12.4826667,18.023 12.6666667,18.023 L13,18.023 C13.184,18.023 13.3333333,17.874 13.3333333,17.6896667 C13.3333333,17.5053333 13.184,17.3563333 13,17.3563333 Z" id="Path"></path>
+ <path d="M15.6666667,17.3563333 L15.3333333,17.3563333 C15.1493333,17.3563333 15,17.5053333 15,17.6896667 C15,17.874 15.1493333,18.023 15.3333333,18.023 L15.6666667,18.023 C15.8506667,18.023 16,17.874 16,17.6896667 C16,17.5053333 15.8506667,17.3563333 15.6666667,17.3563333 Z" id="Path"></path>
+ <path d="M14.3333333,17.3563333 L14,17.3563333 C13.816,17.3563333 13.6666667,17.5053333 13.6666667,17.6896667 C13.6666667,17.874 13.816,18.023 14,18.023 L14.3333333,18.023 C14.5173333,18.023 14.6666667,17.874 14.6666667,17.6896667 C14.6666667,17.5053333 14.5173333,17.3563333 14.3333333,17.3563333 Z" id="Path"></path>
+ <path d="M19.6666667,17.3563333 L19.3333333,17.3563333 C19.1493333,17.3563333 19,17.5053333 19,17.6896667 C19,17.874 19.1493333,18.023 19.3333333,18.023 L19.6666667,18.023 C19.8506667,18.023 20,17.874 20,17.6896667 C20,17.5053333 19.8506667,17.3563333 19.6666667,17.3563333 Z" id="Path"></path>
+ <path d="M17,17.3563333 L16.6666667,17.3563333 C16.4826667,17.3563333 16.3333333,17.5053333 16.3333333,17.6896667 C16.3333333,17.874 16.4826667,18.023 16.6666667,18.023 L17,18.023 C17.184,18.023 17.3333333,17.874 17.3333333,17.6896667 C17.3333333,17.5053333 17.184,17.3563333 17,17.3563333 Z" id="Path"></path>
+ <path d="M18.3333333,17.3563333 L18,17.3563333 C17.816,17.3563333 17.6666667,17.5053333 17.6666667,17.6896667 C17.6666667,17.874 17.816,18.023 18,18.023 L18.3333333,18.023 C18.5173333,18.023 18.6666667,17.874 18.6666667,17.6896667 C18.6666667,17.5053333 18.5173333,17.3563333 18.3333333,17.3563333 Z" id="Path"></path>
+ <path d="M10.3333333,15.3563333 L10.3333333,15.023 C10.3333333,14.8386667 10.184,14.6896667 10,14.6896667 C9.816,14.6896667 9.66666667,14.8386667 9.66666667,15.023 L9.66666667,15.3563333 C9.66666667,15.5406667 9.816,15.6896667 10,15.6896667 C10.184,15.6896667 10.3333333,15.5406667 10.3333333,15.3563333 Z" id="Path"></path>
+ <path d="M9.66666667,13.6896667 L9.66666667,14.023 C9.66666667,14.2073333 9.816,14.3563333 10,14.3563333 C10.184,14.3563333 10.3333333,14.2073333 10.3333333,14.023 L10.3333333,13.6896667 C10.3333333,13.5053333 10.184,13.3563333 10,13.3563333 C9.816,13.3563333 9.66666667,13.5053333 9.66666667,13.6896667 Z" id="Path"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType3.svg b/cds-ui/designer-client/src/assets/img/icon-comType3.svg
new file mode 100644
index 000000000..1d43c82da
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType3.svg
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="36px" height="35px" viewBox="0 0 36 35" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>server</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-685.000000, -402.000000)" fill="#FFFFFF" fill-rule="nonzero">
+ <g id="workflow-container" transform="translate(401.000000, 137.000000)">
+ <g id="component" transform="translate(30.000000, 70.000000)">
+ <g id="dg-generic" transform="translate(150.000000, 170.000000)">
+ <g id="Group-4" transform="translate(87.000000, 25.000000)">
+ <g id="server" transform="translate(17.000000, 0.000000)">
+ <path d="M6.3,3.6414 C4.8114,3.6414 3.6,4.8528 3.6,6.3414 C3.6,7.83 4.8114,9.0414 6.3,9.0414 C7.7886,9.0414 9,7.83 9,6.3414 C9,4.8528 7.7886,3.6414 6.3,3.6414 Z M6.3,7.8414 C5.4732,7.8414 4.8,7.1688 4.8,6.3414 C4.8,5.514 5.4732,4.8414 6.3,4.8414 C7.1268,4.8414 7.8,5.514 7.8,6.3414 C7.8,7.1688 7.1268,7.8414 6.3,7.8414 Z" id="Shape"></path>
+ <circle id="Oval" cx="30" cy="5.4414" r="1"></circle>
+ <circle id="Oval" cx="27.6" cy="5.4414" r="1"></circle>
+ <circle id="Oval" cx="31.2" cy="7.2414" r="1"></circle>
+ <circle id="Oval" cx="28.8" cy="7.2414" r="1"></circle>
+ <circle id="Oval" cx="25.2" cy="5.4414" r="1"></circle>
+ <circle id="Oval" cx="26.4" cy="7.2414" r="1"></circle>
+ <circle id="Oval" cx="22.8" cy="5.4414" r="1"></circle>
+ <circle id="Oval" cx="24" cy="7.2414" r="1"></circle>
+ <circle id="Oval" cx="20.4" cy="5.4414" r="1"></circle>
+ <circle id="Oval" cx="21.6" cy="7.2414" r="1"></circle>
+ <path d="M36,9.876 L36,2.8062 C36,1.2816 34.7598,0.0414 33.2352,0.0414 L2.7648,0.0414 C1.2402,0.0414 0,1.2816 0,2.8062 L0,9.876 C0,10.7574 0.4218,11.5344 1.0662,12.0408 C0.4218,12.5478 0,13.3248 0,14.2062 L0,21.276 C0,22.8006 1.2402,24.0408 2.7648,24.0408 L18,24.0408 L33.2352,24.0408 C34.7598,24.0408 36,22.8006 36,21.276 L36,14.2062 C36,13.3248 35.5782,12.5478 34.9338,12.0414 C35.5782,11.5344 36,10.7574 36,9.876 Z M34.8,14.2062 L34.8,21.276 C34.8,22.1388 34.098,22.8408004 33.2352,22.8408004 L2.7648,22.8408004 C1.902,22.8414 1.2,22.1394 1.2,21.276 L1.2,14.2062 C1.2,13.3434 1.902,12.6414 2.7648,12.6414 L33.2346,12.6414 C34.098,12.6414 34.8,13.3434 34.8,14.2062 Z M2.7648,11.4414 C1.902,11.4414 1.2,10.7394 1.2,9.876 L1.2,2.8062 C1.2,1.9434 1.902,1.2414 2.7648,1.2414 L33.2346,1.2414 C34.098,1.2414 34.8,1.9434 34.8,2.8062 L34.8,9.876 C34.8,10.7388 34.098,11.4408 33.2352,11.4408 L2.7648,11.4408 L2.7648,11.4414 Z" id="Shape"></path>
+ <path d="M6.3,20.4414 C7.7886,20.4414 9,19.23 9,17.7414 C9,16.2528 7.7886,15.0414 6.3,15.0414 C4.8114,15.0414 3.6,16.2522 3.6,17.7414 C3.6,19.2306 4.8114,20.4414 6.3,20.4414 Z M6.3,16.2414 C7.1268,16.2414 7.8,16.914 7.8,17.7414 C7.8,18.5688 7.1268,19.2414 6.3,19.2414 C5.4732,19.2414 4.8,18.5688 4.8,17.7414 C4.8,16.914 5.4732,16.2414 6.3,16.2414 Z" id="Shape"></path>
+ <path d="M18.8838,30.273 C19.0212,30.3504 19.1472,30.4458 19.2594,30.5556 C19.3764,30.6702 19.5282,30.7272 19.6794,30.7272 C19.8348,30.7272 19.9902,30.6666 20.1078,30.5472 C20.34,30.3102 20.3358,29.931 20.0994,29.6988 C19.9128,29.5158 19.7034,29.3586 19.476,29.229 C19.1862,29.0664 18.8214,29.166 18.6582,29.4552 C18.495,29.7432 18.5958,30.1092 18.8838,30.273 Z" id="Path"></path>
+ <path d="M18.9024,33.3996 C18.7674,33.4788 18.6222,33.5388 18.471,33.5796 C18.1512,33.666 17.9616,33.9948 18.0474,34.3152 C18.12,34.5828 18.3618,34.7592 18.6264,34.7592 C18.678,34.7592 18.7302,34.7526 18.783,34.7388 C19.0362,34.6704 19.2798,34.569 19.506,34.437 C19.7922,34.2702 19.8894,33.9024 19.7226,33.6162 C19.5558,33.3294 19.1886,33.2334 18.9024,33.3996 Z" id="Path"></path>
+ <path d="M20.4,31.227 C20.0688,31.227 19.8,31.5096 19.8,31.8408 C19.8,31.9992 19.7796,32.1552 19.7394,32.3058 C19.6536,32.6256 19.8444,32.9544 20.1642,33.0402 C20.2158,33.054 20.268,33.0606 20.319,33.0606 C20.5842,33.0606 20.8266,32.8836 20.8986,32.6154 C20.9658,32.3646 21,32.1036 21,31.8414 L21,31.8132 C21,31.4814 20.7312,31.227 20.4,31.227 Z" id="Path"></path>
+ <path d="M17.106,33.4032 C16.9698,33.3252 16.8444,33.2298 16.7334,33.1194 C16.4982,32.8854 16.119,32.8878 15.885,33.1218 C15.651,33.357 15.6522,33.7368 15.8874,33.9702 C16.0734,34.155 16.2828,34.3146 16.5102,34.4448 C16.6044,34.4988 16.7064,34.524 16.8078,34.524 C17.016,34.524 17.2182,34.4154 17.3292,34.2222 C17.493,33.9348 17.3934,33.5682 17.106,33.4032 Z" id="Path"></path>
+ <path d="M17.2002,28.95 C16.9482,29.019 16.7058,29.1222 16.4802,29.2548 C16.1946,29.4228 16.0992,29.7906 16.2672,30.0762 C16.3794,30.2658 16.5798,30.372 16.785,30.372 C16.8882,30.372 16.9932,30.3456 17.0886,30.2892 C17.2242,30.2094 17.3688,30.1482 17.52,30.1062 C17.8392,30.0186 18.027,29.688 17.9388,29.3688 C17.85,29.0496 17.52,28.863 17.2002,28.95 Z" id="Path"></path>
+ <path d="M16.2,31.8414 C16.2,31.6866 16.2198,31.5336 16.2582,31.386 C16.3416,31.0656 16.1496,30.738 15.8286,30.654 C15.5076,30.5712 15.18,30.7626 15.0966,31.0836 C15.0324,31.3296 15,31.5846 15,31.854 L15.6,31.8552 L15,31.8552 C15,32.187 15.2682,32.448001 15.6,32.448001 C15.9318,32.4486 16.2,32.1732 16.2,31.8414 Z" id="Path"></path>
+ <circle id="Oval" cx="30" cy="16.8414" r="1"></circle>
+ <circle id="Oval" cx="27.6" cy="16.8414" r="1"></circle>
+ <circle id="Oval" cx="31.2" cy="18.6414" r="1"></circle>
+ <circle id="Oval" cx="28.8" cy="18.6414" r="1"></circle>
+ <circle id="Oval" cx="25.2" cy="16.8414" r="1"></circle>
+ <circle id="Oval" cx="26.4" cy="18.6414" r="1"></circle>
+ <circle id="Oval" cx="22.8" cy="16.8414" r="1"></circle>
+ <circle id="Oval" cx="24" cy="18.6414" r="1"></circle>
+ <circle id="Oval" cx="20.4" cy="16.8414" r="1"></circle>
+ <circle id="Oval" cx="21.6" cy="18.6414" r="1"></circle>
+ <path d="M13.2,31.2414 L12.6,31.2414 C12.2688,31.2414 12,31.5096 12,31.8414 C12,32.1732 12.2688,32.4414 12.6,32.4414 L13.2,32.4414 C13.5312,32.4414 13.8,32.1732 13.8,31.8414 C13.8,31.5096 13.5312,31.2414 13.2,31.2414 Z" id="Path"></path>
+ <path d="M8.4,31.2414 L7.8,31.2414 C7.4688,31.2414 7.2,31.5096 7.2,31.8414 C7.2,32.1732 7.4688,32.4414 7.8,32.4414 L8.4,32.4414 C8.7312,32.4414 9,32.1732 9,31.8414 C9,31.5096 8.7312,31.2414 8.4,31.2414 Z" id="Path"></path>
+ <path d="M10.8,31.2414 L10.2,31.2414 C9.8688,31.2414 9.6,31.5096 9.6,31.8414 C9.6,32.1732 9.8688,32.4414 10.2,32.4414 L10.8,32.4414 C11.1312,32.4414 11.4,32.1732 11.4,31.8414 C11.4,31.5096 11.1312,31.2414 10.8,31.2414 Z" id="Path"></path>
+ <path d="M1.2,31.2414 L0.6,31.2414 C0.2688,31.2414 0,31.5096 0,31.8414 C0,32.1732 0.2688,32.4414 0.6,32.4414 L1.2,32.4414 C1.5312,32.4414 1.8,32.1732 1.8,31.8414 C1.8,31.5096 1.5312,31.2414 1.2,31.2414 Z" id="Path"></path>
+ <path d="M3.6,31.2414 L3,31.2414 C2.6688,31.2414 2.4,31.5096 2.4,31.8414 C2.4,32.1732 2.6688,32.4414 3,32.4414 L3.6,32.4414 C3.9312,32.4414 4.2,32.1732 4.2,31.8414 C4.2,31.5096 3.9312,31.2414 3.6,31.2414 Z" id="Path"></path>
+ <path d="M6,31.2414 L5.4,31.2414 C5.0688,31.2414 4.8,31.5096 4.8,31.8414 C4.8,32.1732 5.0688,32.4414 5.4,32.4414 L6,32.4414 C6.3312,32.4414 6.6,32.1732 6.6,31.8414 C6.6,31.5096 6.3312,31.2414 6,31.2414 Z" id="Path"></path>
+ <path d="M23.4,31.2414 L22.8,31.2414 C22.4688,31.2414 22.2,31.5096 22.2,31.8414 C22.2,32.1732 22.4688,32.4414 22.8,32.4414 L23.4,32.4414 C23.7312,32.4414 24,32.1732 24,31.8414 C24,31.5096 23.7312,31.2414 23.4,31.2414 Z" id="Path"></path>
+ <path d="M28.2,31.2414 L27.6,31.2414 C27.2688,31.2414 27,31.5096 27,31.8414 C27,32.1732 27.2688,32.4414 27.6,32.4414 L28.2,32.4414 C28.5312,32.4414 28.8,32.1732 28.8,31.8414 C28.8,31.5096 28.5312,31.2414 28.2,31.2414 Z" id="Path"></path>
+ <path d="M25.8,31.2414 L25.2,31.2414 C24.8688,31.2414 24.6,31.5096 24.6,31.8414 C24.6,32.1732 24.8688,32.4414 25.2,32.4414 L25.8,32.4414 C26.1312,32.4414 26.4,32.1732 26.4,31.8414 C26.4,31.5096 26.1312,31.2414 25.8,31.2414 Z" id="Path"></path>
+ <path d="M35.4,31.2414 L34.8,31.2414 C34.4688,31.2414 34.2,31.5096 34.2,31.8414 C34.2,32.1732 34.4688,32.4414 34.8,32.4414 L35.4,32.4414 C35.7312,32.4414 36,32.1732 36,31.8414 C36,31.5096 35.7312,31.2414 35.4,31.2414 Z" id="Path"></path>
+ <path d="M30.6,31.2414 L30,31.2414 C29.6688,31.2414 29.4,31.5096 29.4,31.8414 C29.4,32.1732 29.6688,32.4414 30,32.4414 L30.6,32.4414 C30.9312,32.4414 31.2,32.1732 31.2,31.8414 C31.2,31.5096 30.9312,31.2414 30.6,31.2414 Z" id="Path"></path>
+ <path d="M33,31.2414 L32.4,31.2414 C32.0688,31.2414 31.8,31.5096 31.8,31.8414 C31.8,32.1732 32.0688,32.4414 32.4,32.4414 L33,32.4414 C33.3312,32.4414 33.6,32.1732 33.6,31.8414 C33.6,31.5096 33.3312,31.2414 33,31.2414 Z" id="Path"></path>
+ <path d="M18.6,27.6414 L18.6,27.0414 C18.6,26.7096 18.3312,26.4414 18,26.4414 C17.6688,26.4414 17.4,26.7096 17.4,27.0414 L17.4,27.6414 C17.4,27.9732 17.6688,28.2414 18,28.2414 C18.3312,28.2414 18.6,27.9732 18.6,27.6414 Z" id="Path"></path>
+ <path d="M17.4,24.6414 L17.4,25.2414 C17.4,25.5732 17.6688,25.8414 18,25.8414 C18.3312,25.8414 18.6,25.5732 18.6,25.2414 L18.6,24.6414 C18.6,24.3096 18.3312,24.0414 18,24.0414 C17.6688,24.0414 17.4,24.3096 17.4,24.6414 Z" id="Path"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-comType4-sm.svg b/cds-ui/designer-client/src/assets/img/icon-comType4-sm.svg
new file mode 100644
index 000000000..18bb8f952
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-comType4-sm.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>language</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-55.000000, -741.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="controller" transform="translate(0.000000, 60.000000)">
+ <g id="functions" transform="translate(0.000000, 479.000000)">
+ <g id="list" transform="translate(8.000000, 51.000000)">
+ <g id="3" transform="translate(12.000000, 132.000000)">
+ <g id="txt" transform="translate(35.000000, 10.000000)">
+ <g id="language" transform="translate(0.000000, 9.000000)">
+ <path d="M10,0 C4.47721354,0 0,4.47721354 0,10 C0,15.5227865 4.47721354,20 10,20 C15.5227865,20 20,15.5227865 20,10 C19.9938151,4.47981771 15.5201823,0.00618491667 10,0 Z M18.6486003,13.5032552 L15.8046875,13.9939779 C16.1302083,12.8001302 16.3059896,11.5704752 16.3279622,10.3333333 L19.3250325,10.3333333 C19.2874349,11.4215495 19.058431,12.4946289 18.6486003,13.5032552 L18.6486003,13.5032552 Z M0.674967458,10.3333333 L3.67203775,10.3333333 C3.69401042,11.5704752 3.86979167,12.8001302 4.1953125,13.9939779 L1.35139975,13.5032552 C0.941569,12.4946289 0.712565083,11.4215495 0.674967458,10.3333333 Z M1.35139975,6.49674479 L4.1953125,6.00602213 C3.86979167,7.19986979 3.69401042,8.42952475 3.67203775,9.66666667 L0.674967458,9.66666667 C0.712565083,8.5784505 0.941569,7.50537108 1.35139975,6.49674479 Z M10.3333333,5.35205079 C11.5310872,5.36735025 12.7259115,5.47639975 13.9067383,5.67838542 L15.0833333,5.88134767 C15.4448242,7.11149088 15.6393229,8.38460288 15.6616211,9.66666667 L10.3333333,9.66666667 L10.3333333,5.35205079 Z M14.020345,5.02132163 C12.8020833,4.81315104 11.5691732,4.70068358 10.3333333,4.68538413 L10.3333333,0.685384125 C12.2443034,0.868977875 13.9042969,2.61865233 14.8450521,5.16503908 L14.020345,5.02132163 Z M9.66666667,4.68538413 C8.43082683,4.70068358 7.19824217,4.81315104 5.97998046,5.02132163 L5.15494792,5.1640625 C6.09570313,2.61702475 7.75569663,0.866699208 9.66666667,0.68391925 L9.66666667,4.68538413 Z M6.09358725,5.67838542 C7.27425129,5.47639975 8.46891275,5.36735025 9.66666667,5.35205079 L9.66666667,9.66666667 L4.33837892,9.66666667 C4.36067708,8.38460288 4.55517579,7.11149088 4.91666667,5.88134767 L6.09358725,5.67838542 Z M4.33837892,10.3333333 L9.66666667,10.3333333 L9.66666667,14.6479492 C8.46891275,14.6326497 7.27408854,14.5236002 6.09326171,14.3216146 L4.91666667,14.1186523 C4.55517579,12.8885091 4.36067708,11.6153971 4.33837892,10.3333333 L4.33837892,10.3333333 Z M5.97965496,14.9786784 C7.19791667,15.1871745 8.43066408,15.3001302 9.66666667,15.3164062 L9.66666667,19.3164062 C7.75569663,19.1326497 6.09570313,17.3829752 5.15494792,14.8365885 L5.97965496,14.9786784 Z M10.3333333,15.3164062 C11.5691732,15.3001302 12.8017578,15.1871745 14.0200195,14.9786784 L14.8450521,14.8359375 C13.9042969,17.3829752 12.2443034,19.1333008 10.3333333,19.3160807 L10.3333333,15.3164062 Z M13.9064128,14.3216146 C12.7257487,14.5236002 11.5310872,14.6326497 10.3333333,14.6479492 L10.3333333,10.3333333 L15.6616211,10.3333333 C15.6393229,11.6153971 15.4448242,12.8885091 15.0833333,14.1186523 L13.9064128,14.3216146 Z M16.3279623,9.66666667 C16.3059896,8.42952475 16.1302083,7.19986979 15.8046875,6.00602213 L18.6486003,6.49674479 C19.058431,7.50537108 19.2874349,8.5784505 19.3250325,9.66666667 L16.3279623,9.66666667 Z M18.3113607,5.76204425 L15.5852865,5.29166667 C15.0952148,3.69287108 14.1783854,2.25797525 12.9332683,1.14160158 C15.261556,1.91861979 17.1923828,3.57731121 18.3113607,5.76204425 Z M7.06673175,1.14160158 C5.82161458,2.25797525 4.90478517,3.69287108 4.41471354,5.29166667 L1.68863933,5.76204425 C2.80761717,3.57731121 4.738444,1.91861979 7.06673175,1.14160158 Z M1.68863933,14.2379557 L4.41471354,14.7083333 C4.90478517,16.3071289 5.82161458,17.7420247 7.06673175,18.8583984 C4.738444,18.0813802 2.80761717,16.4226888 1.68863933,14.2379557 Z M12.9332683,18.8583984 C14.1783854,17.7420247 15.0952148,16.3071289 15.5852865,14.7083333 L18.3113607,14.2379557 C17.1923828,16.4226888 15.261556,18.0813802 12.9332683,18.8583984 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-create-white.svg b/cds-ui/designer-client/src/assets/img/icon-create-white.svg
index 10b76f736..10b76f736 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-create-white.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-create-white.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-delete-sm.svg b/cds-ui/designer-client/src/assets/img/icon-delete-sm.svg
index 2bf7c7836..2bf7c7836 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-delete-sm.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-delete-sm.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-deploy.svg b/cds-ui/designer-client/src/assets/img/icon-deploy.svg
index adaf6956e..adaf6956e 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-deploy.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-deploy.svg
diff --git a/cds-ui/designer-client/src/assets/img/icon-drag.svg b/cds-ui/designer-client/src/assets/img/icon-drag.svg
new file mode 100644
index 000000000..844043d1e
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-drag.svg
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="4px" height="11px" viewBox="0 0 4 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>drag menu</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-40.000000, -687.000000)" fill="#C3CDDB" fill-rule="nonzero">
+ <g id="controller" transform="translate(0.000000, 60.000000)">
+ <g id="functions" transform="translate(0.000000, 479.000000)">
+ <g id="list" transform="translate(8.000000, 51.000000)">
+ <g id="2" transform="translate(12.000000, 82.000000)">
+ <g id="drag-menu" transform="translate(20.000000, 15.000000)">
+ <g id="left">
+ <circle id="1" cx="0.8" cy="0.8" r="1"></circle>
+ <circle id="2" cx="0.8" cy="3.8" r="1"></circle>
+ <circle id="3" cx="0.8" cy="6.8" r="1"></circle>
+ <circle id="4" cx="0.8" cy="9.8" r="1"></circle>
+ </g>
+ <g id="right" transform="translate(2.400000, 0.000000)">
+ <circle id="1" cx="0.8" cy="0.8" r="1"></circle>
+ <circle id="2" cx="0.8" cy="3.8" r="1"></circle>
+ <circle id="3" cx="0.8" cy="6.8" r="1"></circle>
+ <circle id="4" cx="0.8" cy="9.8" r="1"></circle>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-edit.svg b/cds-ui/designer-client/src/assets/img/icon-edit.svg
new file mode 100644
index 000000000..d4f10aae6
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-edit.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="11px" height="11px" viewBox="0 0 11 11" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>edit</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-1156.000000, -252.000000)" fill="#0070F4" fill-rule="nonzero">
+ <g id="action-attributes" transform="translate(1044.000000, 60.000000)">
+ <g id="actions" transform="translate(36.000000, 0.000000)">
+ <g id="STEPS" transform="translate(0.000000, 131.000000)">
+ <g id="name" transform="translate(20.000000, 57.000000)">
+ <g id="edit">
+ <path d="M56,12.6778017 L56,15.000024 L58.3222222,15.000024 L65.0444444,8.21669063 L62.7222222,5.89446841 L56,12.6778017 Z M66.8166667,6.44446841 C67.0611111,6.20002397 67.0611111,5.8333573 66.8166667,5.58891285 L65.4111111,4.18333333 C65.1666667,3.93888889 64.8,3.93888889 64.5555556,4.18333333 L63.4555556,5.28333333 L65.7777778,7.60555556 L66.8166667,6.44446841 Z"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-import-blue.svg b/cds-ui/designer-client/src/assets/img/icon-import-blue.svg
index 3a495d0ed..3a495d0ed 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-import-blue.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-import-blue.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-menuDots.svg b/cds-ui/designer-client/src/assets/img/icon-menuDots.svg
index 99344589c..99344589c 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-menuDots.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-menuDots.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-nav-dictionary.svg b/cds-ui/designer-client/src/assets/img/icon-nav-dictionary.svg
index 6fb435fe6..6fb435fe6 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-nav-dictionary.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-nav-dictionary.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-nav-packages.svg b/cds-ui/designer-client/src/assets/img/icon-nav-packages.svg
index 4989ee15f..4989ee15f 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-nav-packages.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-nav-packages.svg
diff --git a/cds-ui/designer-client/src/assets/img/icon-redo.svg b/cds-ui/designer-client/src/assets/img/icon-redo.svg
new file mode 100644
index 000000000..e48e59537
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-redo.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="13px" height="6px" viewBox="0 0 13 6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>redo</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-591.000000, -77.000000)" fill="#D9E3EE" fill-rule="nonzero">
+ <g id="edit-actions" transform="translate(543.000000, 61.000000)">
+ <g id="elements" transform="translate(10.000000, 6.000000)">
+ <g id="undo/redo">
+ <g id="icons" transform="translate(10.000000, 10.000000)">
+ <path d="M34.6636156,0.634620137 C32.9850092,0.634620137 31.4555606,1.25972082 30.2846682,2.28466819 L28,1.00808251e-13 L28,5.71167048 L33.7116705,5.71167048 L31.4174828,3.41748284 C32.2964554,2.67814874 33.4229039,2.2212151 34.6636156,2.2212151 C36.913389,2.2212151 38.8172792,3.68402746 39.4836407,5.71167048 L40.9845309,5.21665904 C40.1119245,2.5575492 37.6146453,0.634620137 34.6636156,0.634620137 Z" id="redo" transform="translate(34.492265, 2.855835) scale(-1, 1) translate(-34.492265, -2.855835) "></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-search-light.svg b/cds-ui/designer-client/src/assets/img/icon-search-light.svg
new file mode 100644
index 000000000..e6bea0cc9
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-search-light.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="12px" height="13px" viewBox="0 0 12 13" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>search</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-20.000000, -79.000000)" fill="#D0D7E4" fill-rule="nonzero">
+ <g id="controller" transform="translate(0.000000, 60.000000)">
+ <g id="search">
+ <g id="txt" transform="translate(20.000000, 19.000000)">
+ <path d="M11.9341186,12.0639984 L8.43795198,8.42806982 C9.32969918,7.53373444 9.88215892,6.30081747 9.88215892,4.94107946 C9.88215892,2.21642707 7.66573185,6.30606678e-14 4.94107946,6.30606678e-14 C2.21642707,6.30606678e-14 -1.77635684e-15,2.21642707 -1.77635684e-15,4.94107946 C-1.77635684e-15,7.66573185 2.21642707,9.88215892 4.94107946,9.88215892 C6.13705598,9.88215892 7.23468149,9.4546379 8.0901941,8.74524006 L11.5948312,12.3901097 C11.6409479,12.438344 11.7025938,12.4623436 11.7644749,12.4623436 C11.8232973,12.4623436 11.8818844,12.4404616 11.9275305,12.3966978 C12.0211757,12.3065819 12.0239992,12.1576437 11.9341186,12.0639984 Z M4.94107946,9.41157992 C2.47595139,9.41157992 0.470578996,7.40620753 0.470578996,4.94107946 C0.470578996,2.47595139 2.47595139,0.470578996 4.94107946,0.470578996 C7.40620753,0.470578996 9.41157992,2.47595139 9.41157992,4.94107946 C9.41157992,7.40620753 7.40597224,9.41157992 4.94107946,9.41157992 Z" id="search"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/client-frankfurt/src/assets/img/icon-search.svg b/cds-ui/designer-client/src/assets/img/icon-search.svg
index fad9c9bf9..fad9c9bf9 100644
--- a/cds-ui/client-frankfurt/src/assets/img/icon-search.svg
+++ b/cds-ui/designer-client/src/assets/img/icon-search.svg
diff --git a/cds-ui/designer-client/src/assets/img/icon-topologySource.svg b/cds-ui/designer-client/src/assets/img/icon-topologySource.svg
new file mode 100644
index 000000000..3d53d447d
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-topologySource.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="15px" height="15px" viewBox="0 0 15 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>source-page</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-823.000000, -73.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="edit-actions" transform="translate(543.000000, 61.000000)">
+ <g id="elements" transform="translate(10.000000, 6.000000)">
+ <g id="view-options" transform="translate(192.000000, 0.000000)">
+ <g id="source" transform="translate(66.000000, 0.000000)">
+ <g id="txt" transform="translate(12.000000, 6.000000)">
+ <g id="source-page">
+ <g id="Group" transform="translate(2.944785, 5.521472)">
+ <path d="M3.01527607,4.48886503 C3.00915644,4.44657975 2.9865184,4.4084816 2.95233129,4.38289877 L1.21766871,3.08567485 L2.95233129,1.78845092 C2.9865184,1.7628681 3.00915644,1.72476994 3.01527607,1.68248466 C3.02134969,1.64019939 3.01044479,1.59726994 2.98481595,1.5629908 L2.70924847,1.19452454 C2.65592025,1.12329755 2.55506135,1.10871166 2.48383436,1.16203988 L0.0839723926,2.95670245 C0.0433435583,2.98707055 0.0193711656,3.0348773 0.0193711656,3.08567485 C0.0193711656,3.13647239 0.0433435583,3.18427914 0.0839723926,3.21464724 L2.48383436,5.00930982 C2.51273006,5.0309816 2.54659509,5.04138037 2.58013804,5.04138037 C2.62918712,5.04138037 2.67763804,5.01911043 2.70924847,4.97682515 L2.98481595,4.6083589 C3.01039877,4.57407975 3.02134969,4.53115031 3.01527607,4.48886503 Z" id="Path"></path>
+ <path d="M9.00763804,2.95670245 L6.6078681,1.16203988 C6.5366411,1.10875767 6.43578221,1.12334356 6.3825,1.19452454 L6.10693252,1.5629908 C6.08134969,1.59722393 6.07039877,1.64019939 6.07647239,1.68248466 C6.08259202,1.72472393 6.10518405,1.7628681 6.13941718,1.78845092 L7.87403374,3.08567485 L6.13941718,4.38289877 C6.10518405,4.4084816 6.08259202,4.44662577 6.07647239,4.48886503 C6.07039877,4.53115031 6.08130368,4.57412577 6.10693252,4.6083589 L6.3825,4.97682515 C6.41415644,5.01911043 6.46256135,5.04138037 6.51161043,5.04138037 C6.54515337,5.04138037 6.57897239,5.03093558 6.60791411,5.00930982 L9.00768405,3.21464724 C9.04831288,3.18427914 9.07228528,3.13647239 9.07228528,3.08567485 C9.07228528,3.0348773 9.04826687,2.98707055 9.00763804,2.95670245 Z" id="Path"></path>
+ <path d="M6.08576687,0.204110429 L5.66194785,0.024892638 C5.62265337,0.00823619632 5.57829755,0.0079601227 5.53868098,0.0239723926 C5.49911043,0.0400306748 5.4675,0.0711349693 5.45088957,0.11047546 L2.92021472,6.09593558 C2.88556748,6.17783742 2.92389571,6.27234663 3.00584356,6.30699387 L3.42966258,6.48621166 C3.44967791,6.49472393 3.47102761,6.49891104 3.4923773,6.49891104 C3.51294479,6.49891104 3.53351227,6.49495399 3.55292945,6.48708589 C3.5925,6.47102761 3.62406442,6.43992331 3.64072086,6.40058282 L6.17139571,0.415122699 C6.20599693,0.333220859 6.16766871,0.238757669 6.08576687,0.204110429 Z" id="Path"></path>
+ </g>
+ <path d="M14.1760123,0.021303681 L0.805214724,0.021303681 C0.361242331,0.021303681 0,0.382546012 0,0.826518405 L0,13.4185123 C0,13.8624847 0.361242331,14.223727 0.805214724,14.223727 L14.1760123,14.223727 C14.6199847,14.223727 14.981227,13.8624847 14.981227,13.4185123 L14.981227,0.826518405 C14.981227,0.3825 14.6199847,0.021303681 14.1760123,0.021303681 Z M12.5827454,1.25595092 C12.9506135,1.25595092 13.2499233,1.55526074 13.2499233,1.92312883 C13.2499233,2.29099693 12.9506135,2.59030675 12.5827454,2.59030675 C12.2148773,2.59030675 11.9155675,2.29099693 11.9155675,1.92312883 C11.9155675,1.55526074 12.2148773,1.25595092 12.5827454,1.25595092 Z M10.3202761,1.25595092 C10.6881442,1.25595092 10.987454,1.55526074 10.987454,1.92312883 C10.987454,2.29099693 10.6881442,2.59030675 10.3202761,2.59030675 C9.95240798,2.59030675 9.65309816,2.29099693 9.65309816,1.92312883 C9.65309816,1.55526074 9.95240798,1.25595092 10.3202761,1.25595092 Z M2.04289877,1.57803681 L4.73461656,1.57803681 C4.92519939,1.57803681 5.07970859,1.7325 5.07970859,1.92312883 C5.07970859,2.11375767 4.92519939,2.26822086 4.73461656,2.26822086 L2.04289877,2.26822086 C1.85231595,2.26822086 1.69780675,2.11375767 1.69780675,1.92312883 C1.69780675,1.7325 1.85231595,1.57803681 2.04289877,1.57803681 Z M13.7022699,12.8284969 C13.7022699,12.8863804 13.6551534,12.9335429 13.5971779,12.9335429 L1.38404908,12.9335429 C1.32611963,12.9335429 1.27895706,12.8863804 1.27895706,12.8284969 L1.27895706,4.15656442 L13.7022699,4.15656442 L13.7022699,12.8284969 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-topologyView-active.svg b/cds-ui/designer-client/src/assets/img/icon-topologyView-active.svg
new file mode 100644
index 000000000..dad285835
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-topologyView-active.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="15px" height="14px" viewBox="0 0 15 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>sketch</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-756.000000, -73.000000)" fill="#FFFFFF" fill-rule="nonzero">
+ <g id="edit-actions" transform="translate(543.000000, 61.000000)">
+ <g id="elements" transform="translate(10.000000, 6.000000)">
+ <g id="view-options" transform="translate(192.000000, 0.000000)">
+ <g id="view">
+ <g id="txt" transform="translate(11.000000, 6.000000)">
+ <g id="sketch">
+ <path d="M15,1.90910156 C15,0.864492188 14.1494531,0.0146484375 13.1039941,0.0146484375 L1.89600586,0.0146484375 C0.850546875,0.0146484375 2.84217094e-14,0.864492187 2.84217094e-14,1.90910156 L2.84217094e-14,9.68118164 C2.84217094e-14,10.1628223 0.180820313,10.6030664 0.478212891,10.9376953 C0.18796875,11.1564258 2.84217094e-14,11.5038281 2.84217094e-14,11.8942676 C2.84217094e-14,13.0171289 0.914267578,13.9306641 2.03806641,13.9306641 L12.9619043,13.9306641 C14.0857031,13.9306641 15,13.0171289 15,11.8942676 C15,11.5038281 14.812002,11.1564258 14.5217578,10.9376953 C14.8191797,10.6030664 15,10.1628223 15,9.68118164 L15,1.90910156 Z M0.87890625,1.90910156 C0.87890625,1.34912109 1.33517578,0.893554688 1.89600586,0.893554688 L13.1039941,0.893554688 C13.6648242,0.893554688 14.1210938,1.34912109 14.1210938,1.90910156 L14.1210938,9.68118164 C14.1210938,10.2411621 13.6648242,10.6967285 13.1039941,10.6967285 L10.1249121,10.6967285 C9.72714844,10.6967285 9.40353516,11.0202246 9.40353516,11.4178125 C9.40353516,11.5361719 9.30691406,11.6324707 9.18817383,11.6324707 L5.81182617,11.6324707 C5.69308594,11.6324707 5.59646484,11.5361719 5.59646484,11.4178125 C5.59646484,11.0202246 5.27285156,10.6967285 4.87508789,10.6967285 L1.89600586,10.6967285 C1.33517578,10.6967285 0.87890625,10.2411621 0.87890625,9.68118164 L0.87890625,1.90910156 Z M12.9619336,13.0517578 L2.03806641,13.0517578 C1.39889648,13.0517578 0.87890625,12.5325 0.87890625,11.8942676 C0.87890625,11.7185742 1.02222656,11.5756348 1.19833008,11.5756348 L4.72892578,11.5756348 C4.80571289,12.1041211 5.26207031,12.5113477 5.81182617,12.5113477 L9.18817383,12.5113477 C9.73792969,12.5113477 10.1942871,12.1040918 10.2710742,11.5756348 L13.8016699,11.5756348 C13.9778027,11.5756348 14.1210938,11.7185742 14.1210938,11.8942676 C14.1210938,12.5325 13.6011035,13.0517578 12.9619336,13.0517578 Z" id="Shape"></path>
+ <path d="M8.75830078,9.28186523 C8.78850586,9.41323242 8.87736328,9.52347656 8.99935547,9.58092773 C9.05868164,9.60887695 9.12263672,9.62282227 9.1865918,9.62282227 C9.2540918,9.62282227 9.32150391,9.60729492 9.3834375,9.57626953 L10.787959,8.87267578 C10.8760254,8.82855469 10.9467187,8.75613281 10.9887012,8.66701172 L13.2263379,3.91576172 C13.5576855,3.21222656 13.254873,2.37029297 12.5513086,2.03894531 L12.5513379,2.03894531 C12.210498,1.87842773 11.8275879,1.86023437 11.473125,1.98773437 C11.1186035,2.11523437 10.8350098,2.37313477 10.6744922,2.71394531 L8.43682617,7.46519531 C8.39484375,7.55431641 8.3840332,7.65495117 8.40612305,7.75095703 L8.75830078,9.28186523 Z M11.7705469,2.81475586 C11.9041113,2.76673828 12.0484277,2.77356445 12.1768066,2.8340625 L12.1768359,2.8340625 C12.4419141,2.95892578 12.5560254,3.27615234 12.4311914,3.54125977 L12.2237695,3.98165039 L11.2622168,3.5287793 L11.4696387,3.08838867 C11.5301074,2.95998047 11.6369531,2.86280273 11.7705469,2.81475586 L11.7705469,2.81475586 Z M10.8877148,4.32392578 L11.8492969,4.77676758 L10.2583008,8.15493164 L9.48952148,8.54006836 L9.29674805,7.70206055 L10.8877148,4.32392578 Z" id="Shape"></path>
+ <path d="M2.37079102,9.62279297 L6.62724609,9.62279297 C6.86994141,9.62279297 7.06669922,9.42603516 7.06669922,9.18333984 L7.06669922,5.75036133 C7.06669922,5.50766602 6.86994141,5.3109082 6.62724609,5.3109082 L2.37079102,5.3109082 C2.1280957,5.3109082 1.93133789,5.50766602 1.93133789,5.75036133 L1.93133789,9.18333984 C1.93133789,9.42603516 2.1280957,9.62279297 2.37079102,9.62279297 Z M2.81024414,6.18981445 L6.18779297,6.18981445 L6.18779297,8.74388672 L2.81024414,8.74388672 L2.81024414,6.18981445 Z" id="Shape"></path>
+ <path d="M2.37079102,2.82873047 L7.81514648,2.82873047 C8.0578418,2.82873047 8.25459961,2.63197266 8.25459961,2.38927734 C8.25459961,2.14658203 8.0578418,1.94982422 7.81514648,1.94982422 L2.37079102,1.94982422 C2.1280957,1.94982422 1.93133789,2.14658203 1.93133789,2.38927734 C1.93133789,2.63197266 2.1280957,2.82873047 2.37079102,2.82873047 Z" id="Path"></path>
+ <path d="M2.37079102,4.29357422 L6.49678711,4.29357422 C6.73948242,4.29357422 6.93624023,4.09681641 6.93624023,3.85412109 C6.93624023,3.61142578 6.73948242,3.41466797 6.49678711,3.41466797 L2.37079102,3.41466797 C2.1280957,3.41466797 1.93133789,3.61142578 1.93133789,3.85412109 C1.93133789,4.09681641 2.1280957,4.29357422 2.37079102,4.29357422 Z" id="Path"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-undoActive.svg b/cds-ui/designer-client/src/assets/img/icon-undoActive.svg
new file mode 100644
index 000000000..2ae0cb6b3
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-undoActive.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="13px" height="6px" viewBox="0 0 13 6" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>undo</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-563.000000, -77.000000)" fill="#1B3E6F" fill-rule="nonzero">
+ <g id="edit-actions" transform="translate(543.000000, 61.000000)">
+ <g id="elements" transform="translate(10.000000, 6.000000)">
+ <g id="undo/redo">
+ <g id="icons" transform="translate(10.000000, 10.000000)">
+ <path d="M6.66361556,0.634620137 C4.98500915,0.634620137 3.45556064,1.25972082 2.28466819,2.28466819 L2.48689958e-14,1.00808251e-13 L2.48689958e-14,5.71167048 L5.71167048,5.71167048 L3.41748284,3.41748284 C4.29645538,2.67814874 5.42290389,2.2212151 6.66361556,2.2212151 C8.91338902,2.2212151 10.8172792,3.68402746 11.4836407,5.71167048 L12.9845309,5.21665904 C12.1119245,2.5575492 9.61464531,0.634620137 6.66361556,0.634620137 Z" id="undo"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-zoomIn.svg b/cds-ui/designer-client/src/assets/img/icon-zoomIn.svg
new file mode 100644
index 000000000..857787634
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-zoomIn.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>Shape</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-703.000000, -74.000000)" fill="#D9E3EE" fill-rule="nonzero">
+ <g id="edit-actions" transform="translate(543.000000, 61.000000)">
+ <g id="elements" transform="translate(10.000000, 6.000000)">
+ <g id="zoom" transform="translate(81.000000, 0.000000)">
+ <g id="icons" transform="translate(10.000000, 7.000000)">
+ <path d="M65,0 C61.6916923,0 59,2.69146154 59,6 C59,9.30853846 61.6916923,12 65,12 C68.3083077,12 71,9.30853846 71,6 C71,2.69146154 68.3083077,0 65,0 Z M67.8846154,6.46153846 L65.4615385,6.46153846 L65.4615385,9 C65.4615385,9.25476923 65.2547692,9.46153846 65,9.46153846 C64.7452308,9.46153846 64.5384615,9.25476923 64.5384615,9 L64.5384615,6.46153846 L62.1153846,6.46153846 C61.8606154,6.46153846 61.6538462,6.25476923 61.6538462,6 C61.6538462,5.74523077 61.8606154,5.53846154 62.1153846,5.53846154 L64.5384615,5.53846154 L64.5384615,3.23076923 C64.5384615,2.976 64.7452308,2.76923077 65,2.76923077 C65.2547692,2.76923077 65.4615385,2.976 65.4615385,3.23076923 L65.4615385,5.53846154 L67.8846154,5.53846154 C68.1393846,5.53846154 68.3461538,5.74523077 68.3461538,6 C68.3461538,6.25476923 68.1393846,6.46153846 67.8846154,6.46153846 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/icon-zoomOut.svg b/cds-ui/designer-client/src/assets/img/icon-zoomOut.svg
new file mode 100644
index 000000000..5449f63f4
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/icon-zoomOut.svg
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="12px" height="12px" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 60 (88103) - https://sketch.com -->
+ <title>Shape</title>
+ <desc>Created with Sketch.</desc>
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="3.1.1-Designer" transform="translate(-644.000000, -74.000000)" fill="#D9E3EE" fill-rule="nonzero">
+ <g id="edit-actions" transform="translate(543.000000, 61.000000)">
+ <g id="elements" transform="translate(10.000000, 6.000000)">
+ <g id="zoom" transform="translate(81.000000, 0.000000)">
+ <g id="icons" transform="translate(10.000000, 7.000000)">
+ <path d="M6,0 C2.69169231,0 0,2.69146154 0,6 C0,9.30853846 2.69169231,12 6,12 C9.30830769,12 12,9.30853846 12,6 C12,2.69146154 9.30830769,0 6,0 Z M8.88461538,6.46153846 L3.11538462,6.46153846 C2.86061538,6.46153846 2.65384615,6.25476923 2.65384615,6 C2.65384615,5.74523077 2.86061538,5.53846154 3.11538462,5.53846154 L8.88461538,5.53846154 C9.13938462,5.53846154 9.34615385,5.74523077 9.34615385,6 C9.34615385,6.25476923 9.13938462,6.46153846 8.88461538,6.46153846 Z" id="Shape"></path>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/cds-ui/designer-client/src/assets/img/img-user1.jpeg b/cds-ui/designer-client/src/assets/img/img-user1.jpeg
new file mode 100644
index 000000000..8b9f98b03
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/img-user1.jpeg
Binary files differ
diff --git a/cds-ui/designer-client/src/assets/img/img-user2.jpg b/cds-ui/designer-client/src/assets/img/img-user2.jpg
new file mode 100644
index 000000000..d107129c4
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/img-user2.jpg
Binary files differ
diff --git a/cds-ui/designer-client/src/assets/img/img-user3.jpg b/cds-ui/designer-client/src/assets/img/img-user3.jpg
new file mode 100644
index 000000000..23e305930
--- /dev/null
+++ b/cds-ui/designer-client/src/assets/img/img-user3.jpg
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/img-userProfile.png b/cds-ui/designer-client/src/assets/img/img-userProfile.png
index 83b830c0f..83b830c0f 100644
--- a/cds-ui/client-frankfurt/src/assets/img/img-userProfile.png
+++ b/cds-ui/designer-client/src/assets/img/img-userProfile.png
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/assets/img/logo-icon.svg b/cds-ui/designer-client/src/assets/img/logo-icon.svg
index 83b7441dd..83b7441dd 100644
--- a/cds-ui/client-frankfurt/src/assets/img/logo-icon.svg
+++ b/cds-ui/designer-client/src/assets/img/logo-icon.svg
diff --git a/cds-ui/client-frankfurt/src/assets/img/logo-text.svg b/cds-ui/designer-client/src/assets/img/logo-text.svg
index d6dee87a2..d6dee87a2 100644
--- a/cds-ui/client-frankfurt/src/assets/img/logo-text.svg
+++ b/cds-ui/designer-client/src/assets/img/logo-text.svg
diff --git a/cds-ui/client-frankfurt/src/assets/js/bootstrap.min.js b/cds-ui/designer-client/src/assets/js/bootstrap.min.js
index c4c0d1f95..c4c0d1f95 100644
--- a/cds-ui/client-frankfurt/src/assets/js/bootstrap.min.js
+++ b/cds-ui/designer-client/src/assets/js/bootstrap.min.js
diff --git a/cds-ui/client-frankfurt/src/assets/js/jquery-3.3.1.slim.min.js b/cds-ui/designer-client/src/assets/js/jquery-3.3.1.slim.min.js
index f4ca9b24b..f4ca9b24b 100644
--- a/cds-ui/client-frankfurt/src/assets/js/jquery-3.3.1.slim.min.js
+++ b/cds-ui/designer-client/src/assets/js/jquery-3.3.1.slim.min.js
diff --git a/cds-ui/client-frankfurt/src/assets/js/popper.min.js b/cds-ui/designer-client/src/assets/js/popper.min.js
index 94a5c26fc..94a5c26fc 100644
--- a/cds-ui/client-frankfurt/src/assets/js/popper.min.js
+++ b/cds-ui/designer-client/src/assets/js/popper.min.js
diff --git a/cds-ui/client-frankfurt/src/environments/environment.prod.ts b/cds-ui/designer-client/src/environments/environment.prod.ts
index 3612073bc..3612073bc 100644
--- a/cds-ui/client-frankfurt/src/environments/environment.prod.ts
+++ b/cds-ui/designer-client/src/environments/environment.prod.ts
diff --git a/cds-ui/client-frankfurt/src/environments/environment.ts b/cds-ui/designer-client/src/environments/environment.ts
index 7b4f817ad..7b4f817ad 100644
--- a/cds-ui/client-frankfurt/src/environments/environment.ts
+++ b/cds-ui/designer-client/src/environments/environment.ts
diff --git a/cds-ui/client-frankfurt/src/favicon.ico b/cds-ui/designer-client/src/favicon.ico
index 997406ad2..997406ad2 100644
--- a/cds-ui/client-frankfurt/src/favicon.ico
+++ b/cds-ui/designer-client/src/favicon.ico
Binary files differ
diff --git a/cds-ui/client-frankfurt/src/index.html b/cds-ui/designer-client/src/index.html
index 1aa7a99d1..1aa7a99d1 100644
--- a/cds-ui/client-frankfurt/src/index.html
+++ b/cds-ui/designer-client/src/index.html
diff --git a/cds-ui/client-frankfurt/src/main.ts b/cds-ui/designer-client/src/main.ts
index c7b673cf4..c7b673cf4 100644
--- a/cds-ui/client-frankfurt/src/main.ts
+++ b/cds-ui/designer-client/src/main.ts
diff --git a/cds-ui/client-frankfurt/src/polyfills.ts b/cds-ui/designer-client/src/polyfills.ts
index aa665d6b8..aa665d6b8 100644
--- a/cds-ui/client-frankfurt/src/polyfills.ts
+++ b/cds-ui/designer-client/src/polyfills.ts
diff --git a/cds-ui/designer-client/src/styles.css b/cds-ui/designer-client/src/styles.css
new file mode 100644
index 000000000..ff85e332f
--- /dev/null
+++ b/cds-ui/designer-client/src/styles.css
@@ -0,0 +1,1441 @@
+html, body{
+ height: 100%;
+}
+body{
+ background: #FAFAFA !important;
+ /* background-image: linear-gradient(-45deg, #000 10%, #fff 0);
+ background-size: 6px 6px; */
+ margin: 0;
+ font-family: 'HelvNeueOrange', 'Helvetica Neue', sans-serif !important;
+ color: #1B3E6F !important;
+}
+*:focus{
+ outline: none;
+}
+/*Bootstrap*/
+.custom-control-label::before{
+ border: solid 1px #1B3E6F !important;
+ border-radius: 0 !important;
+}
+.custom-control-input:checked ~ .custom-control-label::before{
+ background: #1B3E6F !important;
+}
+
+/*Components*/
+/* Menu Styles */
+.primary-nav{
+ /* left: 0; */
+ position: fixed;
+ z-index: 999;
+}
+.menu{
+ position: relative;
+}
+.menu ul{
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+.open-panel{
+ border: none;
+ background-color:#fff;
+ padding: 0;
+}
+.logo-icon{
+ background: #fff;
+ position: relative;
+ display: block;
+ text-align: center;
+ padding: 16px 0;
+ width: 50px;
+ height: 60px;
+ left: 0;
+ top: 0;
+ z-index: 1000;
+ cursor: pointer;
+}
+.primary-nav .menu li{
+ position: relative;
+}
+.menu .icon{
+ position: absolute;
+ top: 12px;
+ right: 10px;
+ pointer-events: none;
+ width: 30px;
+ height: 30px;
+ color: #fff;
+ text-align: center;
+}
+.menu .icon .fa{
+vertical-align: middle;
+}
+.menu,
+.menu a,
+.menu a:visited{
+ color: #fff;
+ text-decoration: none!important;
+ position: relative;
+}
+.menu a{
+ display: block;
+ white-space: nowrap;
+ padding: 10px 1em;
+ font-size: 12px;
+ font-weight: bold;
+ height: 52px;
+ line-height: 30px;
+}
+.menu a:hover{
+ color: #fff;
+}
+.menu-dropdown li .icon{
+ padding: 2px 6px;
+ color: #fff;
+}
+.menu-dropdown li.active .icon{
+ color: #fff;
+ background: #265699;
+ border-radius: 50%;
+}
+.menu-dropdown li:hover{
+ background: #172B4D;
+}
+.menu label{
+ margin-bottom: 0;
+ display: block;
+}
+.menu label:hover{
+ cursor: pointer;
+}
+.menu input[type="checkbox"]{
+ display: none;
+}
+input#menu[type="checkbox"]{
+ display: none;
+}
+.sub-menu-dropdown{
+ display: none;
+}
+.new-wrapper{
+ position: absolute;
+ left: 50px;
+ width: calc(100% - 50px);
+ transition: transform .45s cubic-bezier(0.77, 0, 0.175, 1);
+}
+#menu:checked + ul.menu-dropdown{
+ left: 0;
+ -webkit-animation: all .45s cubic-bezier(0.77, 0, 0.175, 1);
+ animation: all .45s cubic-bezier(0.77, 0, 0.175, 1);
+}
+.sub-menu-checkbox:checked + ul.sub-menu-dropdown{
+ display: block!important;
+ -webkit-animation: grow .45s cubic-bezier(0.77, 0, 0.175, 1);
+ animation: grow .45s cubic-bezier(0.77, 0, 0.175, 1);
+ border-top: solid 2px #1B3E6F;
+}
+.openNav .new-wrapper{
+ position: absolute;
+ transform: translate3d(200px, 0, 0);
+ width: calc(100% - 250px);
+ transition: transform .45s cubic-bezier(0.77, 0, 0.175, 1);
+}
+.downarrow{
+ background: transparent;
+ position: absolute;
+ right: 50px;
+ top: 12px;
+ color: #fff;
+ width: 24px;
+ height: 24px;
+ text-align: center;
+ display: block;
+}
+.downarrow:hover{
+ color: #fff;
+}
+.menu{
+ position: absolute;
+ display: block;
+ left: -200px;
+ top: 0;
+ width: 250px;
+ height: 100vh;
+ transition: all 0.45s cubic-bezier(0.77, 0, 0.175, 1);
+ background-color: #1B3E6F;
+ z-index: 999;
+}
+.menu-dropdown{
+ top: 0;
+ overflow-y: auto;
+}
+.overflow-container{
+ position: relative;
+ height: calc(100vh - 60px)!important;
+ overflow-y: auto;
+ border-top: 60px solid #fff;
+ z-index: -1;
+ display:block;
+}
+
+.menu .logotype{
+ position: absolute !important;
+ top: 16px;
+ left: 55px;
+ display: block;
+}
+/* .sub-menu-dropdown{
+background-color: #333;
+} */
+.menu:hover{
+ position: absolute;
+ left: 0;
+ top: 0;
+}
+.openNav .menu:hover{
+ position: absolute;
+ left: -200px;
+ top: 60px;
+}
+.openNav .menu{
+ top: 60px;
+ transform: translate3d(200px, 0, 0);
+ transition: transform .45s cubic-bezier(0.77, 0, 0.175, 1);
+}
+@-webkit-keyframes grow{
+ 0% {
+ display: none;
+ opacity: 0;
+ }
+ 50% {
+ display: block;
+ opacity: 0.5;
+ }
+ 100% {
+ opacity: 1;
+ }
+}
+@keyframes grow{
+
+ 0% {
+ display: none;
+ opacity: 0;
+ }
+ 50% {
+ display: block;
+ opacity: 0.5;
+ }
+ 100% {
+ opacity: 1
+ }
+}
+/*User Profile*/
+.userProfile .dropdown{
+ width: 100%;
+}
+.userProfile .dropdown:hover{
+ background: #172B4D !important;
+}
+.userProfile .dropdown-text{
+ background: transparent;
+ border: 0;
+ box-shadow: none;
+ font-size: 13px;
+ line-height: 40px;
+}
+/* .userProfile .dropdown-toggle{
+height: 40px;
+} */
+.userProfile .dropdown-toggle:hover ~ .dropdown-text,
+.userProfile .dropdown-toggle:focus ~ .dropdown-text{
+ background: transparent !important;
+ border-radius: 0 !important;
+ box-shadow: none !important;
+}
+
+.userProfile .dropdown-text::after {
+ right: 14px;
+ top: 8px;
+ width: 24px;
+ height: 24px;
+ background: url(/assets/img/img-userProfile.png) center center no-repeat;
+ }
+.packagesFilter .custom-checkbox{
+ margin-left: 8px;
+}
+.packagesFilter .custom-control-label{
+ line-height: 28px !important;
+ font-size: 14px !important;
+ text-indent: 6px !important;
+}
+/**Packages Sort**/
+.sort-packages{
+ font-size: 12px;
+ font-weight: bold;
+ color: #C3CDDB;
+}
+.sort-packages .dropdown{
+ width: 88px;
+}
+.sort-packages .dropdown-text{
+ background: transparent;
+ border: 0;
+ box-shadow: none;
+ color: #1B3E6F;
+}
+.sort-packages .dropdown-text::after{
+ border-color: #1B3E6F transparent transparent transparent;
+}
+.sort-packages .dropdown-toggle:focus ~ .dropdown-text::after{
+ border-color: transparent transparent #1B3E6F transparent;
+}
+.sort-packages .dropdown-toggle:hover ~ .dropdown-text,
+.sort-packages .dropdown-toggle:focus ~ .dropdown-text{
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
+ background: #fff;
+}
+.sort-packages .dropdown-content:hover,
+.sort-packages .dropdown-toggle:focus ~ .dropdown-content{
+ top: 30px;
+}
+.sort-packages .dropdown-content{
+ width: 88px;
+ padding: 6px 0;
+ background: #fff;
+ border-radius: 2px;
+ border: 0;
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
+}
+.sort-packages .dropdown-content a{
+ color: #1B3E6F;
+ font-size: 12px;
+}
+.sort-packages .dropdown-content a:hover{
+ background-color: #F4F9FE;
+ text-decoration: unset;
+}
+/**Pagination**/
+.page-item .page-link,
+.page-item.disabled .page-link{
+ background: transparent !important;
+ border: 0;
+ color: #1B3E6F !important;
+ font-size: 14px;
+}
+.page-link:hover{
+ color: #fff !important;
+ background-color: #C3CDDB !important;
+ border-radius: 100%;
+}
+/**Packages Cards***/
+/***Package Info Card***/
+.packages-card .card{
+ margin: 0;
+ border-radius: 2px;
+ border: 0;
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, 0.1);
+}
+.packages-card .card-title{
+ margin-bottom: 0 !important;
+ font-size: 15px;
+ font-weight: bold;
+}
+.packages-card p{
+ font-size: 14px;
+ color: #D0D7E4;
+}
+/***Add Package Card***/
+.addPaackage-card{
+ padding: 10px 0;
+ background: #F4F9FE !important;
+ border: solid 1px #D7E7F9 !important;
+}
+.addPaackage-card img{
+ margin-bottom: 12px;
+ margin-top: 8px;
+}
+.addPaackage-card a{
+ margin-bottom: 20px;
+ padding: 10px 10px 10px 32px;
+ font-weight: bold;
+ font-size: 10px;
+ text-transform: uppercase;
+ border-radius: 2px;
+ border-width: .5px;
+ border-style: solid;
+ background-position: 10px center;
+ background-repeat: no-repeat;
+}
+.addPaackage-card a:hover{
+ text-decoration: unset;
+}
+.btn-create-package,
+.btn-create-package:hover{
+ background-color: #1B3E6F;
+ border-color: #1B3E6F;
+ color: #fff;
+ background-image: url(../src/assets/img/icon-create-white.svg);
+}
+.btn-import-package,
+.btn-import-package:hover{
+ color: #1B3E6F;
+ background-image: url(../src/assets/img/icon-import-blue.svg);
+}
+/***Actions Menu***/
+.packages-card .dropdown{
+ width: auto;
+ float: right;
+}
+.packages-card .dropdown-text{
+ background: transparent;
+ border: 0;
+ box-shadow: none;
+ text-indent: 0;
+ line-height: unset;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+ opacity: .6;
+}
+.packages-card .dropdown-text::after{
+ display: none;
+}
+.packages-card .dropdown-text img{
+ padding: 9px 7px;
+}
+.packages-card .dropdown-content{
+ right: 0;
+ width: 120px;
+ padding: 6px 0;
+
+ border: 0;
+ border-radius: 50%;
+}
+/* .userProfile .dropdown-content{
+ bottom: 40px !important;
+ top: unset !important;
+ width: 100%;
+} */
+/**Tab Nav**/
+.nav-tabs{
+ border-bottom-color: #ECEDF2 !important;
+}
+.nav-link{
+ padding: 15px 20px 15px 0 !important;
+ text-transform: uppercase !important;
+ font-size: 12px;
+ font-weight: bold;
+ color: #C3CDDB !important;
+ border: none !important;
+}
+.nav-tabs .nav-link:focus,
+.nav-tabs .nav-link:hover{
+ border: 0 !important;
+}
+ .nav-tabs .nav-link:hover{
+ color: #1B3E6F !important;
+ }
+ .nav-tabs .nav-link.active{
+ color: #1B3E6F !important;
+ background: transparent !important;
+ border: 0 !important;
+ border-bottom: solid 2px #1B3E6F !important;
+ }
+ .nav-tabs .nav-link::before{
+ content: "|";
+ padding-right: 20px !important;
+ color: #C3CDDB;
+ font-weight: normal;
+ }
+ .nav-tabs .nav-link:first-child::before{
+ content: none;
+ }
+ .nav-tabs .nav-link:first-child{
+ padding-left: 20px !important;
+ }
+ /**Sliding Search Input**/
+ .searchBox{
+ position: absolute;
+ top: 0%;
+ right: 0%;
+ transform: translate(0%,-0%);
+ height: 40px;
+ }
+ .searchButton{
+ float: right;
+ margin-top: 14px;
+ padding-left: 0 !important;
+ padding-right: 24px !important;
+ width: 60px;
+ height: 24px;
+ background: url(../src/assets/img/icon-search.svg) center center no-repeat;
+ background-size: 28%;
+ border: 0 !important;
+ border-right: solid 1px #1B3E6F !important;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ transition: 0.4s;
+ }
+ .searchBox:hover > .searchInput{
+ width: 240px;
+ border-bottom: solid 1px #C3CDDB;
+ }
+ .searchBox:hover > .searchButton{
+ color: #1B3E6F;
+ }
+ .searchInput{
+ border: none;
+ background: none;
+ outline: none;
+ float: left;
+ padding: 0;
+ color: #1B3E6F;
+ font-size: 14px;
+ transition: 0.4s;
+ line-height: 40px;
+ width: 0px;
+ }
+ .searchInput::placeholder{
+ color: #BABBC3;
+ }
+ .searchBox-expanded{
+ width: 240px;
+ border-bottom: solid 1px #C3CDDB;
+ }
+ /**Drop Down Menu**/
+ .dropdown{
+ position: relative;
+ display: inline-block;
+ text-align: left;
+ width: 132px;
+ z-index: 200;
+ }
+ .dropdown-text{
+ cursor: pointer;
+ position: relative;
+ text-indent: 10px;
+ line-height: 32px;
+ background-color: #eee;
+ border: 1px solid #ccc;
+ border-radius: 3px;
+ box-shadow: 0 1px 0 rgba(255,255,255, .9) inset, 0 1px 3px rgba(0,0,0, .1);
+ width: 100%;
+ }
+ .dropdown-text:after{
+ position: absolute;
+ right: 6px;
+ top: 15px;
+ content: '';
+ width: 0px;
+ height: 0px;
+ border-style: solid;
+ border-width: 5px 4px 0 4px;
+ border-color: #555 transparent transparent transparent;
+ }
+ .dropdown-toggle{
+ font-size: 0;
+ z-index: 1;
+ cursor: pointer;
+ position: absolute;
+ top: 0;
+ border: none;
+ padding: 0;
+ margin: 0 0 0 1px;
+ background: transparent;
+ text-indent: -10px;
+ height: 34px;
+ width: 100%;
+ }
+ .dropdown-toggle:focus{
+ outline: 0;
+ }
+ .dropdown-content{
+ position: absolute;
+ top: 32px;
+ width: 140px;
+ margin: 0;
+ padding: 0;
+ opacity: 0;
+ visibility:hidden;
+ -webkit-transition: all .25s ease;
+ -moz-transition: all .25s ease;
+ -ms-transition: all .25s ease;
+ -o-transition: all .25s ease;
+ transition: all .25s ease;
+ list-style-type: none;
+ border-radius: 3px;
+ text-indent: 10px;
+ line-height: 32px;
+ background-color: #eee;
+ border: 1px solid #ccc;
+ }
+ .dropdown-content a{
+ display: block;
+ }
+ .dropdown-content a:hover{
+ background: #e8e8e8;
+ }
+ .dropdown-toggle:hover ~ .dropdown-text,
+ .dropdown-toggle:focus ~ .dropdown-text{
+ background-color: #e8e8e8;
+ }
+ .dropdown-toggle:focus ~ .dropdown-text{
+ box-shadow: 0 1px 3px rgba(0,0,0, .2) inset, 0 1px 0 rgba(255,255,255, 0.8);
+ z-index: 2;
+ }
+ .dropdown-toggle:focus ~ .dropdown-text:after{
+ border-width: 0 4px 5px 4px;
+ border-color: transparent transparent #555 transparent;
+ }
+ .dropdown-content:hover,
+ .dropdown-toggle:focus ~ .dropdown-content{
+ opacity: 1;
+ visibility:visible;
+ top: 42px;
+ }
+ /**Card**/
+ /* Hover Shadow */
+ @keyframes hover {
+ 50% {
+ transform: translateY(-3px);
+ }
+ 100% {
+ transform: translateY(-6px);
+ }
+ }
+ @keyframes card {
+ 0% {
+ transform: translateY(6px);
+ opacity: .3;
+ }
+ 50% {
+ transform: translateY(3px);
+ opacity: .8;
+ }
+ 100% {
+ transform: translateY(6px);
+ opacity: .3;
+ }
+ }
+ .card {
+ /* display: inline-block;
+ position: relative;
+ transition-duration: 0.2s;
+ transition-property: transform;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ transform: translateZ(0); */
+ margin-bottom: 25px !important;
+ box-shadow: 0 0 1px rgba(0, 0, 0, 0);
+ }
+ /* .card:before {
+ pointer-events: none;
+ position: absolute;
+ z-index: -1;
+ content: '';
+ top: 100%;
+ left: 5%;
+ height: 10px;
+ width: 90%;
+ opacity: 0;
+ background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 70%);
+ transition-duration: 0.2s;
+ transition-property: transform opacity;
+ } */
+ /* .card:hover {
+ transform: translateY(-3px);
+ animation-name: hover;
+ animation-duration: 1s;
+ animation-delay: 0.2s;
+ animation-timing-function: linear;
+ animation-iteration-count: 1;
+ animation-direction: alternate;
+ }
+ .card:hover:before {
+ opacity: .4;
+ transform: translateY(3px);
+ animation-name: card;
+ animation-duration: 1s;
+ animation-delay: .2s;
+ animation-timing-function: linear;
+ animation-iteration-count: 1;
+ animation-direction: alternate;
+ } */
+ .card-body{
+ padding: 20px !important;
+ }
+
+ /*Main Container*/
+ .main-container{
+ padding: 0 !important;
+ }
+ /*Page Title*/
+ .page-title{
+ padding: 21px 30px;
+ background:#fff;
+ border-left: solid 1px #FAFAFA;
+ margin-bottom: 21px;
+ -webkit-box-shadow: 0 4px 10px 0 #eef0f5;
+ box-shadow: 0 4px 10px 0 #eef0f5;
+ position: relative;
+ z-index: 8;
+ }
+ .page-title h2{
+ font-size: 16px;
+ font-weight: bold;
+ }
+ .page-title h2 span{
+ color: #BABBC3;
+ font-size: 14px;
+ }
+ /*Content*/
+ .body-container{
+ padding: 0 30px !important;
+ }
+ .search-filter-col{
+ padding-right: 0 !important;
+ border-bottom: solid 1px #ECEDF2 !important;
+ }
+ /**Packages Filter**/
+ .packagesFilter{
+ margin-top: 12px;
+ margin-bottom: 7px;
+ }
+ .packagesFilter .dropdown-toggle{
+ height: 36px !important;
+ }
+ .packagesFilter .dropdown-toggle:focus ~ .dropdown-text::after{
+ border-color: transparent transparent #1B3E6F transparent;
+ }
+ .packagesFilter .dropdown-text{
+ background: transparent;
+ border: 0;
+ box-shadow: none;
+ text-indent: 14px;
+ line-height: 30px;
+ font-size: 12px;
+ }
+ .packagesFilter .dropdown-text::after{
+ right: 12px;
+ border-color: #1B3E6F transparent transparent transparent;
+ }
+ .packagesFilter .dropdown-toggle:hover ~ .dropdown-text,
+ .packagesFilter .dropdown-toggle:focus ~ .dropdown-text{
+ background-color: transparent;
+ box-shadow: none;
+ border-radius: 0;
+ }
+ .packagesFilter .dropdown-toggle:focus ~ .dropdown-text{
+ background: #fff;
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
+ }
+ .packagesFilter .dropdown-text::after{
+ top: 12px;
+ }
+ .packagesFilter .dropdown-content{
+ padding: 6px 0 15px;
+ background: #fff;
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
+ border: 0;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ border-bottom-left-radius: 2px;
+ border-bottom-right-radius: 2px;
+ }
+ .packagesFilter .dropdown-content:hover,
+ .packagesFilter .dropdown-toggle:focus ~ .dropdown-content{
+ top: 30px;
+ }
+ .packagesFilter .form-control{
+ padding: 12px 9px 12px 38px !important;
+ border: 0 !important;
+ border-bottom: solid 1px #D7E7F9 !important;
+ background: url(../src/assets/img/icon-search.svg) 15px center no-repeat;
+ background-size: 4%;
+ border-radius: 0 !important;
+ color: #1B3E6F;
+ font-size: 13px;
+ }
+ .packagesFilter .form-control::placeholder{
+ color: #BABBC3;
+ }
+ .packagesFilter .form-control:focus{
+ box-shadow: none !important;
+ border-bottom: solid 1px #1B3E6F !important;
+ }
+ .packagesFilter .custom-checkbox{
+ margin-left: 8px;
+ }
+ .packagesFilter .custom-control-label{
+ line-height: 28px !important;
+ font-size: 13px !important;
+ text-indent: 6px !important;
+ }
+ /**Packages Sort**/
+ .sort-packages{
+ font-size: 12px;
+ font-weight: bold;
+ color: #C3CDDB;
+ }
+ .sort-packages .dropdown{
+ width: 88px;
+ }
+ .sort-packages .dropdown-text{
+ background: transparent;
+ border: 0;
+ box-shadow: none;
+ color: #1B3E6F;
+ }
+ .sort-packages .dropdown-text::after{
+ border-color: #1B3E6F transparent transparent transparent;
+ }
+ .sort-packages .dropdown-toggle:focus ~ .dropdown-text::after{
+ border-color: transparent transparent #1B3E6F transparent;
+ }
+ .sort-packages .dropdown-toggle:hover ~ .dropdown-text,
+ .sort-packages .dropdown-toggle:focus ~ .dropdown-text{
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
+ background: #fff;
+ }
+ .sort-packages .dropdown-content:hover,
+ .sort-packages .dropdown-toggle:focus ~ .dropdown-content{
+ top: 30px;
+ }
+ .sort-packages .dropdown-content{
+ width: 88px;
+ padding: 6px 0;
+ background: #fff;
+ border-radius: 2px;
+ border: 0;
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, .15);
+ }
+ .sort-packages .dropdown-content a{
+ color: #1B3E6F;
+ font-size: 12px;
+ }
+ .sort-packages .dropdown-content a:hover{
+ background-color: #F4F9FE;
+ text-decoration: unset;
+ }
+ /**Pagination**/
+ .page-item .page-link,
+ .page-item.disabled .page-link{
+ background: transparent !important;
+ border: 0;
+ color: #1B3E6F !important;
+ font-size: 14px;
+ }
+ .page-link:hover{
+ color: #fff !important;
+ background-color: #C3CDDB !important;
+ border-radius: 100%;
+ }
+ /**Packages Cards***/
+ /***Package Info Card***/
+ .packages-card .card{
+ margin: 0;
+ border-radius: 2px;
+ border: 0;
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, 0.1);
+ }
+ .packages-card .card:hover{
+ box-shadow: 0 2px 13px 6px rgba(47, 83, 151, .15);
+ transition: all 0.5s ease;
+ }
+ .packages-card .card-title{
+ margin-bottom: 0 !important;
+ font-size: 15px;
+ font-weight: bold;
+ }
+ .packages-card p{
+ font-size: 14px;
+ color: #D0D7E4;
+ }
+.packages-card .card-body{
+ padding-bottom: 0 !important;
+}
+.packages-card .card-footer .col{
+ padding: 0;
+ text-align: center;
+}
+.packages-card .card-footer .col:last-child{
+ padding-left: 20px;
+}
+ /***Add Package Card***/
+ .addPaackage-card{
+ background: #F4F9FE !important;
+ border: solid 1px #D7E7F9 !important;
+ }
+ .addPaackage-card:hover{
+ box-shadow: 0 2px 6px 0 rgba(47, 83, 151, 0.1) !important;
+ }
+ .addPaackage-card img{
+ margin-bottom: 33px;
+ margin-top: 8px;
+ }
+ .addPaackage-card a{
+ margin: 0 0 14px;
+ padding: 10px 10px 10px 32px;
+ font-weight: bold;
+ font-size: 10px;
+ text-transform: uppercase;
+ border-radius: 2px;
+ border-width: .5px;
+ border-style: solid;
+ background-position: 10px center;
+ background-repeat: no-repeat;
+ text-align: left;
+ }
+ .addPaackage-card a:hover{
+ text-decoration: unset;
+ }
+ .addPaackage-card .card-footer .col{
+ padding: 0;
+ text-align: right;
+ }
+ .addPaackage-card .card-footer .col:last-child{
+ text-align: left;
+ }
+ .btn-create-package,
+ .btn-create-package:hover{
+ background-color: #1B3E6F;
+ border-color: #1B3E6F;
+ color: #fff;
+ background-image: url(../src/assets/img/icon-create-white.svg);
+ background-repeat: no-repeat;
+ }
+ .btn-import-package,
+ .btn-import-package:hover{
+ color: #1B3E6F;
+ background-image: url(../src/assets/img/icon-import-blue.svg);
+ }
+ /***Actions Menu***/
+ .packages-card .dropdown{
+ width: auto;
+ float: right;
+ }
+ .packages-card .dropdown-text{
+ background: transparent;
+ border: 0;
+ box-shadow: none;
+ text-indent: 0;
+ line-height: unset;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+ opacity: .6;
+ }
+ .packages-card .dropdown-text::after{
+ display: none;
+ }
+ .packages-card .dropdown-text img{
+ padding: 9px 7px;
+ }
+ .packages-card .dropdown-content{
+ right: 0;
+ width: 120px;
+ padding: 6px 0;
+ border: 0;
+ text-indent: 0;
+ border-radius: 2px;
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+ background: #1B3E6F;
+ }
+ .packages-card .dropdown-content a{
+ padding-left: 45px;
+ color: #fff;
+ font-size: 13px;
+ background-position: 20px center;
+ background-size: 10%;
+ background-repeat: no-repeat;
+ }
+ .packages-card .dropdown-content a:hover{
+ background-color: #172B4D;
+ text-decoration: unset;
+ }
+ .packages-card .action-clone a,
+ .packages-card .action-clone a:hover{
+ background-image: url(../src/assets/img/icon-clone-sm.svg);
+ }
+ .packages-card .action-archive a,
+ .packages-card .action-archive a:hover{
+ background-image: url(../src/assets/img/icon-archive-sm.svg);
+ }
+ .packages-card .action-delete a,
+ .packages-card .action-delete a:hover{
+ background-image: url(../src/assets/img/icon-delete-sm.svg);
+ }
+ .packages-card .dropdown-content:hover,
+ .packages-card .dropdown-toggle:focus ~ .dropdown-content{
+ top: 24px;
+ }
+ .packages-card .dropdown-toggle:hover ~ .dropdown-text{
+ background: transparent;
+ opacity: 1;
+ }
+ .packages-card .dropdown-toggle:focus ~ .dropdown-text{
+ opacity: 1;
+ background: #1B3E6F;
+ box-shadow: none;
+ }
+ /***Contributers***/
+ ul.package-contributers{
+ /*margin-bottom: 0 !important;*/
+ padding-left: 0 !important;
+ }
+ .package-contributers li{
+ list-style: none;
+ display: inline-block;
+ }
+ .package-contributers li{
+ margin-left: -5px;
+ }
+ .package-contributers li:first-child{
+ margin-left: 0;
+ }
+ .package-contributers li:last-child{
+ margin-left: 9px;
+ }
+ .package-modifier,
+ .package-contributers button{
+ padding: 0 !important;
+ border-radius: 100%;
+ border: 0 !important;
+ /*Hover Effect*/
+ -webkit-transition: box-shadow 0.2s ease;
+ -moz-transition: box-shadow 0.2s ease;
+ transition: box-shadow 0.2s ease;
+ -webkit-backface-visibility: hidden;
+ backface-visibility: hidden;
+ display: inline-block;
+ position: relative;
+ }
+ .package-modifier:before,
+ .package-contributers button:before{
+ -webkit-transition: all 0.2s ease;
+ -moz-transition: all 0.2s ease;
+ transition: all 0.2s ease;
+ border-radius: 50%;
+ bottom: 0;
+ box-shadow: 0 0 0 2px #fff;
+ content: "";
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+ }
+ .package-modifier:hover,
+ .package-contributers button:hover{
+ box-shadow: 0 0 0 2px #D7E7F9;
+ text-decoration: none;
+ }
+ .package-modifier:hover:before,
+ .package-contributers button:hover:before{
+ -webkit-transform: scale(0.925);
+ -moz-transform: scale(0.925);
+ -ms-transform: scale(0.925);
+ -o-transform: scale(0.925);
+ transform: scale(0.925);
+ box-shadow: 0 0 0 1px #D7E7F9;
+ opacity: 0.5;
+ }
+ .package-modifier img,
+ .package-contributers button img{
+ width: 28px;
+ height: 28px;
+ object-fit: cover;
+ vertical-align: top;
+ border-radius: 100%;
+ }
+ .package-contributers a{
+ font-size: 12px;
+ color: #1273EB;
+ }
+ .package-contributers a:hover{
+ text-decoration: unset;
+ }
+ /***Package Footer***/
+ .packages-card .card-footer{
+ padding: 0 20px !important;
+ background: transparent !important;
+ border-top-color: #F7F6F6 !important;
+ }
+ .packages-card .card-footer .col:first-child{
+ border-right: solid 1px #F7F6F6;
+ }
+ .packages-card .card-footer .btn{
+ background-color: transparent !important;
+ color: #C3CDDB !important;
+ border: 0;
+ font-size: 13px;
+ opacity: .7;
+ }
+ .packages-card .card-footer .btn:hover{
+ opacity: 1;
+ }
+ .btn-card-config,
+ .btn-card-topology{
+ padding: 15px 0 15px 28px !important;
+ background-size: 16%;
+ background-position: left center;
+ background-repeat: no-repeat;
+ }
+ .btn-card-config{
+ background-image: url(../src/assets/img/icon-btn-card-config.svg);
+ }
+ .btn-card-topology{
+ background-image: url(../src/assets/img/icon-btn-card-topology.svg);
+ }
+ .icon-deployed{
+ margin-right: 5px;
+ display: inline;
+ background: url(../src/assets/img/icon-deploy.svg) center center no-repeat;
+ }
+
+
+
+
+
+
+
+
+
+
+ /* Border Fade */
+ .border-fade {
+ display: inline-block;
+ transition-duration: 0.3s;
+ transition-property: box-shadow;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ transform: translateZ(0);
+ box-shadow: inset 0 0 0 4px #ececec, 0 0 1px rgba(0, 0, 0, 0);
+ /* Hack to improve aliasing on mobile/tablet devices */
+ }
+ .border-fade:hover {
+ box-shadow: inset 0 0 0 4px #666, 0 0 1px rgba(0, 0, 0, 0);
+ /* Hack to improve aliasing on mobile/tablet devices */
+ }
+ /*Content*/
+
+ /**Title Action Buttons**/
+ .page-title-actions li{
+ display: inline-block;
+ text-align: center;
+ }
+ .title-action{
+ -webkit-transition: box-shadow 0.2s ease;
+ -moz-transition: box-shadow 0.2s ease;
+ transition: box-shadow 0.2s ease;
+ -webkit-backface-visibility: hidden;
+ backface-visibility: hidden;
+ border-radius: 50%;
+ color: #6a75eb;
+ display: inline-block;
+ font-size: 0.889em;
+ height: 4em;
+ margin: 0 1em 1em;
+ position: relative;
+ text-align: center;
+ text-transform: lowercase;
+ width: 4em;
+ line-height: 4em;
+ }
+
+ .title-action:before{
+ -webkit-transition: all 0.2s ease;
+ -moz-transition: all 0.2s ease;
+ transition: all 0.2s ease;
+ border-radius: 50%;
+ bottom: 0;
+ box-shadow: 0 0 0 1px #000;
+ content: "";
+ left: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+ }
+ .title-action:hover{
+ box-shadow: 0 0 0 7px #07819b;
+ text-decoration: none;
+ }
+ .title-action:hover:before{
+ -webkit-transform: scale(0.925);
+ -moz-transform: scale(0.925);
+ -ms-transform: scale(0.925);
+ -o-transform: scale(0.925);
+ transform: scale(0.925);
+ box-shadow: 0 0 0 1px #07819b;
+ opacity: 0.5;
+ }
+
+ /*Animation Button*/
+ /**Float**/
+ .float {
+ display: inline-block;
+ transition-duration: 0.3s;
+ transition-property: transform;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ transform: translateZ(0);
+ box-shadow: 0 0 1px rgba(0, 0, 0, 0);
+ }
+ .float:hover {
+ transform: translateY(-5px);
+ }
+
+/*TOOLTIP*/
+/* Base styles for the element that has a tooltip */
+[data-tooltip],
+.tooltip {
+ position: relative;
+ cursor: pointer;
+ text-align: center;
+}
+
+/* Base styles for the entire tooltip */
+[data-tooltip]:before,
+[data-tooltip]:after,
+.tooltip:before,
+.tooltip:after {
+ position: absolute;
+ visibility: hidden;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
+ opacity: 0;
+ -webkit-transition:
+ opacity 0.2s ease-in-out,
+ visibility 0.2s ease-in-out,
+ -webkit-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
+ -moz-transition:
+ opacity 0.2s ease-in-out,
+ visibility 0.2s ease-in-out,
+ -moz-transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
+ transition:
+ opacity 0.2s ease-in-out,
+ visibility 0.2s ease-in-out,
+ transform 0.2s cubic-bezier(0.71, 1.7, 0.77, 1.24);
+ -webkit-transform: translate3d(0, 0, 0);
+ -moz-transform: translate3d(0, 0, 0);
+ transform: translate3d(0, 0, 0);
+ pointer-events: none;
+}
+
+/* Show the entire tooltip on hover and focus */
+[data-tooltip]:hover:before,
+[data-tooltip]:hover:after,
+[data-tooltip]:focus:before,
+[data-tooltip]:focus:after,
+.tooltip:hover:before,
+.tooltip:hover:after,
+.tooltip:focus:before,
+.tooltip:focus:after {
+ visibility: visible;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100);
+ opacity: 1;
+}
+
+/* Base styles for the tooltip's directional arrow */
+.tooltip:before,
+[data-tooltip]:before {
+ z-index: 1001;
+ border: 6px solid transparent;
+ background: transparent;
+ content: "";
+}
+
+/* Base styles for the tooltip's content area */
+.tooltip:after,
+[data-tooltip]:after {
+ z-index: 1000;
+ padding: 8px;
+ width: auto;
+ background-color: #DEE8F3;
+ background-color: rgba(222, 232, 243, 1.0);
+ color: #1B3E6F;
+ content: attr(data-tooltip);
+ font-size: 10px;
+ line-height: 1.2;
+ border-radius: 2px;
+}
+
+/* Directions */
+
+/* Top (default) */
+[data-tooltip]:before,
+[data-tooltip]:after,
+.tooltip:before,
+.tooltip:after,
+.tooltip-top:before,
+.tooltip-top:after {
+ bottom: 100%;
+ left: 50%;
+}
+
+[data-tooltip]:before,
+.tooltip:before,
+.tooltip-top:before {
+ margin-left: 0;
+ margin-bottom: -12px;
+
+ border-bottom-color: #DEE8F3;
+ border-bottom-color: rgba(222, 232, 243, 1.0);
+}
+
+/* Horizontally align top/bottom tooltips */
+[data-tooltip]:after,
+.tooltip:after,
+.tooltip-top:after {
+ margin-left: -50%;
+}
+
+[data-tooltip]:hover:before,
+[data-tooltip]:hover:after,
+[data-tooltip]:focus:before,
+[data-tooltip]:focus:after,
+.tooltip:hover:before,
+.tooltip:hover:after,
+.tooltip:focus:before,
+.tooltip:focus:after,
+.tooltip-top:hover:before,
+.tooltip-top:hover:after,
+.tooltip-top:focus:before,
+.tooltip-top:focus:after {
+ -webkit-transform: translateY(-12px);
+ -moz-transform: translateY(-12px);
+ transform: translateY(-12px);
+}
+
+/* Left */
+.tooltip-left:before,
+.tooltip-left:after {
+ right: 100%;
+ bottom: 50%;
+ left: auto;
+}
+
+.tooltip-left:before {
+ margin-left: 0;
+ margin-right: -12px;
+ margin-bottom: 0;
+ border-top-color: transparent;
+ border-left-color: #000;
+ border-left-color: hsla(0, 0%, 20%, 0.9);
+}
+
+.tooltip-left:hover:before,
+.tooltip-left:hover:after,
+.tooltip-left:focus:before,
+.tooltip-left:focus:after {
+ -webkit-transform: translateX(-12px);
+ -moz-transform: translateX(-12px);
+ transform: translateX(-12px);
+}
+
+/* Bottom */
+.tooltip-bottom:before,
+.tooltip-bottom:after {
+ top: 100%;
+ bottom: auto;
+ left: 20%;
+}
+
+.tooltip-bottom:before {
+ margin-top: -12px;
+ margin-bottom: 0;
+ border-top-color: transparent;
+ border-bottom-color: #DEE8F3;
+ border-bottom-color: rgba(222, 232, 243, 1.0);
+}
+
+.tooltip-bottom:hover:before,
+.tooltip-bottom:hover:after,
+.tooltip-bottom:focus:before,
+.tooltip-bottom:focus:after {
+ -webkit-transform: translateY(12px);
+ -moz-transform: translateY(12px);
+ transform: translateY(12px);
+}
+
+/* Right */
+.tooltip-right:before,
+.tooltip-right:after {
+ bottom: 50%;
+ left: 20%;
+}
+
+.tooltip-right:before {
+ margin-bottom: 0;
+ margin-left: -12px;
+ border-top-color: transparent;
+ border-right-color: #000;
+ border-right-color: hsla(0, 0%, 20%, 0.9);
+}
+
+.tooltip-right:hover:before,
+.tooltip-right:hover:after,
+.tooltip-right:focus:before,
+.tooltip-right:focus:after {
+ -webkit-transform: translateX(12px);
+ -moz-transform: translateX(12px);
+ transform: translateX(12px);
+}
+
+/* Move directional arrows down a bit for left/right tooltips */
+.tooltip-left:before,
+.tooltip-right:before {
+ top: 3px;
+}
+
+/* Vertically center tooltip content for left/right tooltips */
+.tooltip-left:after,
+.tooltip-right:after {
+ margin-left: 0;
+ margin-bottom: -16px;
+}
+/* Extra small devices (portrait phones, less than 576px) */
+@media (max-width: 575.98px) {
+ .page-title{
+ padding: 18px;
+ }
+}
+
+/* Small devices (landscape phones, 576px and up) */
+@media (min-width: 576px) and (max-width: 767.98px) {
+
+}
+
+/* Medium devices (tablets, 768px and up) */
+@media (min-width: 768px) and (max-width: 991.98px) {
+
+}
+
+/* Large devices (desktops, 992px and up) */
+@media (min-width: 992px) and (max-width: 1199.98px) {
+
+}
+
+/* Extra large devices (large desktops, 1200px and up) */
+@media (min-width: 1200px) {
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cds-ui/client-frankfurt/src/test.ts b/cds-ui/designer-client/src/test.ts
index 900b9ec53..900b9ec53 100644
--- a/cds-ui/client-frankfurt/src/test.ts
+++ b/cds-ui/designer-client/src/test.ts
diff --git a/cds-ui/client-frankfurt/tsconfig.app.json b/cds-ui/designer-client/tsconfig.app.json
index 565a11a21..565a11a21 100644
--- a/cds-ui/client-frankfurt/tsconfig.app.json
+++ b/cds-ui/designer-client/tsconfig.app.json
diff --git a/cds-ui/client-frankfurt/tsconfig.json b/cds-ui/designer-client/tsconfig.json
index 30956ae7e..30956ae7e 100644
--- a/cds-ui/client-frankfurt/tsconfig.json
+++ b/cds-ui/designer-client/tsconfig.json
diff --git a/cds-ui/client-frankfurt/tsconfig.spec.json b/cds-ui/designer-client/tsconfig.spec.json
index 6400fde7d..6400fde7d 100644
--- a/cds-ui/client-frankfurt/tsconfig.spec.json
+++ b/cds-ui/designer-client/tsconfig.spec.json
diff --git a/cds-ui/client-frankfurt/tslint.json b/cds-ui/designer-client/tslint.json
index c8d70f152..c8d70f152 100644
--- a/cds-ui/client-frankfurt/tslint.json
+++ b/cds-ui/designer-client/tslint.json
diff --git a/cds-ui/server/pom.xml b/cds-ui/server/pom.xml
index fee5c27f4..642012ed5 100644
--- a/cds-ui/server/pom.xml
+++ b/cds-ui/server/pom.xml
@@ -58,7 +58,7 @@ limitations under the License.
<configuration>
<artifactItems>
<artifactItem>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>blueprint-proto</artifactId>
<version>${project.version}</version>
<type>jar</type>
diff --git a/cds-ui/server/src/controllers/data-dictionary.controller.ts b/cds-ui/server/src/controllers/data-dictionary.controller.ts
index eab0bc50c..076d714c6 100644
--- a/cds-ui/server/src/controllers/data-dictionary.controller.ts
+++ b/cds-ui/server/src/controllers/data-dictionary.controller.ts
@@ -96,6 +96,9 @@ export class DataDictionaryController {
return await this.rdservice.getModelType(source);
}
+ /**
+ * @deprecated use getResourceDictionaryByType Instead.
+ */
@get('/resourcedictionary/model-type/by-definition/data_type', {
responses: {
'200': {
@@ -104,6 +107,19 @@ export class DataDictionaryController {
},
})
async getDataTypes() {
+ console.warn("Calling deprecated function!");
return await this.rdservice.getDataTypes();
}
+
+ @get('/resourcedictionary/model-type/by-definition/{type}', {
+ responses: {
+ '200': {
+ content: {'application/json': {}},
+ },
+ },
+ })
+ async getResourceDictionaryByType(@param.path.string('type') type: string) {
+ return await this.rdservice.getResourceDictionaryByType(type);
+ }
+
}
diff --git a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
index f839bb225..7373d069e 100644
--- a/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
+++ b/cds-ui/server/src/datasources/resource-dictionary.datasource-template.ts
@@ -119,6 +119,22 @@ export default {
"getDataTypes": []
}
+ },
+ {
+ "template": {
+ "method": "GET",
+ "url": processorApiConfig.http.url + "/model-type/by-definition/{type}",
+ "headers": {
+ "accepts": "application/json",
+ "content-type": "application/json",
+ "authorization": processorApiConfig.http.authToken
+ },
+ "responsePath": "$.*"
+ },
+ "functions": {
+ "getResourceDictionaryByType": ["type"]
+
+ }
}
]
-}; \ No newline at end of file
+};
diff --git a/cds-ui/server/src/services/resource-dictionary.service.ts b/cds-ui/server/src/services/resource-dictionary.service.ts
index 8df22085c..a36c7fe75 100644
--- a/cds-ui/server/src/services/resource-dictionary.service.ts
+++ b/cds-ui/server/src/services/resource-dictionary.service.ts
@@ -7,9 +7,10 @@ export interface ResourceDictionaryService {
getSourceMapping(): Promise<JSON>;
getByTags(tags: string): Promise<JSON>;
save(resourceDictionary: JSON): Promise<JSON>;
- searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
+ searchbyNames(resourceDictionaryList: JSON): Promise<JSON>;
getModelType(source: string): Promise<JSON>;
getDataTypes(): Promise<JSON>;
+ getResourceDictionaryByType(type: string): Promise<JSON>;
}
export class ResourceDictionaryServiceProvider implements Provider<ResourceDictionaryService> {
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json
new file mode 100644
index 000000000..6909d20bc
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json
@@ -0,0 +1,66 @@
+{
+ "description": "Generic Remote Script Component Executor",
+ "version": "1.0.0",
+ "attributes": {
+ "response-data": {
+ "description": "Remote executed response data.",
+ "required": false,
+ "type": "json"
+ },
+ "status": {
+ "description": "Remote execution status.",
+ "required": true,
+ "type": "string"
+ }
+ },
+ "interfaces": {
+ "ComponentRemoteScriptExecutor": {
+ "operations": {
+ "process": {
+ "description": "ComponentRemoteScriptExecutor Operation",
+ "inputs": {
+ "blueprint-version": {
+ "description": "Blueprint version.",
+ "required": true,
+ "type": "string"
+ },
+ "blueprint-name": {
+ "description": "Blueprint name.",
+ "required": true,
+ "type": "string"
+ },
+ "selector": {
+ "description": "Remote GRPC selector or DSL reference or GRPC Json config.",
+ "required": true,
+ "type": "json"
+ },
+ "blueprint-action": {
+ "description": "Blueprint action name.",
+ "required": true,
+ "type": "string"
+ },
+ "timeout": {
+ "description": "Remote execution timeout in sec.",
+ "required": true,
+ "type": "integer",
+ "default": 180
+ },
+ "request-data": {
+ "description": "Dynamic Json Content or DSL Json reference.",
+ "required": false,
+ "type": "json"
+ }
+ },
+ "outputs": {
+ "status": {
+ "description": "Status of the Component Execution ( success or failure )",
+ "required": true,
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "derived_from": "tosca.nodes.Component"
+}
diff --git a/ms/blueprintsprocessor/application/pom.xml b/ms/blueprintsprocessor/application/pom.xml
index 138eecba5..f4d784bd3 100755
--- a/ms/blueprintsprocessor/application/pom.xml
+++ b/ms/blueprintsprocessor/application/pom.xml
@@ -47,9 +47,9 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- <exclusions>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
+ <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
@@ -84,7 +84,7 @@
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>configs-api</artifactId>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>health-api</artifactId>
<version>0.7.0-SNAPSHOT</version>
diff --git a/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml
index 27f72b59b..0ff04bf3a 100755
--- a/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml
+++ b/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml
@@ -5,20 +5,21 @@ services:
image: mariadb:latest
container_name: ccsdk-mariadb
ports:
- - "3306:3306"
+ - "3306:3306"
volumes:
- - ~/vm_mysql:/var/lib/mysql
+ - ~/vm_mysql:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: sdnctl
MYSQL_DATABASE: sdnctl
MYSQL_USER: sdnctl
MYSQL_PASSWORD: sdnctl
- blueprints-processor:
+ cds-controller-default:
depends_on:
- db
image: onap/ccsdk-blueprintsprocessor:latest
- container_name: bp-processor
+ container_name: cds-controller-default
+ hostname: cds-controller-default
ports:
- "8000:8080"
- "9111:9111"
@@ -26,7 +27,7 @@ services:
volumes:
- blueprints-deploy:/opt/app/onap/blueprints/deploy
environment:
- APPLICATIONNAME: BlueprintsProcessor
+ APPLICATIONNAME: cds-controller
BUNDLEVERSION: 1.0.0
APP_CONFIG_HOME: /opt/app/onap/config
STICKYSELECTORKEY:
@@ -41,28 +42,25 @@ services:
restart: always
volumes:
- blueprints-deploy:/opt/app/onap/blueprints/deploy
- py-executor:
+ py-executor-default:
depends_on:
- db
- image: onap/ccsdk-py-script-executor
- container_name: bp-py-executor
+ image: onap/ccsdk-py-executor
+ container_name: py-executor-default
+ hostname: py-executor-default
ports:
- "50052:50052"
restart: always
volumes:
- blueprints-deploy:/opt/app/onap/blueprints/deploy
environment:
- APPLICATIONNAME: PythonExecutor
+ APPLICATIONNAME: py-executor
BUNDLEVERSION: 1.0.0
APP_CONFIG_HOME: /opt/app/onap/config
STICKYSELECTORKEY:
ENVCONTEXT: dev
APP_PORT: 50052
- #AUTH_TYPE: basic-auth
- #AUTH_TOKEN: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
AUTH_TYPE: tls-auth
- AUTH_CERT_CHAIN: /opt/app/onap/python/py-executor-chain.pem
- AUTH_PRIVATE_KEY: /opt/app/onap/python/py-executor-key.pem
LOG_FILE: /opt/app/onap/logs/application.log
volumes:
diff --git a/ms/blueprintsprocessor/application/src/main/docker/distribution.xml b/ms/blueprintsprocessor/application/src/main/docker/distribution.xml
index aed417581..291dca09b 100755
--- a/ms/blueprintsprocessor/application/src/main/docker/distribution.xml
+++ b/ms/blueprintsprocessor/application/src/main/docker/distribution.xml
@@ -45,6 +45,11 @@
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
+ <directory>${project.basedir}/src/main/resources/certs</directory>
+ <outputDirectory>opt/app/onap/config/certs</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
<directory>${project.basedir}/../../../components/model-catalog</directory>
<outputDirectory>opt/app/onap/model-catalog</outputDirectory>
<includes>
diff --git a/ms/blueprintsprocessor/application/src/main/docker/startService.sh b/ms/blueprintsprocessor/application/src/main/docker/startService.sh
index 11c471f2d..7dcb5ff16 100644
--- a/ms/blueprintsprocessor/application/src/main/docker/startService.sh
+++ b/ms/blueprintsprocessor/application/src/main/docker/startService.sh
@@ -16,6 +16,6 @@ exec java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sour
-Dms_name=org.onap.ccsdk.cds.blueprintsprocessor \
-Dlogging.config=${APP_CONFIG_HOME}/logback.xml \
-Djava.security.egd=file:/dev/./urandom \
--DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
+-DAPPNAME=${APPLICATIONNAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
-Dspring.config.location=${APP_CONFIG_HOME}/ \
org.onap.ccsdk.cds.blueprintsprocessor.BlueprintProcessorApplicationKt
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
new file mode 100644
index 000000000..58464cb10
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintDatabaseConfiguration.kt
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.controllerblueprints", "org.onap.ccsdk.cds.blueprintsprocessor"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class BlueprintDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt
index 2d39eaa1f..bfde39aa0 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintGRPCServer.kt
@@ -30,10 +30,12 @@ import org.springframework.stereotype.Component
@ConditionalOnProperty(name = ["blueprintsprocessor.grpcEnable"], havingValue = "true")
@Component
-open class BlueprintGRPCServer(private val bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler,
- private val bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler,
- private val authInterceptor: BasicAuthServerInterceptor)
- : ApplicationListener<ContextRefreshedEvent> {
+open class BlueprintGRPCServer(
+ private val bluePrintProcessingGRPCHandler: BluePrintProcessingGRPCHandler,
+ private val bluePrintManagementGRPCHandler: BluePrintManagementGRPCHandler,
+ private val authInterceptor: BasicAuthServerInterceptor
+) :
+ ApplicationListener<ContextRefreshedEvent> {
private val log = logger(BlueprintGRPCServer::class)
@@ -44,12 +46,12 @@ open class BlueprintGRPCServer(private val bluePrintProcessingGRPCHandler: BlueP
try {
log.info("Starting Blueprint Processor GRPC Starting..")
val server = ServerBuilder
- .forPort(grpcPort!!)
- .intercept(GrpcServerLoggingInterceptor())
- .intercept(authInterceptor)
- .addService(bluePrintProcessingGRPCHandler)
- .addService(bluePrintManagementGRPCHandler)
- .build()
+ .forPort(grpcPort!!)
+ .intercept(GrpcServerLoggingInterceptor())
+ .intercept(authInterceptor)
+ .addService(bluePrintProcessingGRPCHandler)
+ .addService(bluePrintManagementGRPCHandler)
+ .build()
server.start()
log.info("Blueprint Processor GRPC server started and ready to serve on port({})...", server.port)
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt
index 4251fb5cb..f152e307f 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/BlueprintHttpServer.kt
@@ -30,4 +30,4 @@ open class BlueprintHttpServer : WebServerFactoryCustomizer<NettyReactiveWebServ
override fun customize(serverFactory: NettyReactiveWebServerFactory) {
serverFactory.port = httpPort!!
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt
index a8ee57d9d..243533b66 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/SwaggerConfig.kt
@@ -33,28 +33,29 @@ import springfox.documentation.spring.web.plugins.Docket
* @author Brinda Santh
*/
@Configuration
-//@EnableSwagger2WebFlux
+// @EnableSwagger2WebFlux
open class SwaggerConfig {
@Bean
open fun api(): Docket {
return Docket(DocumentationType.SWAGGER_2)
- .select()
- .apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
- .paths(PathSelectors.any())
- .build()
- .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.withClassAnnotation(Api::class.java))
+ .paths(PathSelectors.any())
+ .build()
+ .apiInfo(apiInfo())
}
private fun apiInfo(): ApiInfo {
return ApiInfo(
- "CDS Blueprints Processor APIs",
- "Provide APIs to interact with CBA, their resolved resources and templates, and stored resource configurations.",
- "0.7.0",
- null,
- Contact("CCSDK Team", "www.onap.org", "onap-discuss@lists.onap.org"),
- "Apache 2.0",
- "http://www.apache.org/licenses/LICENSE-2.0",
- emptyList())
+ "CDS Blueprints Processor APIs",
+ "Provide APIs to interact with CBA, their resolved resources and templates, and stored resource configurations.",
+ "0.7.0",
+ null,
+ Contact("CCSDK Team", "www.onap.org", "onap-discuss@lists.onap.org"),
+ "Apache 2.0",
+ "http://www.apache.org/licenses/LICENSE-2.0",
+ emptyList()
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt
index 5b12d8df7..d2d01cc64 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/WebConfig.kt
@@ -34,36 +34,38 @@ import org.springframework.web.reactive.config.WebFluxConfigurer
* @author Brinda Santh
*/
@Configuration
-open class WebConfig(private val authenticationManager: AuthenticationManager,
- private val securityContextRepository: SecurityContextRepository) : WebFluxConfigurer {
+open class WebConfig(
+ private val authenticationManager: AuthenticationManager,
+ private val securityContextRepository: SecurityContextRepository
+) : WebFluxConfigurer {
override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
registry.addResourceHandler("/swagger-ui.html**")
- .addResourceLocations("classpath:/META-INF/resources/")
+ .addResourceLocations("classpath:/META-INF/resources/")
registry.addResourceHandler("/webjars/**")
- .addResourceLocations("classpath:/META-INF/resources/webjars/")
+ .addResourceLocations("classpath:/META-INF/resources/webjars/")
}
override fun addCorsMappings(corsRegistry: CorsRegistry) {
corsRegistry.addMapping("/**")
- .allowedOrigins("*")
- .allowedMethods("*")
- .allowedHeaders("*")
- .maxAge(3600)
+ .allowedOrigins("*")
+ .allowedMethods("*")
+ .allowedHeaders("*")
+ .maxAge(3600)
}
@Bean
open fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
return http.csrf().disable()
- .formLogin().disable()
- .httpBasic().disable()
- .authenticationManager(authenticationManager)
- .securityContextRepository(securityContextRepository!!)
- .authorizeExchange()
- .pathMatchers(HttpMethod.OPTIONS).permitAll()
- .anyExchange().authenticated()
- .and().build()
+ .formLogin().disable()
+ .httpBasic().disable()
+ .authenticationManager(authenticationManager)
+ .securityContextRepository(securityContextRepository!!)
+ .authorizeExchange()
+ .pathMatchers(HttpMethod.OPTIONS).permitAll()
+ .anyExchange().authenticated()
+ .and().build()
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
index 66a19b2c5..8fcffbf06 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
@@ -16,9 +16,11 @@
package org.onap.ccsdk.cds.blueprintsprocessor.actuator.indicator
+import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BluePrintProcessorHealthCheck
+import org.slf4j.LoggerFactory
import org.springframework.boot.actuate.health.AbstractHealthIndicator
import org.springframework.boot.actuate.health.Health
import org.springframework.stereotype.Component
@@ -29,19 +31,26 @@ import org.springframework.stereotype.Component
* @version 1.0
*/
@Component
-open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck)
- : AbstractHealthIndicator() {
+open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck) :
+ AbstractHealthIndicator() {
+
+ private var logger = LoggerFactory.getLogger(BluePrintCustomIndicator::class.java)
@Throws(Exception::class)
override fun doHealthCheck(builder: Health.Builder) {
- var result: HealthApiResponse? = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
- if (result?.status == HealthCheckStatus.UP) {
- builder.up()
- } else {
- builder.down()
+ runBlocking {
+ var result: HealthApiResponse? = null
+ try {
+ result = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
+ if (result?.status == HealthCheckStatus.UP) {
+ builder.up()
+ } else {
+ builder.down()
+ }
+ builder.withDetail("Services", result?.checks)
+ } catch (exception: IllegalArgumentException) {
+ logger.error(exception.message)
+ }
}
- builder.withDetail("Services", result?.checks)
}
-
-
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt
index 933425bc3..d9674d5b8 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/AuthenticationManager.kt
@@ -23,8 +23,8 @@ import org.springframework.security.core.AuthenticationException
import reactor.core.publisher.Mono
@Configuration
-open class AuthenticationManager(private val authenticationProvider: AuthenticationProvider)
- : ReactiveAuthenticationManager {
+open class AuthenticationManager(private val authenticationProvider: AuthenticationProvider) :
+ ReactiveAuthenticationManager {
override fun authenticate(authentication: Authentication): Mono<Authentication> {
try {
@@ -32,6 +32,5 @@ open class AuthenticationManager(private val authenticationProvider: Authenticat
} catch (e: AuthenticationException) {
return Mono.error(e)
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt
index a0a4ae297..ab9ee29df 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/BasicAuthServerInterceptor.kt
@@ -15,7 +15,11 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.security
-import io.grpc.*
+import io.grpc.Metadata
+import io.grpc.ServerCall
+import io.grpc.ServerCallHandler
+import io.grpc.ServerInterceptor
+import io.grpc.Status
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.springframework.security.authentication.BadCredentialsException
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
@@ -23,23 +27,24 @@ import org.springframework.security.core.AuthenticationException
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.stereotype.Component
import java.nio.charset.StandardCharsets
-import java.util.*
+import java.util.Base64
@Component
-class BasicAuthServerInterceptor(private val authenticationManager: AuthenticationManager)
- : ServerInterceptor {
+class BasicAuthServerInterceptor(private val authenticationManager: AuthenticationManager) :
+ ServerInterceptor {
private val log = logger(BasicAuthServerInterceptor::class)
override fun <ReqT, RespT> interceptCall(
- call: ServerCall<ReqT, RespT>,
- headers: Metadata,
- next: ServerCallHandler<ReqT, RespT>): ServerCall.Listener<ReqT> {
+ call: ServerCall<ReqT, RespT>,
+ headers: Metadata,
+ next: ServerCallHandler<ReqT, RespT>
+ ): ServerCall.Listener<ReqT> {
val authHeader = headers.get(Metadata.Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER))
if (authHeader.isNullOrEmpty()) {
throw Status.UNAUTHENTICATED.withDescription("Missing required authentication")
- .asRuntimeException()
+ .asRuntimeException()
}
try {
@@ -54,7 +59,6 @@ class BasicAuthServerInterceptor(private val authenticationManager: Authenticati
log.info("Authentication success: {}", authResult)
SecurityContextHolder.getContext().authentication = authResult
-
} catch (e: AuthenticationException) {
SecurityContextHolder.clearContext()
@@ -69,8 +73,10 @@ class BasicAuthServerInterceptor(private val authenticationManager: Authenticati
private fun decodeBasicAuth(authHeader: String): Array<String> {
val basicAuth: String
try {
- basicAuth = String(Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
- StandardCharsets.UTF_8)
+ basicAuth = String(
+ Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
+ StandardCharsets.UTF_8
+ )
} catch (e: IllegalArgumentException) {
throw BadCredentialsException("Failed to decode basic authentication token")
} catch (e: IndexOutOfBoundsException) {
@@ -84,4 +90,4 @@ class BasicAuthServerInterceptor(private val authenticationManager: Authenticati
return arrayOf(basicAuth.substring(0, delim), basicAuth.substring(delim + 1))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt
index 70b0df2d1..29ec27daa 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityConfiguration.kt
@@ -38,8 +38,10 @@ open class SecurityConfiguration {
@Bean
open fun inMemoryUserService(): UserDetailsService {
- val user = User(username, password,
- listOf(SimpleGrantedAuthority("USER")))
+ val user = User(
+ username, password,
+ listOf(SimpleGrantedAuthority("USER"))
+ )
return InMemoryUserDetailsManager(user)
}
@@ -54,4 +56,4 @@ open class SecurityConfiguration {
provider.setUserDetailsService(inMemoryUserService())
return provider
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt
index f1c362f57..d646c2ee5 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/security/SecurityContextRepository.kt
@@ -25,11 +25,11 @@ import org.springframework.stereotype.Component
import org.springframework.web.server.ServerWebExchange
import reactor.core.publisher.Mono
import java.nio.charset.StandardCharsets
-import java.util.*
+import java.util.Base64
@Component
-class SecurityContextRepository(private val authenticationManager: AuthenticationManager)
- : ServerSecurityContextRepository {
+class SecurityContextRepository(private val authenticationManager: AuthenticationManager) :
+ ServerSecurityContextRepository {
override fun save(swe: ServerWebExchange, sc: SecurityContext): Mono<Void> {
throw UnsupportedOperationException("Not supported.")
@@ -44,7 +44,7 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
val password = tokens[1]
val auth = UsernamePasswordAuthenticationToken(username, password)
return this.authenticationManager!!.authenticate(auth)
- .map { SecurityContextImpl(it) }
+ .map { SecurityContextImpl(it) }
} else {
return Mono.empty()
}
@@ -53,8 +53,10 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
private fun decodeBasicAuth(authHeader: String): Array<String> {
val basicAuth: String
try {
- basicAuth = String(Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
- StandardCharsets.UTF_8)
+ basicAuth = String(
+ Base64.getDecoder().decode(authHeader.substring(6).toByteArray(StandardCharsets.UTF_8)),
+ StandardCharsets.UTF_8
+ )
} catch (e: IllegalArgumentException) {
throw BadCredentialsException("Failed to decode basic authentication token")
} catch (e: IndexOutOfBoundsException) {
@@ -68,4 +70,4 @@ class SecurityContextRepository(private val authenticationManager: Authenticatio
return arrayOf(basicAuth.substring(0, delim), basicAuth.substring(delim + 1))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt
index 1a625c279..c5821bed1 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/JsonNormalizer.kt
@@ -52,10 +52,10 @@ internal class JsonNormalizer {
private fun expandJstlSpec(jstlSpec: JsonNode): String {
val extendedJstlSpec = updateObjectNodes(jstlSpec, "*", ".")
return extendedJstlSpec.toString()
- // Handle the "?" as a prefix to literal/non-quoted values
- .replace("\"\\?([^\"]+)\"".toRegex(), "$1")
- // Also, remove the quotes added by Jackson for key and value of the wildcard matcher
- .replace("\"([.*])\"".toRegex(), "$1")
+ // Handle the "?" as a prefix to literal/non-quoted values
+ .replace("\"\\?([^\"]+)\"".toRegex(), "$1")
+ // Also, remove the quotes added by Jackson for key and value of the wildcard matcher
+ .replace("\"([.*])\"".toRegex(), "$1")
}
/**
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt
index 6b1b0c676..710a65c6f 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/PathDeserializer.kt
@@ -49,4 +49,4 @@ internal class PathDeserializer : StdDeserializer<String>(String::class.java) {
}
return flatJoinTo(StringBuilder(), path).toString()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MoreMatchers.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt
index 163544fc9..163544fc9 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/MoreMatchers.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/RequiredMapEntriesMatcher.kt
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt
index 3046f1041..cc7ac69f0 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatDefinition.kt
@@ -30,34 +30,45 @@ import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.nodes.Tag
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class ProcessDefinition(val name: String, val request: JsonNode, val expectedResponse: JsonNode? = null,
- val responseNormalizerSpec: JsonNode? = null)
+data class ProcessDefinition(
+ val name: String,
+ val request: JsonNode,
+ val expectedResponse: JsonNode? = null,
+ val responseNormalizerSpec: JsonNode? = null
+)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class RequestDefinition(val method: String,
- @JsonDeserialize(using = PathDeserializer::class)
- val path: String,
- val headers: Map<String, String> = emptyMap(),
- val body: JsonNode? = null)
+data class RequestDefinition(
+ val method: String,
+ @JsonDeserialize(using = PathDeserializer::class)
+ val path: String,
+ val headers: Map<String, String> = emptyMap(),
+ val body: JsonNode? = null
+)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
data class ResponseDefinition(val status: Int = 200, val body: JsonNode? = null) {
+
companion object {
val DEFAULT_RESPONSE = ResponseDefinition()
}
}
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class ExpectationDefinition(val request: RequestDefinition,
- val response: ResponseDefinition = ResponseDefinition.DEFAULT_RESPONSE)
+data class ExpectationDefinition(
+ val request: RequestDefinition,
+ val response: ResponseDefinition = ResponseDefinition.DEFAULT_RESPONSE
+)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
data class ServiceDefinition(val selector: String, val expectations: List<ExpectationDefinition>)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
-data class UatDefinition(val processes: List<ProcessDefinition>,
- @JsonAlias("external-services")
- val externalServices: List<ServiceDefinition> = emptyList()) {
+data class UatDefinition(
+ val processes: List<ProcessDefinition>,
+ @JsonAlias("external-services")
+ val externalServices: List<ServiceDefinition> = emptyList()
+) {
fun dump(mapper: ObjectMapper, excludedProperties: List<String> = emptyList()): String {
val uatAsMap: Map<String, Any> = mapper.convertValue(this)
@@ -86,7 +97,6 @@ data class UatDefinition(val processes: List<ProcessDefinition>,
companion object {
fun load(mapper: ObjectMapper, spec: String): UatDefinition =
- mapper.convertValue(Yaml().load(spec), UatDefinition::class.java)
-
+ mapper.convertValue(Yaml().load(spec), UatDefinition::class.java)
}
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
index 4e97460d3..89ba1500b 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatExecutor.kt
@@ -70,9 +70,9 @@ import java.util.concurrent.ConcurrentHashMap
*/
@Component
class UatExecutor(
- private val environment: ConfigurableEnvironment,
- private val restClientFactory: BluePrintRestLibPropertyService,
- private val mapper: ObjectMapper
+ private val environment: ConfigurableEnvironment,
+ private val restClientFactory: BluePrintRestLibPropertyService,
+ private val mapper: ObjectMapper
) {
companion object {
@@ -103,8 +103,8 @@ class UatExecutor(
fun execute(uat: UatDefinition, cbaBytes: ByteArray): UatDefinition {
val defaultHeaders = listOf(BasicHeader(HttpHeaders.AUTHORIZATION, clientAuthToken()))
val httpClient = HttpClientBuilder.create()
- .setDefaultHeaders(defaultHeaders)
- .build()
+ .setDefaultHeaders(defaultHeaders)
+ .build()
// Only if externalServices are defined
val mockInterceptor = MockPreInterceptor()
// Always defined and used, whatever the case
@@ -113,13 +113,13 @@ class UatExecutor(
try {
// Configure mocked external services and save their expected requests for further validation
val requestsPerClient = uat.externalServices.associateBy(
- { service ->
- createRestClientMock(service.expectations).also { restClient ->
- // side-effect: register restClient to override real instance
- mockInterceptor.registerMock(service.selector, restClient)
- }
- },
- { service -> service.expectations.map { it.request } }
+ { service ->
+ createRestClientMock(service.expectations).also { restClient ->
+ // side-effect: register restClient to override real instance
+ mockInterceptor.registerMock(service.selector, restClient)
+ }
+ },
+ { service -> service.expectations.map { it.request } }
)
val newProcesses = httpClient.use { client ->
@@ -129,8 +129,10 @@ class UatExecutor(
uat.processes.map { process ->
log.info("Executing process '${process.name}'")
val responseNormalizer = JsonNormalizer.getNormalizer(mapper, process.responseNormalizerSpec)
- val actualResponse = processBlueprint(client, process.request,
- process.expectedResponse, responseNormalizer)
+ val actualResponse = processBlueprint(
+ client, process.request,
+ process.expectedResponse, responseNormalizer
+ )
ProcessDefinition(process.name, process.request, actualResponse, process.responseNormalizerSpec)
}
}
@@ -139,10 +141,11 @@ class UatExecutor(
for ((mockClient, requests) in requestsPerClient) {
requests.forEach { request ->
verify(mockClient, atLeastOnce()).exchangeResource(
- eq(request.method),
- eq(request.path),
- argThat { assertJsonEquals(request.body, this) },
- argThat(RequiredMapEntriesMatcher(request.headers)))
+ eq(request.method),
+ eq(request.path),
+ argThat { assertJsonEquals(request.body, this) },
+ argThat(RequiredMapEntriesMatcher(request.headers))
+ )
}
// Don't mind the invocations to the overloaded exchangeResource(String, String, String)
verify(mockClient, atLeast(0)).exchangeResource(any(), any(), any())
@@ -150,7 +153,7 @@ class UatExecutor(
}
val newExternalServices = spyInterceptor.getSpies()
- .map(SpyService::asServiceDefinition)
+ .map(SpyService::asServiceDefinition)
return UatDefinition(newProcesses, newExternalServices)
} finally {
@@ -158,29 +161,32 @@ class UatExecutor(
}
}
- private fun createRestClientMock(restExpectations: List<ExpectationDefinition>)
- : BlueprintWebClientService {
+ private fun createRestClientMock(restExpectations: List<ExpectationDefinition>):
+ BlueprintWebClientService {
val restClient = mock<BlueprintWebClientService>(
- defaultAnswer = Answers.RETURNS_SMART_NULLS,
- // our custom verboseLogging handler
- invocationListeners = arrayOf(mockLoggingListener)
+ defaultAnswer = Answers.RETURNS_SMART_NULLS,
+ // our custom verboseLogging handler
+ invocationListeners = arrayOf(mockLoggingListener)
)
// Delegates to overloaded exchangeResource(String, String, String, Map<String, String>)
whenever(restClient.exchangeResource(any(), any(), any()))
- .thenAnswer { invocation ->
- val method = invocation.arguments[0] as String
- val path = invocation.arguments[1] as String
- val request = invocation.arguments[2] as String
- restClient.exchangeResource(method, path, request, emptyMap())
- }
+ .thenAnswer { invocation ->
+ val method = invocation.arguments[0] as String
+ val path = invocation.arguments[1] as String
+ val request = invocation.arguments[2] as String
+ restClient.exchangeResource(method, path, request, emptyMap())
+ }
for (expectation in restExpectations) {
- whenever(restClient.exchangeResource(
+ whenever(
+ restClient.exchangeResource(
eq(expectation.request.method),
eq(expectation.request.path),
any(),
- any()))
- .thenReturn(WebClientResponse(expectation.response.status, expectation.response.body.toString()))
+ any()
+ )
+ )
+ .thenReturn(WebClientResponse(expectation.response.status, expectation.response.body.toString()))
}
return restClient
}
@@ -188,9 +194,9 @@ class UatExecutor(
@Throws(AssertionError::class)
private fun uploadBlueprint(client: HttpClient, cbaBytes: ByteArray) {
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("file", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("file", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .build()
val request = HttpPost("$baseUrl/api/v1/blueprint-model/publish").apply {
entity = multipartEntity
}
@@ -201,8 +207,12 @@ class UatExecutor(
}
@Throws(AssertionError::class)
- private fun processBlueprint(client: HttpClient, requestBody: JsonNode,
- expectedResponse: JsonNode?, responseNormalizer: (String) -> String): JsonNode {
+ private fun processBlueprint(
+ client: HttpClient,
+ requestBody: JsonNode,
+ expectedResponse: JsonNode?,
+ responseNormalizer: (String) -> String
+ ): JsonNode {
val stringEntity = StringEntity(mapper.writeValueAsString(requestBody), ContentType.APPLICATION_JSON)
val request = HttpPost("$baseUrl/api/v1/execution-service/process").apply {
entity = stringEntity
@@ -234,8 +244,8 @@ class UatExecutor(
}
private fun localServerPort(): Int =
- (environment.getProperty("local.server.port")
- ?: environment.getRequiredProperty("blueprint.httpPort")).toInt()
+ (environment.getProperty("local.server.port")
+ ?: environment.getRequiredProperty("blueprint.httpPort")).toInt()
private fun clientAuthToken(): String {
val username = environment.getRequiredProperty("security.user.name")
@@ -255,7 +265,7 @@ class UatExecutor(
}
override fun getInstance(selector: String): BlueprintWebClientService? =
- mocks[selector]
+ mocks[selector]
fun registerMock(selector: String, client: BlueprintWebClientService) {
mocks[selector] = client
@@ -277,21 +287,27 @@ class UatExecutor(
}
fun getSpies(): List<SpyService> =
- spies.values.toList()
+ spies.values.toList()
}
- private class SpyService(private val mapper: ObjectMapper,
- val selector: String,
- private val realService: BlueprintWebClientService) :
- BlueprintWebClientService by realService {
+ private class SpyService(
+ private val mapper: ObjectMapper,
+ val selector: String,
+ private val realService: BlueprintWebClientService
+ ) :
+ BlueprintWebClientService by realService {
private val expectations: MutableList<ExpectationDefinition> = mutableListOf()
override fun exchangeResource(methodType: String, path: String, request: String): WebClientResponse<String> =
- exchangeResource(methodType, path, request, DEFAULT_HEADERS)
-
- override fun exchangeResource(methodType: String, path: String, request: String,
- headers: Map<String, String>): WebClientResponse<String> {
+ exchangeResource(methodType, path, request, DEFAULT_HEADERS)
+
+ override fun exchangeResource(
+ methodType: String,
+ path: String,
+ request: String,
+ headers: Map<String, String>
+ ): WebClientResponse<String> {
val requestDefinition = RequestDefinition(methodType, path, headers, toJson(request))
val realAnswer = realService.exchangeResource(methodType, path, request, headers)
val responseBody = when {
@@ -309,7 +325,7 @@ class UatExecutor(
}
fun asServiceDefinition() =
- ServiceDefinition(selector, expectations)
+ ServiceDefinition(selector, expectations)
private fun toJson(str: String): JsonNode? {
return when {
@@ -320,9 +336,9 @@ class UatExecutor(
companion object {
private val DEFAULT_HEADERS = mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
+ HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+ HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt
index f133fd7c7..5b62f1296 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServices.kt
@@ -72,8 +72,10 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
@PostMapping("/spy", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE], produces = ["text/vnd.yaml"])
@PreAuthorize("hasRole('USER')")
@Suppress("BlockingMethodInNonBlockingContext")
- open fun spy(@RequestPart("cba") cbaFile: FilePart,
- @RequestPart("uat", required = false) uatFile: FilePart?): String = runBlocking {
+ open fun spy(
+ @RequestPart("cba") cbaFile: FilePart,
+ @RequestPart("uat", required = false) uatFile: FilePart?
+ ): String = runBlocking {
val tempFile = createTempFile()
setContextColor(COLOR_SERVICES)
try {
@@ -118,4 +120,4 @@ open class UatServices(private val uatExecutor: UatExecutor, private val mapper:
// Fields that can be safely ignored from BPP response, and can be omitted on the UAT specification.
private val FIELDS_TO_EXCLUDE = listOf("timestamp")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt
index 10139c839..9ae3ff805 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/ColorMarker.kt
@@ -21,4 +21,4 @@ package org.onap.ccsdk.cds.blueprintsprocessor.uat.logging
import org.slf4j.Marker
-class ColorMarker internal constructor(private val dlg: Marker) : Marker by dlg \ No newline at end of file
+class ColorMarker internal constructor(private val dlg: Marker) : Marker by dlg
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt
index dce516933..f0cba2670 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/LogColor.kt
@@ -41,5 +41,5 @@ object LogColor {
}
fun markerOf(color: String): ColorMarker =
- ColorMarker(MarkerFactory.getMarker(color))
+ ColorMarker(MarkerFactory.getMarker(color))
}
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
index d7b38d3fa..cad235450 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/logging/SmartColorDiscriminator.kt
@@ -35,7 +35,7 @@ class SmartColorDiscriminator : AbstractDiscriminator<ILoggingEvent>() {
}
override fun getDiscriminatingValue(e: ILoggingEvent): String =
- (e.marker as? ColorMarker)?.name
- ?: e.mdcPropertyMap?.get(MDC_COLOR_KEY)
- ?: defaultValue
-} \ No newline at end of file
+ (e.marker as? ColorMarker)?.name
+ ?: e.mdcPropertyMap?.get(MDC_COLOR_KEY)
+ ?: defaultValue
+}
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
index fc2e7f244..89b4f65b4 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application-dev.properties
@@ -57,6 +57,11 @@ blueprintsprocessor.grpcclient.remote-python.host=localhost
blueprintsprocessor.grpcclient.remote-python.port=50051
blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+# Py executor
+blueprintsprocessor.grpcclient.py-executor.type=tls-auth
+blueprintsprocessor.grpcclient.py-executor.host=localhost:50052
+blueprintsprocessor.grpcclient.py-executor.trustCertCollection=src/main/resources/certs/py-executor/py-executor-chain.pem
+
# Blueprint Processor File Execution and Handling Properties
### use absolute paths if testing inside docker
### blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy
diff --git a/ms/blueprintsprocessor/application/src/main/resources/application.properties b/ms/blueprintsprocessor/application/src/main/resources/application.properties
index bd713080f..1ba29e43a 100755
--- a/ms/blueprintsprocessor/application/src/main/resources/application.properties
+++ b/ms/blueprintsprocessor/application/src/main/resources/application.properties
@@ -77,6 +77,11 @@ blueprintsprocessor.grpcclient.remote-python.host=localhost
blueprintsprocessor.grpcclient.remote-python.port=50051
blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+# Py executor
+blueprintsprocessor.grpcclient.py-executor.type=tls-auth
+blueprintsprocessor.grpcclient.py-executor.host=py-executor-default:50052
+blueprintsprocessor.grpcclient.py-executor.trustCertCollection=/opt/app/onap/config/certs/py-executor/py-executor-chain.pem
+
# Config Data REST client settings
blueprintsprocessor.restconfEnabled=true
blueprintsprocessor.restclient.sdnc.type=basic-auth
diff --git a/ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem b/ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem
new file mode 100644
index 000000000..98c4f39ba
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/main/resources/certs/py-executor/py-executor-chain.pem
@@ -0,0 +1,37 @@
+-----BEGIN CERTIFICATE-----
+MIIGXTCCBEWgAwIBAgIJALA8s9WVhurtMA0GCSqGSIb3DQEBCwUAMH8xCzAJBgNV
+BAYTAlVTMRMwEQYDVQQIDApOZXcgSmVyc2V5MRMwEQYDVQQHDApNaWRkbGV0b3du
+MRcwFQYDVQQKDA5PTkFQIENvbW11bml0eTEOMAwGA1UEAwwFQ0NTREsxHTAbBgkq
+hkiG9w0BCQEWDmJzMjc5NkBhdHQuY29tMB4XDTE5MTEyOTIwNTUzNFoXDTI5MTEy
+NjIwNTUzNFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCk5ldyBKZXJzZXkxEzAR
+BgNVBAcMCk1pZGRsZXRvd24xFzAVBgNVBAoMDk9OQVAgQ29tbXVuaXR5MQ4wDAYD
+VQQDDAVDQ1NESzEdMBsGCSqGSIb3DQEJARYOYnMyNzk2QGF0dC5jb20wggIiMA0G
+CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDMb8yqD/lu3IHffa1H+LnCTKCijZDC
+85sPta8nH9cQxqRLJyjkOZs+K1z5i6Qn1AH8jOYqG1dRO0Y3pTqu0q5s5Q5Qg2ZF
+xZPW0772HL2Id1WAL62ymPcAp4/JPgeFqcVtRcxx+MPKTohjSY9l+cAPuAQ3izmz
+ValxYVvI8s3qRnvp9sjaOTm4vz/9/7mci9hDKn4B8K7u8fUPKkqYQOOaiv31rYVG
+sw7CIGvHGQMz89loWtB7A4ioZmveZdRdRs5kXbGwvuZQOnc6e8wYO211wkPEJ/go
+sulWwMqcwN9L6712g6ZnoFD+gtut+OLIlrZGS/5MEzMnvmX9NzXiKOP9Zp+Qj4jM
+3pa1pt33LxoBYux7r9154wi9kCXLI2XUTA5TbaufXv6/tn3R9fzMYEUeUdLeEEtr
+NBTEpviTaAxgkpLhGbrSd6F3wbvnBh/gPrBW/0HrAnpMuV5V8JFP1SrT2EbguaW5
+G4keckBMkcOPpz/qvYuXW2FD/XO5yz1keJqXs4HSSM0/ZYcNk89wn50I4GLUY0Q5
+hnk9Twdf8zglSRUDHLCrsA88wJXHBL6W6xVQjQFikY94YOVyvcqXvnmlhOhLamr2
+72bbjrVPvZw4nUYZeg/WpdalmpJb4M9MVLLFo11O150PRRUqnHTHHKGXv7C2mCAO
+MIEPr/WJpS50WwIDAQABo4HbMIHYMB0GA1UdDgQWBBT+kmcpEJ/kS/kW9rGc0uom
+T0VqBDAfBgNVHSMEGDAWgBT+kmcpEJ/kS/kW9rGc0uomT0VqBDAJBgNVHRMEAjAA
+MAsGA1UdDwQEAwIF4DATBgNVHSUEDDAKBggrBgEFBQcDATA7BgNVHREENDAyghBj
+ZHMtY29udHJvbGxlci0qgg1weS1leGVjdXRvci0qgglsb2NhbGhvc3SHBH8AAAEw
+LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMA0G
+CSqGSIb3DQEBCwUAA4ICAQCdquyIETbOWFtXpzL/SQ8jB0yzBmErA3vQPm847qSz
+r8QNXsEyPq7lo06xJTfhlmfpOBzCVdpP+/3pvJfKJ8/wC/D3B8E88Ozzz/yCZPuG
+SNcv+SSnki729ptc1bx6It0FQFahXGywm2ASHGMz4zfmMtnjIfBEuMBCD+V4liwr
+oCEw8E1d+fxArv72LMbNYxPQ+HfrasYhINgVnYSpftqIGpi0PGaEoCVrosQnB0Gk
+5kHWvTXqMC+G9Q1MSQk8vs3lnp9Y4gXbdeaMu3YSmM9nVAY1uZiZRBHVbMadIDFO
+NQmDBKfyN6uK3uBV1S84woC0o5iqIR5EF3u4NeCX5jRWR1Uu4zAG70TpcLmyP1do
+Kt49m9sVrxoCgzjzRd1yZ50BZ1/5550OeF55swQv/ncGriD8uxaQu49NbUo2Rw8R
+Af5TMMW9+0KN6zDOUIVfK5a6NGqnylN3drB2jIjGyTOVycm5paL+iuKEg7euxvZ8
+51Z6QWe3F3+wVYVWtDeN3/9FUm3FzonmZvoChYkz7NTifQpS7/46BpBa5DoblcUu
+MMXWMYieVv3wLIvtFFi2CoNh0tyD7TcNsAB4hLbbBxtXmAB82tgjQhOdkQErm+qi
+Gq5AwlI8k3hhkLDcWH4hUx4YTLJLdTeQGKyM6dB+NBZATyzOrY5j86j7vITLeG8t
+3w==
+-----END CERTIFICATE-----
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
index ec338f274..0ff5dc55d 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BaseUatTest.kt
@@ -33,10 +33,12 @@ import kotlin.test.BeforeTest
@RunWith(SpringRunner::class)
// Also set blueprintsprocessor.httpPort=0
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(initializers = [
- WorkingFoldersInitializer::class,
- TestSecuritySettings.ServerContextInitializer::class
-])
+@ContextConfiguration(
+ initializers = [
+ WorkingFoldersInitializer::class,
+ TestSecuritySettings.ServerContextInitializer::class
+ ]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
abstract class BaseUatTest {
@@ -53,4 +55,4 @@ abstract class BaseUatTest {
companion object {
const val UAT_BLUEPRINTS_BASE_DIR = "../../../components/model-catalog/blueprint-model/uat-blueprints"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
index fa550d1d0..ad97ce82a 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/BlueprintsAcceptanceTest.kt
@@ -38,8 +38,10 @@ import kotlin.test.Test
// Only one runner can be configured with jUnit 4. We had to replace the SpringRunner by equivalent jUnit rules.
// See more on https://docs.spring.io/autorepo/docs/spring-framework/current/spring-framework-reference/testing.html#testcontext-junit4-rules
@RunWith(Parameterized::class)
-class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: String, // readable test description
- private val rootFs: FileSystem) : BaseUatTest() {
+class BlueprintsAcceptanceTest(
+ @Suppress("unused") private val blueprintName: String, // readable test description
+ private val rootFs: FileSystem
+) : BaseUatTest() {
companion object {
@@ -55,14 +57,14 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St
@JvmStatic
fun scanUatEmpoweredBlueprints(): List<Array<Any>> {
return (File(UAT_BLUEPRINTS_BASE_DIR)
- .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
- ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR"))
- .map { file ->
- arrayOf(
- file.nameWithoutExtension,
- FileSystems.newFileSystem(file.canonicalFile.toPath(), null)
- )
- }
+ .listFiles { file -> file.isDirectory && File(file, UAT_SPECIFICATION_FILE).isFile }
+ ?: throw RuntimeException("Failed to scan $UAT_BLUEPRINTS_BASE_DIR"))
+ .map { file ->
+ arrayOf(
+ file.nameWithoutExtension,
+ FileSystems.newFileSystem(file.canonicalFile.toPath(), null)
+ )
+ }
}
}
@@ -91,4 +93,4 @@ class BlueprintsAcceptanceTest(@Suppress("unused") private val blueprintName: St
uatExecutor.execute(uatSpec, cbaBytes)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt
index 1c0067c36..c483d90b3 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/ExtendedTemporaryFolder.kt
@@ -21,8 +21,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.uat
import java.io.File
import java.io.IOException
-import java.nio.file.*
-import java.nio.file.attribute.*
+import java.nio.file.FileVisitResult
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.SimpleFileVisitor
+import java.nio.file.attribute.BasicFileAttributes
import javax.annotation.PreDestroy
class ExtendedTemporaryFolder {
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt
index 216df9aef..b0917cb7d 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/TestSecuritySettings.kt
@@ -30,14 +30,15 @@ class TestSecuritySettings {
private const val authPassword = "Heisenberg"
fun clientAuthToken() =
- "Basic " + Base64Utils.encodeToString("$authUsername:$authPassword".toByteArray())
+ "Basic " + Base64Utils.encodeToString("$authUsername:$authPassword".toByteArray())
}
class ServerContextInitializer : ApplicationContextInitializer<ConfigurableApplicationContext> {
override fun initialize(context: ConfigurableApplicationContext) {
- TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context,
- "security.user.name=$authUsername",
- "security.user.password={noop}$authPassword"
+ TestPropertySourceUtils.addInlinedPropertiesToEnvironment(
+ context,
+ "security.user.name=$authUsername",
+ "security.user.password={noop}$authPassword"
)
}
}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
index 78dc7099c..2df5f2940 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/UatServicesTest.kt
@@ -108,7 +108,7 @@ class UatServicesTest : BaseUatTest() {
}
private fun inlinedPropertySource(): MutableMap<String, Any> =
- (environment.propertySources[INLINED_PROPERTIES_PROPERTY_SOURCE_NAME] as MapPropertySource).source
+ (environment.propertySources[INLINED_PROPERTIES_PROPERTY_SOURCE_NAME] as MapPropertySource).source
@LocalServerPort
var localServerPort: Int = 0
@@ -122,11 +122,15 @@ class UatServicesTest : BaseUatTest() {
@BeforeTest
fun setupHttpClient() {
- val defaultHeaders = listOf(BasicHeader(org.apache.http.HttpHeaders.AUTHORIZATION,
- TestSecuritySettings.clientAuthToken()))
+ val defaultHeaders = listOf(
+ BasicHeader(
+ org.apache.http.HttpHeaders.AUTHORIZATION,
+ TestSecuritySettings.clientAuthToken()
+ )
+ )
httpClient = HttpClientBuilder.create()
- .setDefaultHeaders(defaultHeaders)
- .build()
+ .setDefaultHeaders(defaultHeaders)
+ .build()
}
@Test
@@ -134,9 +138,9 @@ class UatServicesTest : BaseUatTest() {
// GIVEN
val cbaBytes = compressToBytes(BLUEPRINT_BASE_DIR)
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .build()
val request = HttpPost("$baseUrl/api/v1/uat/verify").apply {
entity = multipartEntity
}
@@ -168,10 +172,10 @@ class UatServicesTest : BaseUatTest() {
val cbaBytes = compressToBytes(BLUEPRINT_BASE_DIR)
val multipartEntity = MultipartEntityBuilder.create()
- .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
- .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
- .addBinaryBody("uat", bareUatBytes, ContentType.DEFAULT_BINARY, "uat.yaml")
- .build()
+ .setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
+ .addBinaryBody("cba", cbaBytes, ContentType.DEFAULT_BINARY, "cba.zip")
+ .addBinaryBody("uat", bareUatBytes, ContentType.DEFAULT_BINARY, "uat.yaml")
+ .build()
val request = HttpPost("$baseUrl/api/v1/uat/spy").apply {
entity = multipartEntity
}
@@ -193,7 +197,8 @@ class UatServicesTest : BaseUatTest() {
}
private fun createMockServer(service: ServiceDefinition): WireMockServer {
- val mockServer = WireMockServer(wireMockConfig()
+ val mockServer = WireMockServer(
+ wireMockConfig()
.dynamicPort()
.notifier(MarkedSlf4jNotifier(wireMockMarker))
)
@@ -212,10 +217,10 @@ class UatServicesTest : BaseUatTest() {
}
val responseDefinitionBuilder: ResponseDefinitionBuilder = aResponse()
- .withStatus(response.status)
+ .withStatus(response.status)
if (response.body != null) {
responseDefinitionBuilder.withBody(mapper.writeValueAsBytes(response.body))
- .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
}
mappingBuilder.willReturn(responseDefinitionBuilder)
@@ -229,11 +234,11 @@ class UatServicesTest : BaseUatTest() {
val selector = service.selector
val httpPort = mockServer.port()
val properties = mapOf(
- "blueprintsprocessor.restclient.$selector.type" to "basic-auth",
- "blueprintsprocessor.restclient.$selector.url" to "http://localhost:$httpPort/",
- // TODO credentials should be validated
- "blueprintsprocessor.restclient.$selector.username" to "admin",
- "blueprintsprocessor.restclient.$selector.password" to "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
+ "blueprintsprocessor.restclient.$selector.type" to "basic-auth",
+ "blueprintsprocessor.restclient.$selector.url" to "http://localhost:$httpPort/",
+ // TODO credentials should be validated
+ "blueprintsprocessor.restclient.$selector.username" to "admin",
+ "blueprintsprocessor.restclient.$selector.password" to "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
)
setProperties(properties)
}
@@ -257,4 +262,4 @@ class UatServicesTest : BaseUatTest() {
val map: Map<String, Any> = Yaml().load(yaml)
return mapper.writeValueAsString(map)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt
index ab9ae31a0..3c1757432 100644
--- a/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt
+++ b/ms/blueprintsprocessor/application/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/uat/WorkingFoldersInitializer.kt
@@ -32,16 +32,20 @@ class WorkingFoldersInitializer : ApplicationContextInitializer<ConfigurableAppl
override fun initialize(context: ConfigurableApplicationContext) {
val tempFolder = ExtendedTemporaryFolder()
val properties = listOf("Deploy", "Archive", "Working")
- .map { "blueprintsprocessor.blueprint${it}Path=${tempFolder.newFolder(it)}" }
- .toTypedArray()
+ .map { "blueprintsprocessor.blueprint${it}Path=${tempFolder.newFolder(it)}" }
+ .toTypedArray()
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, *properties)
// Expose tempFolder as a bean so it can be accessed via DI
registerSingleton(context, "tempFolder", ExtendedTemporaryFolder::class.java, tempFolder)
}
@Suppress("SameParameterValue")
- private fun <T> registerSingleton(context: ConfigurableApplicationContext,
- beanName: String, beanClass: Class<T>, instance: T) {
+ private fun <T> registerSingleton(
+ context: ConfigurableApplicationContext,
+ beanName: String,
+ beanClass: Class<T>,
+ instance: T
+ ) {
val builder = BeanDefinitionBuilder.genericBeanDefinition(beanClass) { instance }
(context.beanFactory as BeanDefinitionRegistry).registerBeanDefinition(beanName, builder.beanDefinition)
}
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml b/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
index d40ae210f..6378cd48d 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/pom.xml
@@ -40,8 +40,8 @@
<artifactId>rest-lib</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
index 3a655ded7..9ea6034a8 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt
@@ -24,7 +24,12 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
+import org.onap.ccsdk.cds.controllerblueprints.core.isNullOrMissing
+import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
+import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
@@ -33,7 +38,7 @@ import org.springframework.http.HttpMethod
import org.springframework.stereotype.Component
import java.net.URI
import java.net.URLEncoder
-import java.util.*
+import java.util.NoSuchElementException
/**
* ComponentRemoteAnsibleExecutor
@@ -48,9 +53,11 @@ import java.util.*
*/
@Component("component-remote-ansible-executor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService,
- private val mapper: ObjectMapper)
- : AbstractComponentFunction() {
+open class ComponentRemoteAnsibleExecutor(
+ private val blueprintRestLibPropertyService: BluePrintRestLibPropertyService,
+ private val mapper: ObjectMapper
+) :
+ AbstractComponentFunction() {
// HTTP related constants
private val HTTP_SUCCESS = 200..202
@@ -98,7 +105,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
if (jtId.isNotEmpty()) {
runJobTemplateOnAWX(restClientService, jobTemplateName, jtId, workflowURIPrefix)
} else {
- val message = "Workflow/Job template ${jobTemplateName} does not exists"
+ val message = "Workflow/Job template $jobTemplateName does not exists"
log.error(message)
setNodeOutputErrors(ATTRIBUTE_EXEC_CMD_STATUS_ERROR, message)
}
@@ -108,7 +115,6 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
}
}
-
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
val message = "Error in ComponentRemoteAnsibleExecutor : ${runtimeException.message}"
log.error(message, runtimeException)
@@ -143,11 +149,16 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
/**
* Finds the job template ID based on the job template name provided in the request
*/
- private fun lookupJobTemplateIDByName(awxClient: BlueprintWebClientService, job_template_name: String?,
- workflowPrefix : String) : String {
- val encodedJTName = URI(null, null,
- "/api/v2/${workflowPrefix}job_templates/${job_template_name}/",
- null, null).rawPath
+ private fun lookupJobTemplateIDByName(
+ awxClient: BlueprintWebClientService,
+ job_template_name: String?,
+ workflowPrefix: String
+ ): String {
+ val encodedJTName = URI(
+ null, null,
+ "/api/v2/${workflowPrefix}job_templates/$job_template_name/",
+ null, null
+ ).rawPath
// Get Job Template details by name
var response = awxClient.exchangeResource(GET, encodedJTName, "")
@@ -161,12 +172,16 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
* its execution. Finally, it retrieves the job results via the stdout api.
* The status and output attributes are populated in the process.
*/
- private fun runJobTemplateOnAWX(awxClient: BlueprintWebClientService, job_template_name: String?, jtId: String,
- workflowPrefix : String) {
- setNodeOutputProperties("preparing".asJsonPrimitive(), "".asJsonPrimitive(), "".asJsonPrimitive())
+ private fun runJobTemplateOnAWX(
+ awxClient: BlueprintWebClientService,
+ job_template_name: String?,
+ jtId: String,
+ workflowPrefix: String
+ ) {
+ setNodeOutputProperties("preparing".asJsonPrimitive(), "".asJsonPrimitive(), "".asJsonPrimitive())
// Get Job Template requirements
- var response = awxClient.exchangeResource(GET, "/api/v2/${workflowPrefix}job_templates/${jtId}/launch/", "")
+ var response = awxClient.exchangeResource(GET, "/api/v2/${workflowPrefix}job_templates/$jtId/launch/", "")
// FIXME: handle non-successful SC
val jtLaunchReqs: JsonNode = mapper.readTree(response.body)
val payload = prepareLaunchPayload(awxClient, jtLaunchReqs, workflowPrefix.isNotBlank())
@@ -175,7 +190,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
// Launch the job for the targeted template
var jtLaunched: JsonNode = JacksonUtils.objectMapper.createObjectNode()
- response = awxClient.exchangeResource(POST, "/api/v2/${workflowPrefix}job_templates/${jtId}/launch/", payload)
+ response = awxClient.exchangeResource(POST, "/api/v2/${workflowPrefix}job_templates/$jtId/launch/", payload)
if (response.status in HTTP_SUCCESS) {
jtLaunched = mapper.readTree(response.body)
val fieldsIgnored: JsonNode = jtLaunched.at("/ignored_fields")
@@ -191,7 +206,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
var jobStatus = "unknown"
var jobEndTime = "null"
while (jobEndTime == "null") {
- response = awxClient.exchangeResource(GET, "/api/v2/${workflowPrefix}jobs/${jobId}/", "")
+ response = awxClient.exchangeResource(GET, "/api/v2/${workflowPrefix}jobs/$jobId/", "")
val jobLaunched: JsonNode = mapper.readTree(response.body)
jobStatus = jobLaunched.at("/status").asText()
jobEndTime = jobLaunched.at("/finished").asText()
@@ -201,7 +216,6 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
log.info("Execution of job template $job_template_name in job #$jobId finished with status ($jobStatus) for requestId $processId")
populateJobRunResponse(awxClient, jobId, workflowPrefix, jobStatus)
-
} else {
// The job template requirements were not fulfilled with the values passed in. The message below will
// provide more information via the response, like the ignored_fields, or variables_needed_to_start,
@@ -217,8 +231,12 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
* Extracts the output from either a job stdout call OR collects the workflow run output, as well as the artifacts
* and populate the component corresponding output properties
*/
- private fun populateJobRunResponse(awxClient: BlueprintWebClientService, jobId: String, workflowPrefix: String,
- jobStatus: String) {
+ private fun populateJobRunResponse(
+ awxClient: BlueprintWebClientService,
+ jobId: String,
+ workflowPrefix: String,
+ jobStatus: String
+ ) {
val collectedResponses = StringBuilder(4096)
val artifacts: MutableMap<String, JsonNode> = mutableMapOf()
@@ -226,20 +244,20 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
collectJobIdsRelatedToJobRun(awxClient, jobId, workflowPrefix).forEach { aJobId ->
// Collect the response text from the corresponding jobIds
- var response = awxClient.exchangeResource(GET, "/api/v2/jobs/${aJobId}/stdout/?format=txt", "", plainTextHeaders)
+ var response = awxClient.exchangeResource(GET, "/api/v2/jobs/$aJobId/stdout/?format=txt", "", plainTextHeaders)
if (response.status in HTTP_SUCCESS) {
val jobOutput = response.body
collectedResponses
- .append("Output for Job $aJobId :" + System.lineSeparator())
- .append(jobOutput)
- .append(System.lineSeparator())
- log.info("Response for job ${aJobId}: \n ${jobOutput} \n")
+ .append("Output for Job $aJobId :" + System.lineSeparator())
+ .append(jobOutput)
+ .append(System.lineSeparator())
+ log.info("Response for job $aJobId: \n $jobOutput \n")
} else {
- log.warn("Could not gather response for job ${aJobId}. Status=${response.status}")
+ log.warn("Could not gather response for job $aJobId. Status=${response.status}")
}
// Collect artifacts variables from each job and gather them up in one json node
- response = awxClient.exchangeResource(GET, "/api/v2/jobs/${aJobId}/", "")
+ response = awxClient.exchangeResource(GET, "/api/v2/jobs/$aJobId/", "")
if (response.status in HTTP_SUCCESS) {
val jobArtifacts = mapper.readTree(response.body).at("/artifacts")
if (jobArtifacts != null) {
@@ -248,7 +266,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
}
}
- log.info("Artifacts for job ${jobId}: \n $artifacts \n")
+ log.info("Artifacts for job $jobId: \n $artifacts \n")
setNodeOutputProperties(jobStatus.asJsonPrimitive(), collectedResponses.toString().asJsonPrimitive(), artifacts.asJsonNode())
}
@@ -261,7 +279,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
var jobIds: Array<String>
if (workflowPrefix.isNotEmpty()) {
- var response = awxClient.exchangeResource(GET, "/api/v2/${workflowPrefix}jobs/${jobId}/workflow_nodes/", "")
+ var response = awxClient.exchangeResource(GET, "/api/v2/${workflowPrefix}jobs/$jobId/workflow_nodes/", "")
val jobDetails = mapper.readTree(response.body).at("/results")
// gather up job Id of all actual job nodes that ran during the workflow
@@ -282,8 +300,11 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
* by applying the overrides that were provided
* and allowed by the template definition flags in jtLaunchReqs
*/
- private fun prepareLaunchPayload(awxClient: BlueprintWebClientService, jtLaunchReqs: JsonNode,
- isWorkflow : Boolean): String {
+ private fun prepareLaunchPayload(
+ awxClient: BlueprintWebClientService,
+ jtLaunchReqs: JsonNode,
+ isWorkflow: Boolean
+ ): String {
val payload = JacksonUtils.objectMapper.createObjectNode()
// Parameter defaults
@@ -318,7 +339,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
payload.set(INPUT_INVENTORY, inventoryKeyId)
}
- payload.set("extra_vars", extraArgs)
+ payload.set("extra_vars", extraArgs)
return payload.asJsonString(false)
}
@@ -363,7 +384,7 @@ open class ComponentRemoteAnsibleExecutor(private val blueprintRestLibPropertySe
/**
* Utility function to set the output properties and errors of the executor node, in cas of errors
*/
- private fun setNodeOutputErrors(status: String, message: String, artifacts: JsonNode = "".asJsonPrimitive() ) {
+ private fun setNodeOutputErrors(status: String, message: String, artifacts: JsonNode = "".asJsonPrimitive()) {
setAttribute(ATTRIBUTE_EXEC_CMD_STATUS, status.asJsonPrimitive())
setAttribute(ATTRIBUTE_EXEC_CMD_LOG, message.asJsonPrimitive())
setAttribute(ATTRIBUTE_EXEC_CMD_ARTIFACTS, artifacts)
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
index 5e0905dec..262563d1f 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
@@ -73,20 +73,24 @@ class ComponentRemoteAnsibleExecutorTest {
webClientService.exchangeResource("GET", "/api/v2/inventories/?name=Demo+Inventory", "")
} returns WebClientResponse(200, getInventory())
every {
- webClientService.exchangeResource("POST", "/api/v2/job_templates/$jtId/launch/",
- """{"inventory":1,"extra_vars":{"site_id":"3 - Belmont","tor_group":"vEPC"}}""")
+ webClientService.exchangeResource(
+ "POST", "/api/v2/job_templates/$jtId/launch/",
+ """{"inventory":1,"extra_vars":{"site_id":"3 - Belmont","tor_group":"vEPC"}}"""
+ )
} returns WebClientResponse(201, newJobTemplateLaunch(jtId, jobId))
every {
webClientService.exchangeResource("GET", "/api/v2/jobs/$jobId/", "")
} returnsMany listOf(
- WebClientResponse(200, getJobStatus1(jtId, jobId)),
- WebClientResponse(200, getJobStatus2(jtId, jobId)),
- WebClientResponse(200, getJobStatus3(jtId, jobId)),
- WebClientResponse(200, getJobStatus4(jtId, jobId))
+ WebClientResponse(200, getJobStatus1(jtId, jobId)),
+ WebClientResponse(200, getJobStatus2(jtId, jobId)),
+ WebClientResponse(200, getJobStatus3(jtId, jobId)),
+ WebClientResponse(200, getJobStatus4(jtId, jobId))
)
every {
- webClientService.exchangeResource("GET", "/api/v2/jobs/$jobId/stdout/?format=txt", "",
- mapOf("Accept" to "text/plain"))
+ webClientService.exchangeResource(
+ "GET", "/api/v2/jobs/$jobId/stdout/?format=txt", "",
+ mapOf("Accept" to "text/plain")
+ )
} returns WebClientResponse(200, getReport())
val selector = mapper.readTree(endpointSelector)
val bluePrintRestLibPropertyService = mockk<BluePrintRestLibPropertyService>()
@@ -95,8 +99,9 @@ class ComponentRemoteAnsibleExecutorTest {
awxRemoteExecutor.checkDelay = 1
val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-remote-ansible-request.json",
- ExecutionServiceInput::class.java)!!
+ "payload/requests/sample-remote-ansible-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val bluePrintRuntimeService = createBlueprintRuntimeService(awxRemoteExecutor, executionServiceInput)
@@ -128,8 +133,9 @@ class ComponentRemoteAnsibleExecutorTest {
awxRemoteExecutor.checkDelay = 1
val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
- "payload/requests/remote-ansible-request-full.json",
- ExecutionServiceInput::class.java)!!
+ "payload/requests/remote-ansible-request-full.json",
+ ExecutionServiceInput::class.java
+ )!!
val bluePrintRuntimeService = createBlueprintRuntimeService(awxRemoteExecutor, executionServiceInput)
@@ -156,8 +162,10 @@ class ComponentRemoteAnsibleExecutorTest {
webClientService.exchangeResource("GET", "/api/v2/inventories/?name=Demo+Inventory", "")
} returns WebClientResponse(200, getInventory())
every {
- webClientService.exchangeResource("POST", "/api/v2/job_templates/$jtId/launch/",
- """{"limit":"123","tags":"some-tag","skip_tags":"some-skip-tag","inventory":1,"extra_vars":{"site_id":"3 - Belmont","tor_group":"vEPC"}}""")
+ webClientService.exchangeResource(
+ "POST", "/api/v2/job_templates/$jtId/launch/",
+ """{"limit":"123","tags":"some-tag","skip_tags":"some-skip-tag","inventory":1,"extra_vars":{"site_id":"3 - Belmont","tor_group":"vEPC"}}"""
+ )
} returns WebClientResponse(500, "")
val selector = mapper.readTree(endpointSelector)
val bluePrintRestLibPropertyService = mockk<BluePrintRestLibPropertyService>()
@@ -166,8 +174,9 @@ class ComponentRemoteAnsibleExecutorTest {
awxRemoteExecutor.checkDelay = 1
val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
- "payload/requests/remote-ansible-request-full.json",
- ExecutionServiceInput::class.java)!!
+ "payload/requests/remote-ansible-request-full.json",
+ ExecutionServiceInput::class.java
+ )!!
val bluePrintRuntimeService = createBlueprintRuntimeService(awxRemoteExecutor, executionServiceInput)
@@ -181,9 +190,14 @@ class ComponentRemoteAnsibleExecutorTest {
assertEquals(1, errors.size)
}
- private fun createBlueprintRuntimeService(awxRemoteExecutor: ComponentRemoteAnsibleExecutor, executionServiceInput: ExecutionServiceInput): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("123456-1000",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_ansible")
+ private fun createBlueprintRuntimeService(
+ awxRemoteExecutor: ComponentRemoteAnsibleExecutor,
+ executionServiceInput: ExecutionServiceInput
+ ): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "123456-1000",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_ansible"
+ )
awxRemoteExecutor.bluePrintRuntimeService = bluePrintRuntimeService
val workflowName = executionServiceInput.actionIdentifiers.actionName
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
index 15365e176..b3708a092 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/internal/scripts/InternalSimpleCli.kt
@@ -24,7 +24,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.cli.executor.getSshClien
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-
import org.slf4j.LoggerFactory
open class TestCliScriptFunction : AbstractScriptComponentFunction() {
@@ -44,7 +43,6 @@ open class TestCliScriptFunction : AbstractScriptComponentFunction() {
}
}
-
open class Check : AbstractScriptComponentFunction() {
private val log = LoggerFactory.getLogger(AbstractScriptComponentFunction::class.java)!!
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt
index 13afc58af..dc2f9edb1 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorConfiguration.kt
@@ -25,4 +25,4 @@ import org.springframework.context.annotation.Configuration
@ComponentScan
@EnableConfigurationProperties
@ConditionalOnProperty(name = ["blueprintsprocessor.cliExecutor.enabled"], havingValue = "true")
-open class CliExecutorConfiguration \ No newline at end of file
+open class CliExecutorConfiguration
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt
index ad95759a9..b6f2dcb94 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/CliExecutorExtensions.kt
@@ -33,4 +33,3 @@ fun AbstractComponentFunction.cliDeviceInfo(requirementName: String): JsonNode {
fun AbstractComponentFunction.getSshClientService(cliDeviceInfo: JsonNode): BlueprintSshClientService {
return BluePrintDependencyService.sshClientService(cliDeviceInfo)
}
-
diff --git a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
index c4e674c91..50268d39b 100644
--- a/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/cli-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/cli/executor/ComponentCliExecutorTest.kt
@@ -34,6 +34,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServic
import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BluePrintSshLibConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
@@ -47,10 +48,12 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [CliExecutorConfiguration::class,
- ExecutionServiceConfiguration::class,
- BluePrintSshLibConfiguration::class, BluePrintScriptsServiceImpl::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDependencyService::class])
+@ContextConfiguration(
+ classes = [CliExecutorConfiguration::class,
+ ExecutionServiceConfiguration::class,
+ BluePrintSshLibConfiguration::class, BluePrintScriptsServiceImpl::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDependencyService::class]
+)
@DirtiesContext
@TestPropertySource(properties = [], locations = ["classpath:application-test.properties"])
class ComponentCliExecutorTest {
@@ -81,7 +84,7 @@ class ComponentCliExecutorTest {
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE] =
- "internal.scripts.TestCliScriptFunction".asJsonPrimitive()
+ "internal.scripts.TestCliScriptFunction".asJsonPrimitive()
val stepInputData = StepData().apply {
name = "activate-cli"
@@ -90,19 +93,29 @@ class ComponentCliExecutorTest {
executionServiceInput.stepData = stepInputData
val blueprintContext = mockk<BluePrintContext>()
+ every {
+ blueprintContext.nodeTemplateOperationImplementation(
+ any(), any(), any()
+ )
+ } returns Implementation()
+
every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs("activate-cli",
- "interfaceName", "operationName")
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
+ "activate-cli",
+ "interfaceName", "operationName"
+ )
} returns operationInputs
val operationOutputs = hashMapOf<String, JsonNode>()
every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs("activate-cli",
- "interfaceName", "operationName")
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
+ "activate-cli",
+ "interfaceName", "operationName"
+ )
} returns operationOutputs
componentScriptExecutor.applyNB(executionServiceInput)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
index 82eaf394d..0bf4e5f32 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt
@@ -38,7 +38,6 @@ import org.xmlunit.builder.Input
import org.xmlunit.diff.ComparisonType
import org.xmlunit.diff.Diff
-
/**
* ComponentConfigSnapshotsExecutor
*
@@ -54,7 +53,7 @@ import org.xmlunit.diff.Diff
@Component("component-config-snapshots-executor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: ResourceConfigSnapshotService) :
- AbstractComponentFunction() {
+ AbstractComponentFunction() {
companion object {
private val log = LoggerFactory.getLogger(ComponentConfigSnapshotsExecutor::class.java)
@@ -100,10 +99,12 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
when (operation) {
OPERATION_FETCH -> fetchConfigurationSnapshot(resourceId, resourceType, status)
OPERATION_STORE -> storeConfigurationSnapshot(snapshot, resourceId, resourceType, status)
- OPERATION_DIFF -> compareConfigurationSnapshot(resourceId, resourceType, contentType)
+ OPERATION_DIFF -> compareConfigurationSnapshot(resourceId, resourceType, contentType)
- else -> setNodeOutputErrors(OUTPUT_STATUS_ERROR,
- "Operation parameter must be fetch, store or diff")
+ else -> setNodeOutputErrors(
+ OUTPUT_STATUS_ERROR,
+ "Operation parameter must be fetch, store or diff"
+ )
}
}
@@ -117,12 +118,15 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
/**
* Fetch a configuration snapshot, for resource identified by ID/type, of type status (RUNNING by default)
*/
- private suspend fun fetchConfigurationSnapshot(resourceId: String, resourceType: String,
- status : ResourceConfigSnapshot.Status = RUNNING) {
+ private suspend fun fetchConfigurationSnapshot(
+ resourceId: String,
+ resourceType: String,
+ status: ResourceConfigSnapshot.Status = RUNNING
+ ) {
try {
val cfgSnapshotValue = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status)
setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotValue)
- } catch (er : NoSuchElementException) {
+ } catch (er: NoSuchElementException) {
val message = "No Resource config snapshot identified by resourceId={$resourceId}, " +
"resourceType={$resourceType} does not exists"
setNodeOutputErrors(OUTPUT_STATUS_ERROR, message)
@@ -132,11 +136,15 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
/**
* Store a configuration snapshot, for resource identified by ID/type, of type status (RUNNING by default)
*/
- private suspend fun storeConfigurationSnapshot(cfgSnapshotValue : String, resourceId: String, resourceType: String,
- status : ResourceConfigSnapshot.Status = RUNNING) {
+ private suspend fun storeConfigurationSnapshot(
+ cfgSnapshotValue: String,
+ resourceId: String,
+ resourceType: String,
+ status: ResourceConfigSnapshot.Status = RUNNING
+ ) {
if (cfgSnapshotValue.isNotEmpty()) {
val cfgSnapshotSaved = cfgSnapshotService.write(cfgSnapshotValue, resourceId, resourceType, status)
- setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotSaved.config_snapshot ?: "" )
+ setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotSaved.config_snapshot ?: "")
} else {
val message = "Could not store config snapshot identified by resourceId={$resourceId},resourceType={$resourceType} does not exists"
setNodeOutputErrors(OUTPUT_STATUS_ERROR, message)
@@ -146,7 +154,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
/**
* Compare two configs (RUNNING vs CANDIDATE) for resource identified by ID/type, using the specified contentType
*/
- private suspend fun compareConfigurationSnapshot(resourceId: String, resourceType: String, contentType : String) {
+ private suspend fun compareConfigurationSnapshot(resourceId: String, resourceType: String, contentType: String) {
val cfgRunning = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, RUNNING)
val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE)
@@ -163,13 +171,13 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
}
DIFF_XML -> {
val myDiff = DiffBuilder
- .compare(Input.fromString(cfgRunning))
- .withTest(Input.fromString(cfgCandidate))
- .checkForSimilar()
- .ignoreComments()
- .ignoreWhitespace()
- .normalizeWhitespace()
- .build()
+ .compare(Input.fromString(cfgRunning))
+ .withTest(Input.fromString(cfgCandidate))
+ .checkForSimilar()
+ .ignoreComments()
+ .ignoreWhitespace()
+ .normalizeWhitespace()
+ .build()
setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, formatXmlDifferences(myDiff))
}
@@ -205,10 +213,12 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
/**
* Formats XmlUnit differences into xml-patch like response (RFC5261)
*/
- private fun formatXmlDifferences(differences : Diff) : String {
+ private fun formatXmlDifferences(differences: Diff): String {
val output = StringBuilder()
- output.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<diff>")
+ output.append(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<diff>"
+ )
val diffIterator = differences.getDifferences().iterator()
while (diffIterator.hasNext()) {
@@ -216,18 +226,18 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
when (aDiff.type) {
ComparisonType.ATTR_VALUE -> {
output.append("<replace sel=\"").append(aDiff.testDetails.xPath).append("\">")
- .append(aDiff.testDetails.value)
- .append("</replace>")
+ .append(aDiff.testDetails.value)
+ .append("</replace>")
}
ComparisonType.TEXT_VALUE -> {
output.append("<replace sel=\"").append(aDiff.testDetails.xPath).append("\">")
- .append(aDiff.testDetails.value)
- .append("</replace>")
+ .append(aDiff.testDetails.value)
+ .append("</replace>")
}
ComparisonType.CHILD_LOOKUP -> {
output.append("<add sel=\"").append(aDiff.testDetails.parentXPath).append("\">")
- .append(formatNode(aDiff.testDetails.target))
- .append("</add>")
+ .append(formatNode(aDiff.testDetails.target))
+ .append("</add>")
}
ComparisonType.CHILD_NODELIST_LENGTH -> {
// Ignored; will be processed in the CHILD_LOOKUP case
@@ -253,7 +263,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso
if (node.hasChildNodes()) {
val nodes = node.childNodes
for (index in 1..nodes.length) {
- val child = nodes.item(index-1)
+ val child = nodes.item(index - 1)
if (child.nodeType == Node.TEXT_NODE || child.nodeType == Node.COMMENT_NODE) {
output.append(child.nodeValue)
} else {
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
index ef34e6ff9..73c9e22f3 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshot.kt
@@ -22,8 +22,15 @@ import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
/**
* ResourceConfigSnapshot model
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotRepository.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotRepository.kt
index 4ab7d7f0e..e1806438b 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotRepository.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotRepository.kt
@@ -16,6 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db
import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
import javax.transaction.Transactional
/**
@@ -24,16 +25,19 @@ import javax.transaction.Transactional
* @author Serge Simard
* @version 1.0
*/
+@Repository
interface ResourceConfigSnapshotRepository : JpaRepository<ResourceConfigSnapshot, String> {
fun findByResourceIdAndResourceTypeAndStatus(
resourceId: String,
resourceType: String,
- status : ResourceConfigSnapshot.Status): ResourceConfigSnapshot?
+ status: ResourceConfigSnapshot.Status
+ ): ResourceConfigSnapshot?
@Transactional
fun deleteByResourceIdAndResourceTypeAndStatus(
resourceId: String,
resourceType: String,
- status : ResourceConfigSnapshot.Status)
+ status: ResourceConfigSnapshot.Status
+ )
}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
index 73d517553..9260b79e8 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotService.kt
@@ -23,7 +23,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.slf4j.LoggerFactory
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.UUID
/**
* ResourceConfigSnapshot managing service.
@@ -32,46 +32,57 @@ import java.util.*
* @version 1.0
*/
@Service
-class ResourceConfigSnapshotService(private val repository: ResourceConfigSnapshotRepository) {
+open class ResourceConfigSnapshotService(private val resourceConfigSnapshotRepository: ResourceConfigSnapshotRepository) {
private val log = LoggerFactory.getLogger(ResourceConfigSnapshotService::class.toString())
- suspend fun findByResourceIdAndResourceTypeAndStatus(resourceId: String, resourceType: String,
- status : ResourceConfigSnapshot.Status = RUNNING): String =
- withContext(Dispatchers.IO) {
- repository.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status)
- ?.config_snapshot ?: Strings.EMPTY
- }
+ suspend fun findByResourceIdAndResourceTypeAndStatus(
+ resourceId: String,
+ resourceType: String,
+ status: ResourceConfigSnapshot.Status = RUNNING
+ ): String =
+ withContext(Dispatchers.IO) {
+ resourceConfigSnapshotRepository.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status)
+ ?.config_snapshot ?: Strings.EMPTY
+ }
- suspend fun write(snapshot: String, resId: String, resType: String,
- status: ResourceConfigSnapshot.Status = RUNNING) : ResourceConfigSnapshot =
- withContext(Dispatchers.IO) {
+ suspend fun write(
+ snapshot: String,
+ resId: String,
+ resType: String,
+ status: ResourceConfigSnapshot.Status = RUNNING
+ ): ResourceConfigSnapshot =
+ withContext(Dispatchers.IO) {
- val resourceConfigSnapshotEntry = ResourceConfigSnapshot()
- resourceConfigSnapshotEntry.id = UUID.randomUUID().toString()
- resourceConfigSnapshotEntry.resourceId = resId
- resourceConfigSnapshotEntry.resourceType = resType
- resourceConfigSnapshotEntry.status = status
- resourceConfigSnapshotEntry.config_snapshot = snapshot
+ val resourceConfigSnapshotEntry = ResourceConfigSnapshot()
+ resourceConfigSnapshotEntry.id = UUID.randomUUID().toString()
+ resourceConfigSnapshotEntry.resourceId = resId
+ resourceConfigSnapshotEntry.resourceType = resType
+ resourceConfigSnapshotEntry.status = status
+ resourceConfigSnapshotEntry.config_snapshot = snapshot
- // Overwrite configuration snapshot entry of resId/resType
- if (resId.isNotEmpty() && resType.isNotEmpty()) {
- repository.findByResourceIdAndResourceTypeAndStatus(resId, resType, status)?.
- let {
- log.info("Overwriting configuration snapshot entry for resourceId=($resId), " +
- "resourceType=($resType), status=($status)")
- repository.deleteByResourceIdAndResourceTypeAndStatus(resId, resType, status)
- }
- }
- var storedSnapshot: ResourceConfigSnapshot
- try {
- storedSnapshot = repository.saveAndFlush(resourceConfigSnapshotEntry)
- log.info("Stored configuration snapshot for resourceId=($resId), " +
+ // Overwrite configuration snapshot entry of resId/resType
+ if (resId.isNotEmpty() && resType.isNotEmpty()) {
+ resourceConfigSnapshotRepository.findByResourceIdAndResourceTypeAndStatus(resId, resType, status)
+ ?.let {
+ log.info(
+ "Overwriting configuration snapshot entry for resourceId=($resId), " +
+ "resourceType=($resType), status=($status)"
+ )
+ resourceConfigSnapshotRepository.deleteByResourceIdAndResourceTypeAndStatus(resId, resType, status)
+ }
+ }
+ var storedSnapshot: ResourceConfigSnapshot
+ try {
+ storedSnapshot = resourceConfigSnapshotRepository.saveAndFlush(resourceConfigSnapshotEntry)
+ log.info(
+ "Stored configuration snapshot for resourceId=($resId), " +
"resourceType=($resType), status=($status), " +
- "dated=(${storedSnapshot.createdDate})")
- } catch (ex: DataIntegrityViolationException) {
- throw BluePrintException("Failed to store configuration snapshot entry.", ex)
- }
- storedSnapshot
+ "dated=(${storedSnapshot.createdDate})"
+ )
+ } catch (ex: DataIntegrityViolationException) {
+ throw BluePrintException("Failed to store configuration snapshot entry.", ex)
}
+ storedSnapshot
+ }
}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
index f013e89a1..450da1c9f 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
@@ -23,10 +23,7 @@ import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_JSON
import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.DIFF_XML
import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.ComponentConfigSnapshotsExecutor.Companion.OPERATION_DIFF
@@ -36,31 +33,32 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.Reso
import org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots.db.ResourceConfigSnapshotService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [ResourceConfigSnapshotService::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
- BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
+@ContextConfiguration(
+ classes = [ResourceConfigSnapshotService::class, TestDatabaseConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
-@EnableAutoConfiguration
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots"]
+)
@Suppress("SameParameterValue")
class ComponentConfigSnapshotsExecutorTest {
@Autowired
- lateinit var cfgSnapshotService : ResourceConfigSnapshotService
- lateinit var cfgSnapshotComponent : ComponentConfigSnapshotsExecutor
- private var bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("123456-1000",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts")
+ lateinit var cfgSnapshotService: ResourceConfigSnapshotService
+ lateinit var cfgSnapshotComponent: ComponentConfigSnapshotsExecutor
+ private var bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "123456-1000",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts"
+ )
private val resourceId = "1"
private val resourceType = "ServiceInstance"
@@ -75,7 +73,6 @@ class ComponentConfigSnapshotsExecutorTest {
props[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_ID] = resourceId.asJsonPrimitive()
props[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_TYPE] = resourceType.asJsonPrimitive()
-
cfgSnapshotComponent.operationInputs = props
cfgSnapshotComponent.bluePrintRuntimeService = bluePrintRuntimeService
cfgSnapshotComponent.nodeTemplateName = nodeTemplateName
@@ -103,17 +100,27 @@ class ComponentConfigSnapshotsExecutorTest {
cfgSnapshotComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get success and the TEST1 payload in our output properties
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
- assertEquals(snapshotConfig.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT))
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
+ assertEquals(
+ snapshotConfig.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT
+ )
+ )
}
}
@@ -127,22 +134,32 @@ class ComponentConfigSnapshotsExecutorTest {
try {
val resId = "121111"
val resType = "PNF"
- cfgSnapshotService.write(snapshotConfig, resId, resType, ResourceConfigSnapshot.Status.CANDIDATE)
+ cfgSnapshotService.write(snapshotConfig, resId, resType, ResourceConfigSnapshot.Status.CANDIDATE)
prepareRequestProperties(OPERATION_FETCH, resId, resType, ResourceConfigSnapshot.Status.CANDIDATE.name)
cfgSnapshotComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get success and the TEST payload in our output properties
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
- assertEquals(snapshotConfig.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT))
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
+ assertEquals(
+ snapshotConfig.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT
+ )
+ )
}
}
@@ -159,20 +176,29 @@ class ComponentConfigSnapshotsExecutorTest {
prepareRequestProperties(OPERATION_STORE, resId, resType, snapshotConfig)
cfgSnapshotComponent.processNB(executionRequest)
-
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get success and the PAYLOAD payload in our output properties
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
- assertEquals(snapshotConfig.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT))
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
+ assertEquals(
+ snapshotConfig.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT
+ )
+ )
}
}
@@ -182,19 +208,24 @@ class ComponentConfigSnapshotsExecutorTest {
runBlocking {
// when; asking for unknown resource Id/ resource Type combo; should get an error response
try {
- prepareRequestProperties(OPERATION_FETCH, "asdasd", "PNF", ResourceConfigSnapshot.Status.RUNNING.name)
+ prepareRequestProperties(OPERATION_FETCH, "asdasd", "PNF", ResourceConfigSnapshot.Status.RUNNING.name)
cfgSnapshotComponent.processNB(executionRequest)
-
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
}
}
@@ -204,25 +235,34 @@ class ComponentConfigSnapshotsExecutorTest {
runBlocking {
// when; asking for unknown operation update; should get an error response
try {
- prepareRequestProperties("update", "asdasd", "PNF", ResourceConfigSnapshot.Status.RUNNING.name)
+ prepareRequestProperties("update", "asdasd", "PNF", ResourceConfigSnapshot.Status.RUNNING.name)
cfgSnapshotComponent.processNB(executionRequest)
-
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get error in our output properties
- assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size == 1 )
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
+ assertTrue(bluePrintRuntimeService.getBluePrintError().errors.size == 1)
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
val msg = "Operation parameter must be fetch, store or diff"
- assertEquals(msg.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_MESSAGE))
+ assertEquals(
+ msg.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_MESSAGE
+ )
+ )
}
}
@@ -234,25 +274,34 @@ class ComponentConfigSnapshotsExecutorTest {
try {
val resId = "121111"
val resType = "PNF"
- cfgSnapshotService.write("snapshotConfig", resId, resType, ResourceConfigSnapshot.Status.CANDIDATE)
- prepareRequestProperties(OPERATION_DIFF, resId, resType, "YANG")
+ cfgSnapshotService.write("snapshotConfig", resId, resType, ResourceConfigSnapshot.Status.CANDIDATE)
+ prepareRequestProperties(OPERATION_DIFF, resId, resType, "YANG")
cfgSnapshotComponent.processNB(executionRequest)
-
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot lookup: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get error in our output properties
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
val message = "Could not compare config snapshots for type YANG"
- assertEquals(message.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_MESSAGE))
+ assertEquals(
+ message.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_MESSAGE
+ )
+ )
}
}
@@ -270,27 +319,37 @@ class ComponentConfigSnapshotsExecutorTest {
prepareRequestProperties(OPERATION_DIFF, resId, resType, DIFF_JSON)
cfgSnapshotComponent.processNB(executionRequest)
-
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot diff: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot diff: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get success
- assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size == 0 )
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
+ assertTrue(bluePrintRuntimeService.getBluePrintError().errors.size == 0)
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
// then; we should get JSON-patches differences in our response property
- val diffJson = "[{\"op\":\"add\",\"path\":\"/system-uptime-information/last-configured-time/new-child-object\",\"value\":{\"property\":\"value\"}}," +
+ val diffJson =
+ "[{\"op\":\"add\",\"path\":\"/system-uptime-information/last-configured-time/new-child-object\",\"value\":{\"property\":\"value\"}}," +
"{\"op\":\"replace\",\"path\":\"/system-uptime-information/system-booted-time/time-length\",\"value\":\"14:52:54\"}," +
"{\"op\":\"replace\",\"path\":\"/system-uptime-information/time-source\",\"value\":\" DNS CLOCK \"}," +
"{\"op\":\"add\",\"path\":\"/system-uptime-information/uptime-information/load-average-10\",\"value\":\"0.05\"}]"
- assertEquals(diffJson.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT))
+ assertEquals(
+ diffJson.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT
+ )
+ )
}
}
@@ -309,57 +368,84 @@ class ComponentConfigSnapshotsExecutorTest {
prepareRequestProperties(OPERATION_DIFF, resId, resType, DIFF_XML)
cfgSnapshotComponent.processNB(executionRequest)
-
} catch (e: BluePrintProcessorException) {
- kotlin.test.assertEquals("Can't proceed with the cfg snapshot diff: provide resource-id and resource-type.",
- e.message)
+ kotlin.test.assertEquals(
+ "Can't proceed with the cfg snapshot diff: provide resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
// then; we should get success
- assertTrue( bluePrintRuntimeService.getBluePrintError().errors.size == 0 )
- assertEquals(ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_STATUS))
+ assertTrue(bluePrintRuntimeService.getBluePrintError().errors.size == 0)
+ assertEquals(
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_STATUS
+ )
+ )
// then; we should get XML-patches differences in our response property
val diffXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<diff>" +
- "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/@seconds\">2343</replace>" +
- "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/text()[1]\">34</replace>" +
- "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/input-packets[1]/text()[1]\">09098789</replace>" +
- "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/output-packets[1]/text()[1]\">2828828</replace>" +
- "<add sel=\"/output[1]/interface-information[1]/physical-interface[1]\"><interface-name>TEGig400-int01</interface-name></add>" +
- "</diff>"
- assertEquals(diffXml.asJsonPrimitive(),
- bluePrintRuntimeService.getNodeTemplateAttributeValue(nodeTemplateName,
- ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT)) }
+ "<diff>" +
+ "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/@seconds\">2343</replace>" +
+ "<replace sel=\"/output[1]/interface-information[1]/interface-flapped[1]/text()[1]\">34</replace>" +
+ "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/input-packets[1]/text()[1]\">09098789</replace>" +
+ "<replace sel=\"/output[1]/interface-information[1]/traffic-statistics[1]/output-packets[1]/text()[1]\">2828828</replace>" +
+ "<add sel=\"/output[1]/interface-information[1]/physical-interface[1]\"><interface-name>TEGig400-int01</interface-name></add>" +
+ "</diff>"
+ assertEquals(
+ diffXml.asJsonPrimitive(),
+ bluePrintRuntimeService.getNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT
+ )
+ )
+ }
}
- private fun preparePayload(filename : String, resId : String, resType : String, status: ResourceConfigSnapshot.Status) {
+ private fun preparePayload(
+ filename: String,
+ resId: String,
+ resType: String,
+ status: ResourceConfigSnapshot.Status
+ ) {
runBlocking {
- cfgSnapshotService.write(JacksonUtils.getClassPathFileContent("payload/requests/$filename"), resId, resType, status)
+ cfgSnapshotService.write(
+ JacksonUtils.getClassPathFileContent("payload/requests/$filename"),
+ resId,
+ resType,
+ status
+ )
}
}
- private fun prepareRequestProperties (oper : String, resId : String, resType : String, optional: String = "") {
+ private fun prepareRequestProperties(oper: String, resId: String, resType: String, optional: String = "") {
cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_OPERATION] = oper.asJsonPrimitive()
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_ID] = resId.asJsonPrimitive()
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_TYPE] = resType.asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_ID] =
+ resId.asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_TYPE] =
+ resType.asJsonPrimitive()
// Optional inputs
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] = "".asJsonPrimitive()
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] = "".asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] =
+ "".asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] =
+ "".asJsonPrimitive()
cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_STATUS] =
- ResourceConfigSnapshot.Status.RUNNING.name.asJsonPrimitive()
+ ResourceConfigSnapshot.Status.RUNNING.name.asJsonPrimitive()
when (oper) {
OPERATION_DIFF ->
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] = optional.asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_DIFF_CONTENT_TYPE] =
+ optional.asJsonPrimitive()
OPERATION_STORE ->
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] = optional.asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_SNAPSHOT] =
+ optional.asJsonPrimitive()
OPERATION_FETCH ->
- cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_STATUS] = optional.asJsonPrimitive()
+ cfgSnapshotComponent.operationInputs[ComponentConfigSnapshotsExecutor.INPUT_RESOURCE_STATUS] =
+ optional.asJsonPrimitive()
}
}
}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..96045ee07
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/TestDatabaseConfiguration.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.functions.config.snapshots
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt
index 18ee8c9dc..f25b6f9c7 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/db/ResourceConfigSnapshotServiceTest.kt
@@ -55,7 +55,7 @@ class ResourceConfigSnapshotServiceTest {
every {
cfgRepository.findByResourceIdAndResourceTypeAndStatus(any(), any(), any())
} returns null
- val res = cfgService.write( configSnapshot, resourceId, resourceType, resourceStatus)
+ val res = cfgService.write(configSnapshot, resourceId, resourceType, resourceStatus)
assertEquals(tr, res)
}
}
@@ -71,7 +71,7 @@ class ResourceConfigSnapshotServiceTest {
every {
cfgRepository.deleteByResourceIdAndResourceTypeAndStatus(any(), any(), any())
} returns Unit
- val res = cfgService.write( configSnapshot, resourceId, resourceType)
+ val res = cfgService.write(configSnapshot, resourceId, resourceType)
verify {
cfgRepository.deleteByResourceIdAndResourceTypeAndStatus(eq(resourceId), eq(resourceType), eq(resourceStatus))
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/AbstractTopologyComponents.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/AbstractMessagePrioritizeProcessor.kt
index d114da521..c2965c4e8 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/AbstractTopologyComponents.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/AbstractMessagePrioritizeProcessor.kt
@@ -34,8 +34,6 @@ abstract class AbstractMessagePrioritizeProcessor<K, V> : AbstractBluePrintMessa
this.processorContext = context
/** Get the State service to update in store */
this.messagePrioritizationStateService = BluePrintDependencyService
- .messagePrioritizationStateService()
-
+ .messagePrioritizationStateService()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConfiguration.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConfiguration.kt
index cce883c91..28e096352 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConfiguration.kt
@@ -23,7 +23,6 @@ import org.springframework.context.annotation.Configuration
@ComponentScan
open class MessagePrioritizationConfiguration
-
object MessagePrioritizationConstants {
const val SOURCE_INPUT = "source-prioritization-input"
@@ -34,4 +33,4 @@ object MessagePrioritizationConstants {
const val SINK_OUTPUT = "sink-prioritization-output"
const val SINK_EXPIRED = "sink-prioritization-expired"
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumer.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumer.kt
index 967cc190e..ed124d1b2 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumer.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumer.kt
@@ -28,7 +28,8 @@ import org.onap.ccsdk.cds.blueprintsprocessor.message.service.KafkaStreamConsume
import org.onap.ccsdk.cds.controllerblueprints.core.logger
open class MessagePrioritizationConsumer(
- private val bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService) {
+ private val bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService
+) {
private val log = logger(MessagePrioritizationConsumer::class)
@@ -36,15 +37,17 @@ open class MessagePrioritizationConsumer(
open fun consumerService(selector: String): BlueprintMessageConsumerService {
return bluePrintMessageLibPropertyService
- .blueprintMessageConsumerService(selector)
+ .blueprintMessageConsumerService(selector)
}
- open fun kafkaStreamConsumerFunction(prioritizationConfiguration: PrioritizationConfiguration)
- : KafkaStreamConsumerFunction {
+ open fun kafkaStreamConsumerFunction(prioritizationConfiguration: PrioritizationConfiguration):
+ KafkaStreamConsumerFunction {
return object : KafkaStreamConsumerFunction {
- override suspend fun createTopology(messageConsumerProperties: MessageConsumerProperties,
- additionalConfig: Map<String, Any>?): Topology {
+ override suspend fun createTopology(
+ messageConsumerProperties: MessageConsumerProperties,
+ additionalConfig: Map<String, Any>?
+ ): Topology {
val topology = Topology()
val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
@@ -55,33 +58,49 @@ open class MessagePrioritizationConsumer(
topology.addSource(MessagePrioritizationConstants.SOURCE_INPUT, *topics.toTypedArray())
- topology.addProcessor(MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
- bluePrintProcessorSupplier<ByteArray, ByteArray>(MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
- prioritizationConfiguration),
- MessagePrioritizationConstants.SOURCE_INPUT)
-
- topology.addProcessor(MessagePrioritizationConstants.PROCESSOR_AGGREGATE,
- bluePrintProcessorSupplier<String, String>(MessagePrioritizationConstants.PROCESSOR_AGGREGATE,
- prioritizationConfiguration),
- MessagePrioritizationConstants.PROCESSOR_PRIORITIZE)
-
- topology.addProcessor(MessagePrioritizationConstants.PROCESSOR_OUTPUT,
- bluePrintProcessorSupplier<String, String>(MessagePrioritizationConstants.PROCESSOR_OUTPUT,
- prioritizationConfiguration),
- MessagePrioritizationConstants.PROCESSOR_AGGREGATE)
-
- topology.addSink(MessagePrioritizationConstants.SINK_EXPIRED,
- prioritizationConfiguration.expiredTopic,
- Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
- MessagePrioritizationConstants.PROCESSOR_PRIORITIZE)
-
- /** To receive completed and error messages */
- topology.addSink(MessagePrioritizationConstants.SINK_OUTPUT,
- prioritizationConfiguration.outputTopic,
- Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
+ topology.addProcessor(
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
+ bluePrintProcessorSupplier<ByteArray, ByteArray>(
MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
+ prioritizationConfiguration
+ ),
+ MessagePrioritizationConstants.SOURCE_INPUT
+ )
+
+ topology.addProcessor(
+ MessagePrioritizationConstants.PROCESSOR_AGGREGATE,
+ bluePrintProcessorSupplier<String, String>(
MessagePrioritizationConstants.PROCESSOR_AGGREGATE,
- MessagePrioritizationConstants.PROCESSOR_OUTPUT)
+ prioritizationConfiguration
+ ),
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
+ )
+
+ topology.addProcessor(
+ MessagePrioritizationConstants.PROCESSOR_OUTPUT,
+ bluePrintProcessorSupplier<String, String>(
+ MessagePrioritizationConstants.PROCESSOR_OUTPUT,
+ prioritizationConfiguration
+ ),
+ MessagePrioritizationConstants.PROCESSOR_AGGREGATE
+ )
+
+ topology.addSink(
+ MessagePrioritizationConstants.SINK_EXPIRED,
+ prioritizationConfiguration.expiredTopic,
+ Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE
+ )
+
+ /** To receive completed and error messages */
+ topology.addSink(
+ MessagePrioritizationConstants.SINK_OUTPUT,
+ prioritizationConfiguration.outputTopic,
+ Serdes.String().serializer(), MessagePrioritizationSerde().serializer(),
+ MessagePrioritizationConstants.PROCESSOR_PRIORITIZE,
+ MessagePrioritizationConstants.PROCESSOR_AGGREGATE,
+ MessagePrioritizationConstants.PROCESSOR_OUTPUT
+ )
// Output will be sent to the group-output topic from Processor API
return topology
@@ -102,4 +121,4 @@ open class MessagePrioritizationConsumer(
streamingConsumerService.shutDown()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
index 3358a5643..3ecfa27e0 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationData.kt
@@ -61,8 +61,9 @@ open class UpdateStateRequest : Serializable {
var state: String? = null
}
-data class CorrelationCheckResponse(var message: String? = null,
- var correlated: Boolean = false)
+data class CorrelationCheckResponse(
+ var message: String? = null,
+ var correlated: Boolean = false
+)
data class TypeCorrelationKey(val type: String, val correlationId: String)
-
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizeExtensions.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizeExtensions.kt
index ec061ad47..39d081455 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizeExtensions.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizeExtensions.kt
@@ -21,30 +21,29 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.s
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
-
/**
* Register the MessagePrioritizationStateService and exposed dependency
*/
fun BluePrintDependencyService.messagePrioritizationStateService(): MessagePrioritizationStateService =
- instance(MessagePrioritizationStateService::class)
+ instance(MessagePrioritizationStateService::class)
/**
* Expose messagePrioritizationStateService to AbstractComponentFunction
*/
fun AbstractComponentFunction.messagePrioritizationStateService() =
- BluePrintDependencyService.messagePrioritizationStateService()
+ BluePrintDependencyService.messagePrioritizationStateService()
/**
* MessagePrioritization correlation extensions
*/
fun MessagePrioritization.toFormatedCorrelation(): String {
val ascendingKey = this.correlationId!!.split(",")
- .map { it.trim() }.sorted().joinToString(",")
+ .map { it.trim() }.sorted().joinToString(",")
return ascendingKey
}
fun MessagePrioritization.toTypeNCorrelation(): TypeCorrelationKey {
val ascendingKey = this.correlationId!!.split(",")
- .map { it.trim() }.sorted().joinToString(",")
+ .map { it.trim() }.sorted().joinToString(",")
return TypeCorrelationKey(this.type, ascendingKey)
}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt
index 382cb9c8a..262dcb402 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/api/MessagePrioritizationApi.kt
@@ -21,7 +21,13 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.d
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.service.MessagePrioritizationStateService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.monoMdc
import org.springframework.http.MediaType
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping(value = ["/api/v1/message-prioritization"])
@@ -31,25 +37,30 @@ open class MessagePrioritizationApi(private val messagePrioritizationStateServic
@ResponseBody
fun ping(): String = "Success"
-
@GetMapping(path = ["/{id}"], produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
fun messagePrioritization(@PathVariable(value = "id") id: String) = monoMdc {
messagePrioritizationStateService.getMessage(id)
}
- @PostMapping(path = ["/"], produces = [MediaType.APPLICATION_JSON_VALUE],
- consumes = [MediaType.APPLICATION_JSON_VALUE])
+ @PostMapping(
+ path = ["/"], produces = [MediaType.APPLICATION_JSON_VALUE],
+ consumes = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
fun saveMessagePrioritization(@RequestBody messagePrioritization: MessagePrioritization) = monoMdc {
messagePrioritizationStateService.saveMessage(messagePrioritization)
}
- @PostMapping(path = ["/update-state"], produces = [MediaType.APPLICATION_JSON_VALUE],
- consumes = [MediaType.APPLICATION_JSON_VALUE])
+ @PostMapping(
+ path = ["/update-state"], produces = [MediaType.APPLICATION_JSON_VALUE],
+ consumes = [MediaType.APPLICATION_JSON_VALUE]
+ )
fun updateMessagePrioritizationState(@RequestBody updateMessageState: UpdateStateRequest) =
- monoMdc {
- messagePrioritizationStateService.setMessageState(updateMessageState.id,
- updateMessageState.state!!)
- }
-} \ No newline at end of file
+ monoMdc {
+ messagePrioritizationStateService.setMessageState(
+ updateMessageState.id,
+ updateMessageState.state!!
+ )
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritization.kt
index 15e85b0e7..ce2085f68 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageEntity.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritization.kt
@@ -21,8 +21,15 @@ import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import org.springframework.data.jpa.repository.config.EnableJpaAuditing
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
@EnableJpaAuditing
@EntityListeners(AuditingEntityListener::class)
@@ -30,6 +37,7 @@ import javax.persistence.*
@Table(name = "MESSAGE_PRIORITIZATION")
@Proxy(lazy = false)
open class MessagePrioritization {
+
@Id
@Column(name = "message_id", length = 50)
lateinit var id: String
@@ -78,4 +86,4 @@ open class MessagePrioritization {
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "expiry_date", nullable = false)
var expiryDate: Date? = null
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt
deleted file mode 100644
index 5c2495fd7..000000000
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/MessagePrioritizationRepositories.kt
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright © 2018-2019 AT&T Intellectual Property.
- *
- * 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.blueprintsprocessor.functions.message.prioritization.db
-
-import org.springframework.data.domain.Pageable
-import org.springframework.data.jpa.repository.JpaRepository
-import org.springframework.data.jpa.repository.Modifying
-import org.springframework.data.jpa.repository.Query
-import org.springframework.stereotype.Repository
-import org.springframework.transaction.annotation.Transactional
-import java.util.*
-
-@Repository
-@Transactional(readOnly = true)
-interface PrioritizationMessageRepository : JpaRepository<MessagePrioritization, String> {
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group ORDER BY pm.createdDate asc")
- fun findByGroup(group: String, count: Pageable): List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
- "ORDER BY pm.createdDate asc")
- fun findByGroupAndStateIn(group: String, states: List<String>, count: Pageable): List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
- "ORDER BY pm.updatedDate asc")
- fun findByGroupAndStateInOrderByUpdatedDate(group: String, states: List<String>, count: Pageable)
- : List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
- "AND pm.expiryDate > :expiryCheckDate ORDER BY pm.createdDate asc")
- fun findByGroupAndStateInAndNotExpiredDate(group: String, states: List<String>, expiryCheckDate: Date,
- count: Pageable): List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.state in :states " +
- "AND pm.expiryDate < :expiryCheckDate ORDER BY pm.createdDate asc")
- fun findByStateInAndExpiredDate(states: List<String>, expiryCheckDate: Date,
- count: Pageable): List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
- "AND pm.expiryDate < :expiryCheckDate ORDER BY pm.createdDate asc")
- fun findByGroupAndStateInAndExpiredDate(group: String, states: List<String>, expiryCheckDate: Date,
- count: Pageable): List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group " +
- "AND pm.expiryDate < :expiryCheckDate ORDER BY pm.createdDate asc")
- fun findByByGroupAndExpiredDate(group: String, expiryCheckDate: Date, count: Pageable): List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
- "AND pm.correlationId = :correlationId ORDER BY pm.createdDate asc")
- fun findByGroupAndCorrelationId(group: String, states: List<String>, correlationId: String)
- : List<MessagePrioritization>?
-
- @Query("FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
- "AND pm.type in :types AND pm.correlationId = :correlationId ORDER BY pm.createdDate asc")
- fun findByGroupAndTypesAndCorrelationId(group: String, states: List<String>, types: List<String>,
- correlationId: String): List<MessagePrioritization>?
-
- @Modifying
- @Transactional
- @Query("UPDATE MessagePrioritization SET state = :state, updatedDate = :currentDate " +
- "WHERE id = :id")
- fun setStateForMessageId(id: String, state: String, currentDate: Date): Int
-
- @Modifying
- @Transactional
- @Query("UPDATE MessagePrioritization SET priority = :priority, updatedDate = :currentDate " +
- "WHERE id = :id")
- fun setPriorityForMessageId(id: String, priority: String, currentDate: Date): Int
-
- @Modifying
- @Transactional
- @Query("UPDATE MessagePrioritization SET state = :state, updatedDate = :currentDate " +
- "WHERE id IN :ids")
- fun setStateForMessageIds(ids: List<String>, state: String, currentDate: Date): Int
-
- @Modifying
- @Transactional
- @Query("UPDATE MessagePrioritization SET priority = :priority, updatedDate = :currentDate " +
- "WHERE id IN :ids")
- fun setPriorityForMessageIds(ids: List<String>, priority: String, currentDate: Date): Int
-
- @Modifying
- @Transactional
- @Query("UPDATE MessagePrioritization SET state = :state, error = :error, updatedDate = :currentDate " +
- "WHERE id = :id")
- fun setStateAndErrorForMessageId(id: String, state: String, error: String, currentDate: Date): Int
-
- @Modifying
- @Transactional
- @Query("UPDATE MessagePrioritization SET state = :state, " +
- "aggregatedMessageIds = :aggregatedMessageIds, updatedDate = :currentDate WHERE id = :id")
- fun setStateAndAggregatedMessageIds(id: String, state: String, aggregatedMessageIds: String, currentDate: Date): Int
-
- @Modifying
- @Transactional
- @Query("DELETE FROM MessagePrioritization pm WHERE pm.group = :group")
- fun deleteGroup(group: String)
-
- @Modifying
- @Transactional
- @Query("DELETE FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state IN :states")
- fun deleteGroupAndStateIn(group: String, states: List<String>)
-}
-
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageRepository.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageRepository.kt
new file mode 100644
index 000000000..b0514838a
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/db/PrioritizationMessageRepository.kt
@@ -0,0 +1,160 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.functions.message.prioritization.db
+
+import org.springframework.data.domain.Pageable
+import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.data.jpa.repository.Modifying
+import org.springframework.data.jpa.repository.Query
+import org.springframework.stereotype.Repository
+import org.springframework.transaction.annotation.Transactional
+import java.util.Date
+
+@Repository
+@Transactional(readOnly = true)
+interface PrioritizationMessageRepository : JpaRepository<MessagePrioritization, String> {
+
+ @Query("FROM MessagePrioritization pm WHERE pm.group = :group ORDER BY pm.createdDate asc")
+ fun findByGroup(group: String, count: Pageable): List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
+ "ORDER BY pm.createdDate asc"
+ )
+ fun findByGroupAndStateIn(group: String, states: List<String>, count: Pageable): List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
+ "ORDER BY pm.updatedDate asc"
+ )
+ fun findByGroupAndStateInOrderByUpdatedDate(group: String, states: List<String>, count: Pageable):
+ List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
+ "AND pm.expiryDate > :expiryCheckDate ORDER BY pm.createdDate asc"
+ )
+ fun findByGroupAndStateInAndNotExpiredDate(
+ group: String,
+ states: List<String>,
+ expiryCheckDate: Date,
+ count: Pageable
+ ): List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.state in :states " +
+ "AND pm.expiryDate < :expiryCheckDate ORDER BY pm.createdDate asc"
+ )
+ fun findByStateInAndExpiredDate(
+ states: List<String>,
+ expiryCheckDate: Date,
+ count: Pageable
+ ): List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
+ "AND pm.expiryDate < :expiryCheckDate ORDER BY pm.createdDate asc"
+ )
+ fun findByGroupAndStateInAndExpiredDate(
+ group: String,
+ states: List<String>,
+ expiryCheckDate: Date,
+ count: Pageable
+ ): List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group " +
+ "AND pm.expiryDate < :expiryCheckDate ORDER BY pm.createdDate asc"
+ )
+ fun findByByGroupAndExpiredDate(group: String, expiryCheckDate: Date, count: Pageable): List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
+ "AND pm.correlationId = :correlationId ORDER BY pm.createdDate asc"
+ )
+ fun findByGroupAndCorrelationId(group: String, states: List<String>, correlationId: String):
+ List<MessagePrioritization>?
+
+ @Query(
+ "FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state in :states " +
+ "AND pm.type in :types AND pm.correlationId = :correlationId ORDER BY pm.createdDate asc"
+ )
+ fun findByGroupAndTypesAndCorrelationId(
+ group: String,
+ states: List<String>,
+ types: List<String>,
+ correlationId: String
+ ): List<MessagePrioritization>?
+
+ @Modifying
+ @Transactional
+ @Query(
+ "UPDATE MessagePrioritization SET state = :state, updatedDate = :currentDate " +
+ "WHERE id = :id"
+ )
+ fun setStateForMessageId(id: String, state: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
+ @Query(
+ "UPDATE MessagePrioritization SET priority = :priority, updatedDate = :currentDate " +
+ "WHERE id = :id"
+ )
+ fun setPriorityForMessageId(id: String, priority: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
+ @Query(
+ "UPDATE MessagePrioritization SET state = :state, updatedDate = :currentDate " +
+ "WHERE id IN :ids"
+ )
+ fun setStateForMessageIds(ids: List<String>, state: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
+ @Query(
+ "UPDATE MessagePrioritization SET priority = :priority, updatedDate = :currentDate " +
+ "WHERE id IN :ids"
+ )
+ fun setPriorityForMessageIds(ids: List<String>, priority: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
+ @Query(
+ "UPDATE MessagePrioritization SET state = :state, error = :error, updatedDate = :currentDate " +
+ "WHERE id = :id"
+ )
+ fun setStateAndErrorForMessageId(id: String, state: String, error: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
+ @Query(
+ "UPDATE MessagePrioritization SET state = :state, " +
+ "aggregatedMessageIds = :aggregatedMessageIds, updatedDate = :currentDate WHERE id = :id"
+ )
+ fun setStateAndAggregatedMessageIds(id: String, state: String, aggregatedMessageIds: String, currentDate: Date): Int
+
+ @Modifying
+ @Transactional
+ @Query("DELETE FROM MessagePrioritization pm WHERE pm.group = :group")
+ fun deleteGroup(group: String)
+
+ @Modifying
+ @Transactional
+ @Query("DELETE FROM MessagePrioritization pm WHERE pm.group = :group AND pm.state IN :states")
+ fun deleteGroupAndStateIn(group: String, states: List<String>)
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt
index 6138fa9d3..017658ff6 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationStateService.kt
@@ -25,7 +25,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.springframework.data.domain.PageRequest
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
-import java.util.*
+import java.util.Date
interface MessagePrioritizationStateService {
@@ -37,16 +37,20 @@ interface MessagePrioritizationStateService {
suspend fun getExpiryEligibleMessages(count: Int): List<MessagePrioritization>?
- suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int)
- : List<MessagePrioritization>?
+ suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int):
+ List<MessagePrioritization>?
- suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int)
- : List<MessagePrioritization>?
+ suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int):
+ List<MessagePrioritization>?
suspend fun getExpiredMessages(group: String, expiryDate: Date, count: Int): List<MessagePrioritization>?
- suspend fun getCorrelatedMessages(group: String, states: List<String>, types: List<String>?,
- correlationIds: String): List<MessagePrioritization>?
+ suspend fun getCorrelatedMessages(
+ group: String,
+ states: List<String>,
+ types: List<String>?,
+ correlationIds: String
+ ): List<MessagePrioritization>?
suspend fun updateMessagesState(ids: List<String>, state: String)
@@ -73,8 +77,9 @@ interface MessagePrioritizationStateService {
@Service
open class MessagePrioritizationStateServiceImpl(
- private val prioritizationMessageRepository: PrioritizationMessageRepository)
- : MessagePrioritizationStateService {
+ private val prioritizationMessageRepository: PrioritizationMessageRepository
+) :
+ MessagePrioritizationStateService {
private val log = logger(MessagePrioritizationStateServiceImpl::class)
@@ -89,7 +94,7 @@ open class MessagePrioritizationStateServiceImpl(
override suspend fun getMessage(id: String): MessagePrioritization {
return prioritizationMessageRepository.findById(id).orElseGet(null)
- ?: throw BluePrintProcessorException("couldn't find message for id($id)")
+ ?: throw BluePrintProcessorException("couldn't find message for id($id)")
}
override suspend fun getMessages(ids: List<String>): List<MessagePrioritization>? {
@@ -98,30 +103,42 @@ open class MessagePrioritizationStateServiceImpl(
override suspend fun getExpiryEligibleMessages(count: Int): List<MessagePrioritization>? {
return prioritizationMessageRepository
- .findByStateInAndExpiredDate(arrayListOf(MessageState.NEW.name, MessageState.WAIT.name),
- Date(), PageRequest.of(0, count))
- }
-
- override suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int)
- : List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndStateInAndNotExpiredDate(group,
- states, Date(), PageRequest.of(0, count))
- }
-
- override suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int)
- : List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByGroupAndStateInAndExpiredDate(group,
- states, Date(), PageRequest.of(0, count))
- }
-
- override suspend fun getExpiredMessages(group: String, expiryDate: Date, count: Int)
- : List<MessagePrioritization>? {
- return prioritizationMessageRepository.findByByGroupAndExpiredDate(group,
- expiryDate, PageRequest.of(0, count))
- }
-
- override suspend fun getCorrelatedMessages(group: String, states: List<String>, types: List<String>?,
- correlationIds: String): List<MessagePrioritization>? {
+ .findByStateInAndExpiredDate(
+ arrayListOf(MessageState.NEW.name, MessageState.WAIT.name),
+ Date(), PageRequest.of(0, count)
+ )
+ }
+
+ override suspend fun getMessageForStatesNotExpiredIn(group: String, states: List<String>, count: Int):
+ List<MessagePrioritization>? {
+ return prioritizationMessageRepository.findByGroupAndStateInAndNotExpiredDate(
+ group,
+ states, Date(), PageRequest.of(0, count)
+ )
+ }
+
+ override suspend fun getMessageForStatesExpired(group: String, states: List<String>, count: Int):
+ List<MessagePrioritization>? {
+ return prioritizationMessageRepository.findByGroupAndStateInAndExpiredDate(
+ group,
+ states, Date(), PageRequest.of(0, count)
+ )
+ }
+
+ override suspend fun getExpiredMessages(group: String, expiryDate: Date, count: Int):
+ List<MessagePrioritization>? {
+ return prioritizationMessageRepository.findByByGroupAndExpiredDate(
+ group,
+ expiryDate, PageRequest.of(0, count)
+ )
+ }
+
+ override suspend fun getCorrelatedMessages(
+ group: String,
+ states: List<String>,
+ types: List<String>?,
+ correlationIds: String
+ ): List<MessagePrioritization>? {
return if (!types.isNullOrEmpty()) {
prioritizationMessageRepository.findByGroupAndTypesAndCorrelationId(group, states, types, correlationIds)
} else {
@@ -185,7 +202,9 @@ open class MessagePrioritizationStateServiceImpl(
}
override suspend fun deleteExpiredMessage(group: String, retentionDays: Int) {
- return prioritizationMessageRepository.deleteGroupAndStateIn(group,
- arrayListOf(MessageState.EXPIRED.name))
+ return prioritizationMessageRepository.deleteGroupAndStateIn(
+ group,
+ arrayListOf(MessageState.EXPIRED.name)
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageAggregateProcessor.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageAggregateProcessor.kt
index 45f5c773d..3e697e633 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageAggregateProcessor.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageAggregateProcessor.kt
@@ -22,7 +22,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.M
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.MessageState
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-
open class MessageAggregateProcessor : AbstractMessagePrioritizeProcessor<String, String>() {
private val log = logger(MessageAggregateProcessor::class)
@@ -50,16 +49,21 @@ open class MessageAggregateProcessor : AbstractMessagePrioritizeProcessor<String
storeMessages.forEach { messagePrioritization ->
try {
/** Update the data store */
- messagePrioritizationStateService.setMessageStateANdError(messagePrioritization.id,
- MessageState.ERROR.name, error)
+ messagePrioritizationStateService.setMessageStateANdError(
+ messagePrioritization.id,
+ MessageState.ERROR.name, error
+ )
/** Publish to Error topic */
- this.processorContext.forward(messagePrioritization.id, messagePrioritization,
- To.child(MessagePrioritizationConstants.SINK_OUTPUT))
+ this.processorContext.forward(
+ messagePrioritization.id, messagePrioritization,
+ To.child(MessagePrioritizationConstants.SINK_OUTPUT)
+ )
} catch (sendException: Exception) {
- log.error("failed to update/publish error message(${messagePrioritization.id}) : " +
- "${sendException.message}", e)
+ log.error(
+ "failed to update/publish error message(${messagePrioritization.id}) : " +
+ "${sendException.message}", e
+ )
}
-
}
}
}
@@ -73,4 +77,4 @@ open class MessageAggregateProcessor : AbstractMessagePrioritizeProcessor<String
processorContext.forward(id, id, To.child(MessagePrioritizationConstants.PROCESSOR_OUTPUT))
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageOutputProcessor.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageOutputProcessor.kt
index 34faa1b3b..cf6520df5 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageOutputProcessor.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessageOutputProcessor.kt
@@ -22,7 +22,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.M
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.MessageState
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-
open class MessageOutputProcessor : AbstractMessagePrioritizeProcessor<String, String>() {
private val log = logger(MessageOutputProcessor::class)
@@ -32,4 +31,4 @@ open class MessageOutputProcessor : AbstractMessagePrioritizeProcessor<String, S
val message = messagePrioritizationStateService.updateMessageState(value, MessageState.COMPLETED.name)
processorContext.forward(message.id, message, To.child(MessagePrioritizationConstants.SINK_OUTPUT))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationPunctuators.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationPunctuators.kt
index a745e034c..5435ebe30 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationPunctuators.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationPunctuators.kt
@@ -24,41 +24,46 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.s
import org.onap.ccsdk.cds.blueprintsprocessor.message.kafka.AbstractBluePrintMessagePunctuator
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-
-class MessagePriorityExpiryPunctuator(private val messagePrioritizationStateService: MessagePrioritizationStateService)
- : AbstractBluePrintMessagePunctuator() {
+class MessagePriorityExpiryPunctuator(private val messagePrioritizationStateService: MessagePrioritizationStateService) :
+ AbstractBluePrintMessagePunctuator() {
private val log = logger(MessagePriorityExpiryPunctuator::class)
lateinit var configuration: PrioritizationConfiguration
override suspend fun punctuateNB(timestamp: Long) {
- log.info("**** executing expiry punctuator applicationId(${processorContext.applicationId()}), " +
- "taskId(${processorContext.taskId()})")
+ log.info(
+ "**** executing expiry punctuator applicationId(${processorContext.applicationId()}), " +
+ "taskId(${processorContext.taskId()})"
+ )
val expiryConfiguration = configuration.expiryConfiguration
val fetchMessages = messagePrioritizationStateService
- .getExpiryEligibleMessages(expiryConfiguration.maxPollRecord)
+ .getExpiryEligibleMessages(expiryConfiguration.maxPollRecord)
val expiredIds = fetchMessages?.map { it.id }
if (expiredIds != null && expiredIds.isNotEmpty()) {
messagePrioritizationStateService.updateMessagesState(expiredIds, MessageState.EXPIRED.name)
fetchMessages.forEach { expired ->
- processorContext.forward(expired.id, expired,
- To.child(MessagePrioritizationConstants.SINK_EXPIRED))
+ processorContext.forward(
+ expired.id, expired,
+ To.child(MessagePrioritizationConstants.SINK_EXPIRED)
+ )
}
}
}
}
-class MessagePriorityCleanPunctuator(private val messagePrioritizationStateService: MessagePrioritizationStateService)
- : AbstractBluePrintMessagePunctuator() {
+class MessagePriorityCleanPunctuator(private val messagePrioritizationStateService: MessagePrioritizationStateService) :
+ AbstractBluePrintMessagePunctuator() {
private val log = logger(MessagePriorityCleanPunctuator::class)
lateinit var configuration: PrioritizationConfiguration
override suspend fun punctuateNB(timestamp: Long) {
- log.info("**** executing clean punctuator applicationId(${processorContext.applicationId()}), " +
- "taskId(${processorContext.taskId()})")
- //TODO
+ log.info(
+ "**** executing clean punctuator applicationId(${processorContext.applicationId()}), " +
+ "taskId(${processorContext.taskId()})"
+ )
+ // TODO
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationSerdes.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationSerde.kt
index 00d454727..f2a481f74 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationSerdes.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizationSerde.kt
@@ -37,7 +37,7 @@ open class MessagePrioritizationSerde : Serde<MessagePrioritization> {
return object : Deserializer<MessagePrioritization> {
override fun deserialize(topic: String, data: ByteArray): MessagePrioritization {
return JacksonUtils.readValue(String(data), MessagePrioritization::class.java)
- ?: throw BluePrintProcessorException("failed to convert")
+ ?: throw BluePrintProcessorException("failed to convert")
}
override fun configure(configs: MutableMap<String, *>?, isKey: Boolean) {
@@ -61,4 +61,4 @@ open class MessagePrioritizationSerde : Serde<MessagePrioritization> {
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizeProcessor.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizeProcessor.kt
index 7dde2655d..431e02f30 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizeProcessor.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/topology/MessagePrioritizeProcessor.kt
@@ -29,8 +29,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import java.time.Duration
-import java.util.*
-
+import java.util.UUID
open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteArray, ByteArray>() {
@@ -42,7 +41,7 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
override suspend fun processNB(key: ByteArray, value: ByteArray) {
log.info("***** received in prioritize processor key(${String(key)})")
val messagePrioritize = JacksonUtils.readValue(String(value), MessagePrioritization::class.java)
- ?: throw BluePrintProcessorException("failed to convert")
+ ?: throw BluePrintProcessorException("failed to convert")
try {
// Save the Message
messagePrioritizationStateService.saveMessage(messagePrioritize)
@@ -51,11 +50,15 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
messagePrioritize.error = "failed in Prioritize message(${messagePrioritize.id}) : ${e.message}"
log.error(messagePrioritize.error)
/** Update the data store */
- messagePrioritizationStateService.setMessageStateANdError(messagePrioritize.id, MessageState.ERROR.name,
- messagePrioritize.error!!)
+ messagePrioritizationStateService.setMessageStateANdError(
+ messagePrioritize.id, MessageState.ERROR.name,
+ messagePrioritize.error!!
+ )
/** Publish to Output topic */
- this.processorContext.forward(messagePrioritize.id, messagePrioritize,
- To.child(MessagePrioritizationConstants.SINK_OUTPUT))
+ this.processorContext.forward(
+ messagePrioritize.id, messagePrioritize,
+ To.child(MessagePrioritizationConstants.SINK_OUTPUT)
+ )
}
}
@@ -68,8 +71,10 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
}
override fun close() {
- log.info("closing prioritization processor applicationId(${processorContext.applicationId()}), " +
- "taskId(${processorContext.taskId()})")
+ log.info(
+ "closing prioritization processor applicationId(${processorContext.applicationId()}), " +
+ "taskId(${processorContext.taskId()})"
+ )
expiryCancellable.cancel()
cleanCancellable.cancel()
}
@@ -79,8 +84,10 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
expiryPunctuator.processorContext = processorContext
expiryPunctuator.configuration = prioritizationConfiguration
val expiryConfiguration = prioritizationConfiguration.expiryConfiguration
- expiryCancellable = processorContext.schedule(Duration.ofMillis(expiryConfiguration.frequencyMilli),
- PunctuationType.WALL_CLOCK_TIME, expiryPunctuator)
+ expiryCancellable = processorContext.schedule(
+ Duration.ofMillis(expiryConfiguration.frequencyMilli),
+ PunctuationType.WALL_CLOCK_TIME, expiryPunctuator
+ )
log.info("Expiry punctuator setup complete with frequency(${expiryConfiguration.frequencyMilli})mSec")
}
@@ -89,10 +96,14 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
cleanPunctuator.processorContext = processorContext
cleanPunctuator.configuration = prioritizationConfiguration
val cleanConfiguration = prioritizationConfiguration.cleanConfiguration
- cleanCancellable = processorContext.schedule(Duration.ofDays(cleanConfiguration.expiredRecordsHoldDays.toLong()),
- PunctuationType.WALL_CLOCK_TIME, cleanPunctuator)
- log.info("Clean punctuator setup complete with expiry " +
- "hold(${cleanConfiguration.expiredRecordsHoldDays})days")
+ cleanCancellable = processorContext.schedule(
+ Duration.ofDays(cleanConfiguration.expiredRecordsHoldDays.toLong()),
+ PunctuationType.WALL_CLOCK_TIME, cleanPunctuator
+ )
+ log.info(
+ "Clean punctuator setup complete with expiry " +
+ "hold(${cleanConfiguration.expiredRecordsHoldDays})days"
+ )
}
open suspend fun handleCorrelationAndNextStep(messagePrioritization: MessagePrioritization) {
@@ -102,25 +113,31 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
val group = messagePrioritization.group
val correlationId = messagePrioritization.correlationId!!
val types = getGroupCorrelationTypes(messagePrioritization)
- log.info("checking correlation for message($id), group($group), types($types), " +
- "correlation id($correlationId)")
+ log.info(
+ "checking correlation for message($id), group($group), types($types), " +
+ "correlation id($correlationId)"
+ )
/** Get all previously received messages from database for group and optional types and correlation Id */
- val waitingCorrelatedStoreMessages = messagePrioritizationStateService.getCorrelatedMessages(group,
- arrayListOf(MessageState.NEW.name, MessageState.WAIT.name), types, correlationId)
+ val waitingCorrelatedStoreMessages = messagePrioritizationStateService.getCorrelatedMessages(
+ group,
+ arrayListOf(MessageState.NEW.name, MessageState.WAIT.name), types, correlationId
+ )
/** If multiple records found, then check correlation */
if (!waitingCorrelatedStoreMessages.isNullOrEmpty() && waitingCorrelatedStoreMessages.size > 1) {
/** Check all correlation satisfies */
val correlationResults = MessageCorrelationUtils
- .correlatedMessagesWithTypes(waitingCorrelatedStoreMessages, types)
+ .correlatedMessagesWithTypes(waitingCorrelatedStoreMessages, types)
if (correlationResults.correlated) {
/** Correlation satisfied */
val correlatedIds = waitingCorrelatedStoreMessages.map { it.id }.joinToString(",")
/** Send only correlated ids to next processor */
- this.processorContext.forward(UUID.randomUUID().toString(), correlatedIds,
- To.child(MessagePrioritizationConstants.PROCESSOR_AGGREGATE))
+ this.processorContext.forward(
+ UUID.randomUUID().toString(), correlatedIds,
+ To.child(MessagePrioritizationConstants.PROCESSOR_AGGREGATE)
+ )
} else {
/** Correlation not satisfied */
log.trace("correlation not matched : ${correlationResults.message}")
@@ -135,8 +152,10 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
} else {
// No Correlation check needed, simply forward to next processor.
messagePrioritizationStateService.setMessageState(messagePrioritization.id, MessageState.PRIORITIZED.name)
- this.processorContext.forward(messagePrioritization.id, messagePrioritization.id,
- To.child(MessagePrioritizationConstants.PROCESSOR_AGGREGATE))
+ this.processorContext.forward(
+ messagePrioritization.id, messagePrioritization.id,
+ To.child(MessagePrioritizationConstants.PROCESSOR_AGGREGATE)
+ )
}
}
@@ -145,4 +164,4 @@ open class MessagePrioritizeProcessor : AbstractMessagePrioritizeProcessor<ByteA
open fun getGroupCorrelationTypes(messagePrioritization: MessagePrioritization): List<String>? {
return null
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
index cc30af2f1..fb35df75b 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtils.kt
@@ -43,8 +43,8 @@ object MessageCorrelationUtils {
}
/** Assumption is message is of same group and checking for required types **/
- fun correlatedMessagesWithTypes(collectedMessages: List<MessagePrioritization>, types: List<String>?)
- : CorrelationCheckResponse {
+ fun correlatedMessagesWithTypes(collectedMessages: List<MessagePrioritization>, types: List<String>?):
+ CorrelationCheckResponse {
return if (!types.isNullOrEmpty() && collectedMessages.size > 1) {
@@ -56,8 +56,8 @@ object MessageCorrelationUtils {
val copyTypes = types.toTypedArray().copyOf().toMutableList()
val filteredMessage = collectedMessages.filter {
- !it.correlationId.isNullOrBlank()
- && types.contains(it.type)
+ !it.correlationId.isNullOrBlank() &&
+ types.contains(it.type)
}
var correlatedKeys: MutableSet<String> = mutableSetOf()
if (filteredMessage.isNotEmpty()) {
@@ -79,4 +79,4 @@ object MessageCorrelationUtils {
return correlatedMessages(collectedMessages)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt
index 185022973..4a36a40f3 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessagePrioritizationSample.kt
@@ -21,7 +21,9 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.E
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.PrioritizationConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.ShutDownConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db.MessagePrioritization
-import java.util.*
+import java.util.Calendar
+import java.util.Date
+import java.util.UUID
object MessagePrioritizationSample {
@@ -57,8 +59,10 @@ object MessagePrioritizationSample {
fun sampleMessages(groupName: String, messageState: String, count: Int): List<MessagePrioritization> {
val messages: MutableList<MessagePrioritization> = arrayListOf()
repeat(count) {
- val backPressureMessage = createMessage(groupName, messageState,
- "sample-type", null)
+ val backPressureMessage = createMessage(
+ groupName, messageState,
+ "sample-type", null
+ )
messages.add(backPressureMessage)
}
return messages
@@ -67,26 +71,37 @@ object MessagePrioritizationSample {
fun sampleMessageWithSameCorrelation(groupName: String, messageState: String, count: Int): List<MessagePrioritization> {
val messages: MutableList<MessagePrioritization> = arrayListOf()
repeat(count) {
- val backPressureMessage = createMessage(groupName, messageState, "sample-type",
- "key1=value1,key2=value2")
+ val backPressureMessage = createMessage(
+ groupName, messageState, "sample-type",
+ "key1=value1,key2=value2"
+ )
messages.add(backPressureMessage)
}
return messages
}
- fun sampleMessageWithDifferentTypeSameCorrelation(groupName: String, messageState: String,
- count: Int): List<MessagePrioritization> {
+ fun sampleMessageWithDifferentTypeSameCorrelation(
+ groupName: String,
+ messageState: String,
+ count: Int
+ ): List<MessagePrioritization> {
val messages: MutableList<MessagePrioritization> = arrayListOf()
repeat(count) {
- val backPressureMessage = createMessage(groupName, messageState, "type-$it",
- "key1=value1,key2=value2")
+ val backPressureMessage = createMessage(
+ groupName, messageState, "type-$it",
+ "key1=value1,key2=value2"
+ )
messages.add(backPressureMessage)
}
return messages
}
- fun createMessage(groupName: String, messageState: String, messageType: String,
- messageCorrelationId: String?): MessagePrioritization {
+ fun createMessage(
+ groupName: String,
+ messageState: String,
+ messageType: String,
+ messageCorrelationId: String?
+ ): MessagePrioritization {
return MessagePrioritization().apply {
id = UUID.randomUUID().toString()
@@ -101,4 +116,4 @@ object MessagePrioritizationSample {
expiryDate = currentDatePlusDays(3)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageProcessorUtils.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageProcessorUtils.kt
index 02614d821..7e5862cce 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageProcessorUtils.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageProcessorUtils.kt
@@ -23,8 +23,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyS
object MessageProcessorUtils {
- fun <K, V> bluePrintProcessorSupplier(name: String, prioritizationConfiguration: PrioritizationConfiguration)
- : ProcessorSupplier<K, V> {
+ fun <K, V> bluePrintProcessorSupplier(name: String, prioritizationConfiguration: PrioritizationConfiguration):
+ ProcessorSupplier<K, V> {
return ProcessorSupplier<K, V> {
// Dynamically resolve the Prioritization Processor
val processorInstance = BluePrintDependencyService.instance<AbstractMessagePrioritizeProcessor<K, V>>(name)
@@ -32,5 +32,4 @@ object MessageProcessorUtils {
processorInstance
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
index 84f13dc1d..0ed9598f0 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt
@@ -44,29 +44,32 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.Test
import kotlin.test.assertNotNull
-
@RunWith(SpringRunner::class)
@DataJpaTest
@DirtiesContext
-@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
- MessagePrioritizationConfiguration::class, TestDatabaseConfiguration::class])
-@TestPropertySource(properties =
-[
- "spring.jpa.show-sql=true",
- "spring.jpa.properties.hibernate.show_sql=true",
- "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
-
- "blueprintsprocessor.messageconsumer.prioritize-input.type=kafka-streams-basic-auth",
- "blueprintsprocessor.messageconsumer.prioritize-input.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.prioritize-input.applicationId=test-prioritize-application",
- "blueprintsprocessor.messageconsumer.prioritize-input.topic=prioritize-input-topic",
-
- // To send initial test message
- "blueprintsprocessor.messageproducer.prioritize-input.type=kafka-basic-auth",
- "blueprintsprocessor.messageproducer.prioritize-input.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.prioritize-input.topic=prioritize-input-topic"
-])
+@ContextConfiguration(
+ classes = [BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
+ MessagePrioritizationConfiguration::class, TestDatabaseConfiguration::class]
+)
+@TestPropertySource(
+ properties =
+ [
+ "spring.jpa.show-sql=true",
+ "spring.jpa.properties.hibernate.show_sql=true",
+ "spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl",
+
+ "blueprintsprocessor.messageconsumer.prioritize-input.type=kafka-streams-basic-auth",
+ "blueprintsprocessor.messageconsumer.prioritize-input.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.prioritize-input.applicationId=test-prioritize-application",
+ "blueprintsprocessor.messageconsumer.prioritize-input.topic=prioritize-input-topic",
+
+ // To send initial test message
+ "blueprintsprocessor.messageproducer.prioritize-input.type=kafka-basic-auth",
+ "blueprintsprocessor.messageproducer.prioritize-input.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.prioritize-input.topic=prioritize-input-topic"
+ ]
+)
open class MessagePrioritizationConsumerTest {
@Autowired
@@ -89,7 +92,7 @@ open class MessagePrioritizationConsumerTest {
assertNotNull(prioritizationMessageRepository, "failed to get prioritizationMessageRepository")
val messagePrioritizationService: MessagePrioritizationStateService = BluePrintDependencyService
- .instance(MessagePrioritizationStateService::class)
+ .instance(MessagePrioritizationStateService::class)
assertNotNull(messagePrioritizationService, "failed to get messagePrioritizationService")
MessagePrioritizationSample.sampleMessages(MessageState.NEW.name, 1).forEach {
@@ -106,7 +109,7 @@ open class MessagePrioritizationConsumerTest {
val configuration = MessagePrioritizationSample.samplePrioritizationConfiguration()
val streamingConsumerService = bluePrintMessageLibPropertyService
- .blueprintMessageConsumerService(configuration.inputTopicSelector)
+ .blueprintMessageConsumerService(configuration.inputTopicSelector)
assertNotNull(streamingConsumerService, "failed to get blueprintMessageConsumerService")
val spyStreamingConsumerService = spyk(streamingConsumerService)
@@ -115,11 +118,10 @@ open class MessagePrioritizationConsumerTest {
val messagePrioritizationConsumer = MessagePrioritizationConsumer(bluePrintMessageLibPropertyService)
val spyMessagePrioritizationConsumer = spyk(messagePrioritizationConsumer)
-
// Test Topology
val kafkaStreamConsumerFunction = spyMessagePrioritizationConsumer.kafkaStreamConsumerFunction(configuration)
val messageConsumerProperties = bluePrintMessageLibPropertyService
- .messageConsumerProperties("blueprintsprocessor.messageconsumer.prioritize-input")
+ .messageConsumerProperties("blueprintsprocessor.messageconsumer.prioritize-input")
val topology = kafkaStreamConsumerFunction.createTopology(messageConsumerProperties, null)
assertNotNull(topology, "failed to get create topology")
@@ -130,7 +132,7 @@ open class MessagePrioritizationConsumerTest {
}
/** Integration Kafka Testing, Enable and use this test case only for local desktop testing with real kafka broker */
- //@Test
+ // @Test
fun testMessagePrioritizationConsumer() {
runBlocking {
val messagePrioritizationConsumer = MessagePrioritizationConsumer(bluePrintMessageLibPropertyService)
@@ -138,38 +140,44 @@ open class MessagePrioritizationConsumerTest {
/** Send sample message with every 1 sec */
val blueprintMessageProducerService = bluePrintMessageLibPropertyService
- .blueprintMessageProducerService("prioritize-input") as KafkaBasicAuthMessageProducerService
+ .blueprintMessageProducerService("prioritize-input") as KafkaBasicAuthMessageProducerService
launch {
- MessagePrioritizationSample.sampleMessages(MessageState.NEW.name, 2).forEach {
+ MessagePrioritizationSample.sampleMessages(MessageState.NEW.name, 2).forEach {
delay(100)
val headers: MutableMap<String, String> = hashMapOf()
headers["id"] = it.id
- blueprintMessageProducerService.sendMessageNB(message = it.asJsonString(false),
- headers = headers)
+ blueprintMessageProducerService.sendMessageNB(
+ message = it.asJsonString(false),
+ headers = headers
+ )
}
MessagePrioritizationSample
- .sampleMessageWithSameCorrelation("same-group", MessageState.NEW.name, 2)
- .forEach {
- delay(100)
- val headers: MutableMap<String, String> = hashMapOf()
- headers["id"] = it.id
- blueprintMessageProducerService.sendMessageNB(message = it.asJsonString(false),
- headers = headers)
- }
+ .sampleMessageWithSameCorrelation("same-group", MessageState.NEW.name, 2)
+ .forEach {
+ delay(100)
+ val headers: MutableMap<String, String> = hashMapOf()
+ headers["id"] = it.id
+ blueprintMessageProducerService.sendMessageNB(
+ message = it.asJsonString(false),
+ headers = headers
+ )
+ }
MessagePrioritizationSample
- .sampleMessageWithDifferentTypeSameCorrelation("group-typed", MessageState.NEW.name, 3)
- .forEach {
- delay(2000)
- val headers: MutableMap<String, String> = hashMapOf()
- headers["id"] = it.id
- blueprintMessageProducerService.sendMessageNB(message = it.asJsonString(false),
- headers = headers)
- }
+ .sampleMessageWithDifferentTypeSameCorrelation("group-typed", MessageState.NEW.name, 3)
+ .forEach {
+ delay(2000)
+ val headers: MutableMap<String, String> = hashMapOf()
+ headers["id"] = it.id
+ blueprintMessageProducerService.sendMessageNB(
+ message = it.asJsonString(false),
+ headers = headers
+ )
+ }
}
delay(10000)
messagePrioritizationConsumer.shutDown()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/TestConfiguration.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/TestConfiguration.kt
index 4e3eb191b..37d853cfe 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/TestConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/TestConfiguration.kt
@@ -16,7 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.db.MessagePrioritization
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessageAggregateProcessor
import org.onap.ccsdk.cds.blueprintsprocessor.functions.message.prioritization.topology.MessageOutputProcessor
@@ -36,12 +36,15 @@ open class TestDatabaseConfiguration {
@Bean("primaryDBLibGenericService")
open fun primaryDBLibGenericService(dataSource: DataSource): PrimaryDBLibGenericService {
- return PrimaryDBLibGenericService(NamedParameterJdbcTemplate(dataSource))
+ return PrimaryDBLibGenericService(
+ NamedParameterJdbcTemplate(dataSource)
+ )
}
}
@Service(MessagePrioritizationConstants.PROCESSOR_PRIORITIZE)
open class TestMessagePrioritizeProcessor : MessagePrioritizeProcessor() {
+
override fun getGroupCorrelationTypes(messagePrioritization: MessagePrioritization): List<String>? {
return when (messagePrioritization.group) {
"group-typed" -> arrayListOf("type-0", "type-1", "type-2")
@@ -54,4 +57,4 @@ open class TestMessagePrioritizeProcessor : MessagePrioritizeProcessor() {
open class DefaultMessageAggregateProcessor() : MessageAggregateProcessor()
@Service(MessagePrioritizationConstants.PROCESSOR_OUTPUT)
-open class DefaultMessageOutputProcessor : MessageOutputProcessor() \ No newline at end of file
+open class DefaultMessageOutputProcessor : MessageOutputProcessor()
diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtilsTest.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtilsTest.kt
index b470db909..3876cbba5 100644
--- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/utils/MessageCorrelationUtilsTest.kt
@@ -26,10 +26,14 @@ class MessageCorrelationUtilsTest {
@Test
fun testCorrelationKeysReordered() {
- val message1 = MessagePrioritizationSample.createMessage("sample-group", MessageState.NEW.name,
- "type-0", "key1=value1,key2=value2")
- val message2 = MessagePrioritizationSample.createMessage("sample-group", MessageState.NEW.name,
- "type-0", "key2=value2,key1=value1")
+ val message1 = MessagePrioritizationSample.createMessage(
+ "sample-group", MessageState.NEW.name,
+ "type-0", "key1=value1,key2=value2"
+ )
+ val message2 = MessagePrioritizationSample.createMessage(
+ "sample-group", MessageState.NEW.name,
+ "type-0", "key2=value2,key1=value1"
+ )
val multipleMessages: MutableList<MessagePrioritization> = arrayListOf()
multipleMessages.add(message1)
@@ -43,20 +47,26 @@ class MessageCorrelationUtilsTest {
/** With Types **/
/* Assumption is Same group with different types */
val differentTypesWithSameCorrelationMessages = MessagePrioritizationSample
- .sampleMessageWithDifferentTypeSameCorrelation("sample-group", MessageState.NEW.name, 3)
+ .sampleMessageWithDifferentTypeSameCorrelation("sample-group", MessageState.NEW.name, 3)
val differentTypesWithSameCorrelationMessagesResponse = MessageCorrelationUtils.correlatedMessagesWithTypes(
- differentTypesWithSameCorrelationMessages,
- arrayListOf("type-0", "type-1", "type-2"))
- assertTrue(differentTypesWithSameCorrelationMessagesResponse.correlated,
- "failed to correlate differentTypesWithSameCorrelationMessagesResponse")
+ differentTypesWithSameCorrelationMessages,
+ arrayListOf("type-0", "type-1", "type-2")
+ )
+ assertTrue(
+ differentTypesWithSameCorrelationMessagesResponse.correlated,
+ "failed to correlate differentTypesWithSameCorrelationMessagesResponse"
+ )
/* Assumption is Same group with different types and one missing expected types,
In this case type-3 message is missing */
val differentTypesWithSameCorrelationMessagesResWithMissingType = MessageCorrelationUtils.correlatedMessagesWithTypes(
- differentTypesWithSameCorrelationMessages,
- arrayListOf("type-0", "type-1", "type-2", "type-3"))
- assertTrue(!differentTypesWithSameCorrelationMessagesResWithMissingType.correlated,
- "failed to correlate differentTypesWithSameCorrelationMessagesResWithMissingType")
+ differentTypesWithSameCorrelationMessages,
+ arrayListOf("type-0", "type-1", "type-2", "type-3")
+ )
+ assertTrue(
+ !differentTypesWithSameCorrelationMessagesResWithMissingType.correlated,
+ "failed to correlate differentTypesWithSameCorrelationMessagesResWithMissingType"
+ )
}
@Test
@@ -64,35 +74,48 @@ class MessageCorrelationUtilsTest {
/** With ignoring Types */
/** Assumption is only one message received */
val withSameCorrelationOneMessages = MessagePrioritizationSample
- .sampleMessageWithSameCorrelation("sample-group", MessageState.NEW.name, 1)
+ .sampleMessageWithSameCorrelation("sample-group", MessageState.NEW.name, 1)
val withSameCorrelationOneMessagesResp = MessageCorrelationUtils.correlatedMessagesWithTypes(
- withSameCorrelationOneMessages, null)
- assertTrue(!withSameCorrelationOneMessagesResp.correlated,
- "failed to correlate withSameCorrelationMessagesResp")
+ withSameCorrelationOneMessages, null
+ )
+ assertTrue(
+ !withSameCorrelationOneMessagesResp.correlated,
+ "failed to correlate withSameCorrelationMessagesResp"
+ )
/** Assumption is two message received for same group with same correlation */
val withSameCorrelationMessages = MessagePrioritizationSample
- .sampleMessageWithSameCorrelation("sample-group", MessageState.NEW.name, 2)
+ .sampleMessageWithSameCorrelation("sample-group", MessageState.NEW.name, 2)
val withSameCorrelationMessagesResp = MessageCorrelationUtils.correlatedMessagesWithTypes(
- withSameCorrelationMessages, null)
- assertTrue(withSameCorrelationMessagesResp.correlated,
- "failed to correlate withSameCorrelationMessagesResp")
+ withSameCorrelationMessages, null
+ )
+ assertTrue(
+ withSameCorrelationMessagesResp.correlated,
+ "failed to correlate withSameCorrelationMessagesResp"
+ )
}
@Test
fun differentTypesWithDifferentCorrelationMessage() {
/** Assumption is two message received for same group with different expected types and different correlation */
- val message1 = MessagePrioritizationSample.createMessage("sample-group", MessageState.NEW.name,
- "type-0", "key1=value1,key2=value2")
- val message2 = MessagePrioritizationSample.createMessage("sample-group", MessageState.NEW.name,
- "type-1", "key1=value1,key2=value3")
+ val message1 = MessagePrioritizationSample.createMessage(
+ "sample-group", MessageState.NEW.name,
+ "type-0", "key1=value1,key2=value2"
+ )
+ val message2 = MessagePrioritizationSample.createMessage(
+ "sample-group", MessageState.NEW.name,
+ "type-1", "key1=value1,key2=value3"
+ )
val differentTypesWithDifferentCorrelationMessage: MutableList<MessagePrioritization> = arrayListOf()
differentTypesWithDifferentCorrelationMessage.add(message1)
differentTypesWithDifferentCorrelationMessage.add(message2)
val differentTypesWithDifferentCorrelationMessageResp = MessageCorrelationUtils.correlatedMessagesWithTypes(
- differentTypesWithDifferentCorrelationMessage,
- arrayListOf("type-0", "type-1"))
- assertTrue(!differentTypesWithDifferentCorrelationMessageResp.correlated,
- "failed to correlate differentTypesWithDifferentCorrelationMessageResp")
+ differentTypesWithDifferentCorrelationMessage,
+ arrayListOf("type-0", "type-1")
+ )
+ assertTrue(
+ !differentTypesWithDifferentCorrelationMessageResp.correlated,
+ "failed to correlate differentTypesWithDifferentCorrelationMessageResp"
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
index cdee3903b..1262e8500 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
@@ -31,8 +31,8 @@ import org.springframework.stereotype.Component
@Component("component-netconf-executor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentNetconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService)
- : AbstractComponentFunction() {
+open class ComponentNetconfExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService) :
+ AbstractComponentFunction() {
companion object {
const val SCRIPT_TYPE = "script-type"
@@ -56,9 +56,10 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
}
scriptComponent = componentFunctionScriptingService
- .scriptInstance<AbstractScriptComponentFunction>(this, scriptType,
- scriptClassReference, scriptDependencies)
-
+ .scriptInstance<AbstractScriptComponentFunction>(
+ this, scriptType,
+ scriptClassReference, scriptDependencies
+ )
checkNotNull(scriptComponent) { "failed to get netconf script component" }
@@ -68,7 +69,6 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}")
-
+ .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt
index 73c82acb2..abaa7fed1 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/JsonParserService.kt
@@ -19,6 +19,4 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor
import org.springframework.stereotype.Service
@Service("json-parser-service")
-class JsonParserService {
-
-} \ No newline at end of file
+class JsonParserService
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt
index 5e0b4a117..58e6151f0 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfComponentFunction.kt
@@ -25,40 +25,62 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptC
@Deprecated("Methods defined as extension function of AbstractComponentFunction")
abstract class NetconfComponentFunction : AbstractScriptComponentFunction() {
- @Deprecated(" Use resourceResolutionService method directly",
- replaceWith = ReplaceWith("resourceResolutionService()",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceResolutionService"))
+ @Deprecated(
+ " Use resourceResolutionService method directly",
+ replaceWith = ReplaceWith(
+ "resourceResolutionService()",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resourceResolutionService"
+ )
+ )
open fun resourceResolutionService(): ResourceResolutionService =
- functionDependencyInstanceAsType(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
+ functionDependencyInstanceAsType(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
// Called from python script
- @Deprecated(" Use netconfDeviceInfo method directly",
- replaceWith = ReplaceWith("netconfDeviceInfo(requirementName)",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.netconfDeviceInfo"))
+ @Deprecated(
+ " Use netconfDeviceInfo method directly",
+ replaceWith = ReplaceWith(
+ "netconfDeviceInfo(requirementName)",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.netconfDeviceInfo"
+ )
+ )
fun initializeNetconfConnection(requirementName: String): NetconfDevice {
val deviceInfo = netconfDeviceInfo(requirementName)
return NetconfDevice(deviceInfo)
}
- @Deprecated(" Use artifactContent method directly",
- replaceWith = ReplaceWith("artifactContent(artifactName)",
- "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.artifactContent"))
+ @Deprecated(
+ " Use artifactContent method directly",
+ replaceWith = ReplaceWith(
+ "artifactContent(artifactName)",
+ "org.onap.ccsdk.cds.blueprintsprocessor.services.execution.artifactContent"
+ )
+ )
fun generateMessage(artifactName: String): String {
return bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
}
- @Deprecated(" Use storedContentFromResolvedArtifact method directly",
- replaceWith = ReplaceWith("storedContentFromResolvedArtifact(resolutionKey, artifactName)",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifact"))
+ @Deprecated(
+ " Use storedContentFromResolvedArtifact method directly",
+ replaceWith = ReplaceWith(
+ "storedContentFromResolvedArtifact(resolutionKey, artifactName)",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.storedContentFromResolvedArtifact"
+ )
+ )
fun resolveFromDatabase(resolutionKey: String, artifactName: String): String = runBlocking {
resourceResolutionService().resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
}
- @Deprecated(" Use contentFromResolvedArtifact method directly",
- replaceWith = ReplaceWith("resolveAndGenerateMessage(artifactPrefix)",
- "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resolveAndGenerateMessage"))
+ @Deprecated(
+ " Use contentFromResolvedArtifact method directly",
+ replaceWith = ReplaceWith(
+ "resolveAndGenerateMessage(artifactPrefix)",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.resolveAndGenerateMessage"
+ )
+ )
fun resolveAndGenerateMessage(artifactPrefix: String): String = runBlocking {
- resourceResolutionService().resolveResources(bluePrintRuntimeService, nodeTemplateName,
- artifactPrefix, mapOf())
+ resourceResolutionService().resolveResources(
+ bluePrintRuntimeService, nodeTemplateName,
+ artifactPrefix, mapOf()
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
index 61090f485..a69e4d9d6 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfDevice.kt
@@ -28,4 +28,4 @@ data class NetconfDevice(val deviceInfo: DeviceInfo) {
netconfSession = NetconfSessionImpl(deviceInfo, netconfRpcService)
netconfRpcService.setNetconfSession(netconfSession)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt
index 214969346..f9aa38f8c 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorConfiguration.kt
@@ -25,4 +25,4 @@ import org.springframework.context.annotation.Configuration
@ComponentScan
@EnableConfigurationProperties
@ConditionalOnProperty(name = ["blueprintsprocessor.netconfExecutor.enabled"], havingValue = "true")
-open class NetconfExecutorConfiguration \ No newline at end of file
+open class NetconfExecutorConfiguration
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
index 510621b2e..f52cb0a62 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/NetconfExecutorExtensions.kt
@@ -29,8 +29,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
* Register the Netconf module exposed dependency
*/
fun BluePrintDependencyService.netconfClientService(): ResourceResolutionService =
- instance(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-
+ instance(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
fun AbstractComponentFunction.netconfDevice(requirementName: String): NetconfDevice {
val deviceInfo = netconfDeviceInfo(requirementName)
@@ -43,8 +42,10 @@ fun AbstractComponentFunction.netconfDeviceInfo(requirementName: String): Device
val requirement = blueprintContext.nodeTemplateRequirement(nodeTemplateName, requirementName)
- val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(requirement
- .node!!, requirement.capability!!)
+ val capabilityProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(
+ requirement
+ .node!!, requirement.capability!!
+ )
return netconfDeviceInfo(capabilityProperties)
}
@@ -55,4 +56,4 @@ private fun AbstractComponentFunction.netconfDeviceInfo(capabilityProperty: Muta
/**
* Blocking Methods called from Jython Scripts
- */ \ No newline at end of file
+ */
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
index 2395dddb8..2f10bb56b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfo.kt
@@ -40,7 +40,8 @@ class DeviceInfo {
override fun toString(): String {
return "$ipAddress:$port"
}
- //TODO: should this be a data class instead? Is anything using the JSON serdes?
+
+ // TODO: should this be a data class instead? Is anything using the JSON serdes?
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt
index 7e6a88b48..62a6ac3e3 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfException.kt
@@ -20,5 +20,4 @@ class NetconfException : Exception {
constructor(cause: Throwable) : super(cause)
constructor(message: String) : super(message)
constructor(message: String, cause: Throwable) : super(message, cause)
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt
index 1d5f515d0..744476c2a 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessage.kt
@@ -18,17 +18,18 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
-data class DeviceResponse(var status: String? = null,
- var errorMessage: String? = null,
- var responseMessage: String? = null,
- var requestMessage: String? = null) {
+data class DeviceResponse(
+ var status: String? = null,
+ var errorMessage: String? = null,
+ var responseMessage: String? = null,
+ var requestMessage: String? = null
+) {
fun isSuccess(): Boolean {
return this.status == RpcStatus.SUCCESS && this.errorMessage.isNullOrEmpty()
}
}
-
/**
* Creates an event of a given type and for the specified subject and the current time.
*
@@ -37,10 +38,12 @@ data class DeviceResponse(var status: String? = null,
* @param messageId id of the message related to the event
* @param deviceInfo device of event
*/
-class NetconfReceivedEvent(val type: Type,
- val messagePayload: String = "",
- val messageId: String = "",
- val deviceInfo: DeviceInfo) {
+class NetconfReceivedEvent(
+ val type: Type,
+ val messagePayload: String = "",
+ val messageId: String = "",
+ val deviceInfo: DeviceInfo
+) {
enum class Type {
DEVICE_REPLY,
@@ -48,4 +51,4 @@ class NetconfReceivedEvent(val type: Type,
DEVICE_ERROR,
SESSION_CLOSED
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt
index ecb6267f5..ea93ebd40 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfRpcService.kt
@@ -54,8 +54,11 @@ interface NetconfRpcService {
* @param editDefaultOperation, default set to none. Valid values: merge, replace, create, delete, none
* @return Device response
*/
- fun editConfig(messageContent: String, configTarget: String = NetconfDatastore.CANDIDATE.datastore,
- editDefaultOperation: String = ModifyAction.NONE.action): DeviceResponse
+ fun editConfig(
+ messageContent: String,
+ configTarget: String = NetconfDatastore.CANDIDATE.datastore,
+ editDefaultOperation: String = ModifyAction.NONE.action
+ ): DeviceResponse
/**
* Invoke custom RPC as provided as input.
@@ -96,8 +99,12 @@ interface NetconfRpcService {
* If unspecified, the confirm timeout defaults to 600 seconds.
* @return Device response
*/
- fun commit(confirmed: Boolean = false, confirmTimeout: Int = 60, persist: String = "",
- persistId: String = ""): DeviceResponse
+ fun commit(
+ confirmed: Boolean = false,
+ confirmTimeout: Int = 60,
+ persist: String = "",
+ persistId: String = ""
+ ): DeviceResponse
/**
* Cancels an ongoing confirmed commit. If the <persist-id> parameter is not given,
@@ -148,4 +155,4 @@ interface NetconfRpcService {
* @return Device response
*/
fun get(filter: String): DeviceResponse
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt
index 0272d1a19..ceeb444f7 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfSession.kt
@@ -25,7 +25,6 @@ interface NetconfSession {
*/
fun connect()
-
/**
* Disconnect netconf session
*/
@@ -83,4 +82,4 @@ interface NetconfSession {
* @return Network capabilities as strings in a Set.
*/
fun getDeviceCapabilitiesSet(): Set<String>
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
index 06a71cad3..8f8fc1463 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicator.kt
@@ -22,15 +22,26 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.Net
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.NetconfMessageUtils
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcMessageUtils
import org.slf4j.LoggerFactory
-import java.io.*
-import java.nio.charset.*
-import java.util.concurrent.*
+import java.io.BufferedReader
+import java.io.IOException
+import java.io.InputStream
+import java.io.InputStreamReader
+import java.io.OutputStream
+import java.io.OutputStreamWriter
+import java.nio.charset.StandardCharsets
+import java.util.concurrent.CancellationException
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.ExecutionException
+import java.util.concurrent.TimeUnit
+import java.util.concurrent.TimeoutException
-class NetconfDeviceCommunicator(private var inputStream: InputStream,
- private var out: OutputStream,
- private val deviceInfo: DeviceInfo,
- private val sessionListener: NetconfSessionListener,
- private var replies: MutableMap<String, CompletableFuture<String>>) : Thread() {
+class NetconfDeviceCommunicator(
+ private var inputStream: InputStream,
+ private var out: OutputStream,
+ private val deviceInfo: DeviceInfo,
+ private val sessionListener: NetconfSessionListener,
+ private var replies: MutableMap<String, CompletableFuture<String>>
+) : Thread() {
private val log = LoggerFactory.getLogger(NetconfDeviceCommunicator::class.java)
private var state = NetconfMessageState.NO_MATCHING_PATTERN
@@ -62,9 +73,12 @@ class NetconfDeviceCommunicator(private var inputStream: InputStream,
if (deviceReply == RpcMessageUtils.END_PATTERN) {
socketClosed = true
bufferReader.close()
- sessionListener.accept(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_UNREGISTERED,
- deviceInfo = deviceInfo))
+ sessionListener.accept(
+ NetconfReceivedEvent(
+ NetconfReceivedEvent.Type.DEVICE_UNREGISTERED,
+ deviceInfo = deviceInfo
+ )
+ )
} else {
deviceReply = deviceReply.replace(RpcMessageUtils.END_PATTERN, "")
receivedMessage(deviceReply)
@@ -75,9 +89,12 @@ class NetconfDeviceCommunicator(private var inputStream: InputStream,
if (!NetconfMessageUtils.validateChunkedFraming(deviceReply)) {
log.debug("$deviceInfo: Received badly framed message $deviceReply")
socketClosed = true
- sessionListener.accept(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_ERROR,
- deviceInfo = deviceInfo))
+ sessionListener.accept(
+ NetconfReceivedEvent(
+ NetconfReceivedEvent.Type.DEVICE_ERROR,
+ deviceInfo = deviceInfo
+ )
+ )
} else {
deviceReply = deviceReply.replace(RpcMessageUtils.MSGLEN_REGEX_PATTERN.toRegex(), "")
deviceReply = deviceReply.replace(NetconfMessageUtils.CHUNKED_END_REGEX_PATTERN.toRegex(), "")
@@ -86,20 +103,22 @@ class NetconfDeviceCommunicator(private var inputStream: InputStream,
}
}
}
-
} catch (e: IOException) {
log.warn("$deviceInfo: Fail while reading from channel", e)
- sessionListener.accept(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_ERROR,
- deviceInfo = deviceInfo))
+ sessionListener.accept(
+ NetconfReceivedEvent(
+ NetconfReceivedEvent.Type.DEVICE_ERROR,
+ deviceInfo = deviceInfo
+ )
+ )
}
-
}
/**
* State machine for the Netconf message parser
*/
internal enum class NetconfMessageState {
+
NO_MATCHING_PATTERN {
override fun evaluateChar(c: Char): NetconfMessageState {
return when (c) {
@@ -207,25 +226,29 @@ class NetconfDeviceCommunicator(private var inputStream: InputStream,
log.error("$deviceInfo: Failed to send message : \n $request", e)
future.completeExceptionally(e)
}
-
}
return future
}
private fun receivedMessage(deviceReply: String) {
- if (deviceReply.contains(RpcMessageUtils.RPC_REPLY) || deviceReply.contains(RpcMessageUtils.RPC_ERROR)
- || deviceReply.contains(RpcMessageUtils.HELLO)) {
- log.info("$deviceInfo: Received message with messageId: {} \n $deviceReply",
- NetconfMessageUtils.getMsgId(deviceReply))
-
+ if (deviceReply.contains(RpcMessageUtils.RPC_REPLY) || deviceReply.contains(RpcMessageUtils.RPC_ERROR) ||
+ deviceReply.contains(RpcMessageUtils.HELLO)
+ ) {
+ log.info(
+ "$deviceInfo: Received message with messageId: {} \n $deviceReply",
+ NetconfMessageUtils.getMsgId(deviceReply)
+ )
} else {
log.error("$deviceInfo: Invalid message received: \n $deviceReply")
}
- sessionListener.accept(NetconfReceivedEvent(
- NetconfReceivedEvent.Type.DEVICE_REPLY,
- deviceReply,
- NetconfMessageUtils.getMsgId(deviceReply),
- deviceInfo))
+ sessionListener.accept(
+ NetconfReceivedEvent(
+ NetconfReceivedEvent.Type.DEVICE_REPLY,
+ deviceReply,
+ NetconfMessageUtils.getMsgId(deviceReply),
+ deviceInfo
+ )
+ )
}
/**
@@ -241,7 +264,10 @@ class NetconfDeviceCommunicator(private var inputStream: InputStream,
* @throws TimeoutException if the wait timed outStream
*/
internal fun getFutureFromSendMessage(
- fut: CompletableFuture<String>, timeout: Long, timeUnit: TimeUnit): String {
+ fut: CompletableFuture<String>,
+ timeout: Long,
+ timeUnit: TimeUnit
+ ): String {
return fut.get(timeout, timeUnit)
}
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt
index 2e33b9aa2..b9fab06b1 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImpl.kt
@@ -17,7 +17,11 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.*
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceResponse
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfRpcService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfSession
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.NetconfMessageUtils
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
import org.slf4j.LoggerFactory
@@ -58,7 +62,7 @@ class NetconfRpcServiceImpl(private var deviceInfo: DeviceInfo) : NetconfRpcServ
override fun invokeRpc(rpc: String): DeviceResponse {
var output = DeviceResponse()
- //Attempt to extract the message-id field from the <rpc call
+ // Attempt to extract the message-id field from the <rpc call
val updatedMessageId = messageIdInteger.getAndIncrement().toString()
val origMessageId = NetconfMessageUtils.getMsgId(rpc)
log.info("$deviceInfo: invokeRpc: updating rpc original message-id:($origMessageId) to messageId($updatedMessageId)")
@@ -197,8 +201,11 @@ class NetconfRpcServiceImpl(private var deviceInfo: DeviceInfo) : NetconfRpcServ
return output
}
- override fun editConfig(messageContent: String, configTarget: String,
- editDefaultOperation: String): DeviceResponse {
+ override fun editConfig(
+ messageContent: String,
+ configTarget: String,
+ editDefaultOperation: String
+ ): DeviceResponse {
var response = DeviceResponse()
val messageId = messageIdInteger.getAndIncrement().toString()
log.info("$deviceInfo: editConfig: messageId($messageId)")
@@ -252,7 +259,7 @@ class NetconfRpcServiceImpl(private var deviceInfo: DeviceInfo) : NetconfRpcServ
response.requestMessage = request
val rpcResponse = netconfSession.asyncRpc(request, messageId).get(responseTimeout.toLong(), TimeUnit.SECONDS)
- //TODO catch TimeoutException and ExecutionException
+ // TODO catch TimeoutException and ExecutionException
if (!NetconfMessageUtils.checkReply(rpcResponse)) {
log.error("RPC response didn't pass validation... $rpcResponse")
throw NetconfException(rpcResponse)
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
index 6be93179f..3d3eee8f0 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
@@ -22,14 +22,22 @@ import org.apache.sshd.client.SshClient
import org.apache.sshd.client.channel.ClientChannel
import org.apache.sshd.client.session.ClientSession
import org.apache.sshd.common.FactoryManager
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.*
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfException
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfRpcService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfSession
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfSessionListener
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.NetconfMessageUtils
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcMessageUtils
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.RpcStatus
import org.slf4j.LoggerFactory
import java.io.IOException
-import java.util.*
-import java.util.concurrent.*
+import java.util.Collections
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.ConcurrentHashMap
+import java.util.concurrent.ExecutionException
+import java.util.concurrent.TimeUnit
+import java.util.concurrent.TimeoutException
class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcService: NetconfRpcService) :
NetconfSession {
@@ -55,8 +63,10 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
override fun connect() {
try {
- log.info("$deviceInfo: Connecting to Netconf Device with timeouts C:${deviceInfo.connectTimeout}, " +
- "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}")
+ log.info(
+ "$deviceInfo: Connecting to Netconf Device with timeouts C:${deviceInfo.connectTimeout}, " +
+ "R:${deviceInfo.replyTimeout}, I:${deviceInfo.idleTimeout}"
+ )
startConnection()
log.info("$deviceInfo: Connected to Netconf Device")
} catch (e: NetconfException) {
@@ -67,13 +77,14 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
override fun disconnect() {
var retryNum = 3
- while(rpcService.closeSession(false).status
- .equals(RpcStatus.FAILURE, true) &&retryNum>0) {
+ while (rpcService.closeSession(false).status
+ .equals(RpcStatus.FAILURE, true) && retryNum > 0
+ ) {
log.error("disconnect: graceful disconnect failed, retrying $retryNum times...")
- retryNum--;
+ retryNum--
}
- //if we can't close the session, try to force terminate.
- if(retryNum == 0) {
+ // if we can't close the session, try to force terminate.
+ if (retryNum == 0) {
log.error("disconnect: trying to force-terminate the session.")
rpcService.closeSession(true)
}
@@ -95,13 +106,17 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
checkAndReestablish()
try {
- return streamHandler.getFutureFromSendMessage(streamHandler.sendMessage(formattedRequest, messageId),
- replyTimeout.toLong(), TimeUnit.SECONDS)
+ return streamHandler.getFutureFromSendMessage(
+ streamHandler.sendMessage(formattedRequest, messageId),
+ replyTimeout.toLong(), TimeUnit.SECONDS
+ )
} catch (e: InterruptedException) {
throw NetconfException("$deviceInfo: Interrupted while waiting for reply for request: $formattedRequest", e)
} catch (e: TimeoutException) {
- throw NetconfException("$deviceInfo: Timed out while waiting for reply for request $formattedRequest after $replyTimeout sec.",
- e)
+ throw NetconfException(
+ "$deviceInfo: Timed out while waiting for reply for request $formattedRequest after $replyTimeout sec.",
+ e
+ )
} catch (e: ExecutionException) {
log.warn("$deviceInfo: Closing session($sessionId) due to unexpected Error", e)
try {
@@ -179,10 +194,9 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
} catch (e: Exception) {
throw NetconfException("$deviceInfo: Failed to establish SSH session", e)
}
-
}
- //Needed to unit test connect method interacting with client.start in startClient() below
+ // Needed to unit test connect method interacting with client.start in startClient() below
private fun setupNewSSHClient() {
client = SshClient.setUpDefaultClient()
}
@@ -210,8 +224,12 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
private fun authSession() {
session.addPasswordIdentity(deviceInfo.password)
session.auth().verify(connectionTimeout, TimeUnit.SECONDS)
- val event = session.waitFor(ImmutableSet.of(ClientSession.ClientSessionEvent.WAIT_AUTH,
- ClientSession.ClientSessionEvent.CLOSED, ClientSession.ClientSessionEvent.AUTHED), 0)
+ val event = session.waitFor(
+ ImmutableSet.of(
+ ClientSession.ClientSessionEvent.WAIT_AUTH,
+ ClientSession.ClientSessionEvent.CLOSED, ClientSession.ClientSessionEvent.AUTHED
+ ), 0
+ )
if (!event.contains(ClientSession.ClientSessionEvent.AUTHED)) {
throw NetconfException("$deviceInfo: Failed to authenticate session.")
}
@@ -233,8 +251,10 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
private fun setupHandler() {
val sessionListener: NetconfSessionListener = NetconfSessionListenerImpl(this)
- streamHandler = NetconfDeviceCommunicator(channel.invertedOut, channel.invertedIn, deviceInfo,
- sessionListener, replies)
+ streamHandler = NetconfDeviceCommunicator(
+ channel.invertedOut, channel.invertedIn, deviceInfo,
+ sessionListener, replies
+ )
exchangeHelloMessage()
}
@@ -254,7 +274,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
}
val capabilityMatcher = NetconfMessageUtils.CAPABILITY_REGEX_PATTERN.matcher(serverHelloResponse)
- while (capabilityMatcher.find()) { //TODO: refactor to add unit test easily for device capability accumulation.
+ while (capabilityMatcher.find()) { // TODO: refactor to add unit test easily for device capability accumulation.
deviceCapabilities.add(capabilityMatcher.group(1))
}
}
@@ -300,9 +320,18 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
* internal function for accessing errorReplies for testing.
*/
internal fun getErrorReplies() = errorReplies
+
internal fun clearErrorReplies() = errorReplies.clear()
internal fun clearReplies() = replies.clear()
- internal fun setClient(client: SshClient) { this.client = client }
- internal fun setSession(session: ClientSession) { this.session = session }
- internal fun setChannel(channel: ClientChannel) { this.channel = channel }
+ internal fun setClient(client: SshClient) {
+ this.client = client
+ }
+
+ internal fun setSession(session: ClientSession) {
+ this.session = session
+ }
+
+ internal fun setChannel(channel: ClientChannel) {
+ this.channel = channel
+ }
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImpl.kt
index c8b9c5543..e27b51d16 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImpl.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImpl.kt
@@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.Net
*/
internal class NetconfSessionListenerImpl(private val session: NetconfSessionImpl) : NetconfSessionListener {
+
override fun accept(event: NetconfReceivedEvent) {
when (event.type) {
NetconfReceivedEvent.Type.DEVICE_UNREGISTERED -> session.disconnect()
@@ -36,4 +37,4 @@ internal class NetconfSessionListenerImpl(private val session: NetconfSessionImp
NetconfReceivedEvent.Type.DEVICE_REPLY -> session.addDeviceReply(event.messageId, event.messagePayload)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
index 34816b79b..232dca621 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtils.kt
@@ -28,7 +28,6 @@ import javax.xml.XMLConstants
import javax.xml.parsers.DocumentBuilderFactory
import kotlin.text.Charsets.UTF_8
-
class NetconfMessageUtils {
companion object {
@@ -91,8 +90,12 @@ class NetconfMessageUtils {
return rpc.toString()
}
- fun editConfig(messageId: String, configType: String, defaultOperation: String?,
- newConfiguration: String): String {
+ fun editConfig(
+ messageId: String,
+ configType: String,
+ defaultOperation: String?,
+ newConfiguration: String
+ ): String {
val request = StringBuilder()
request.append("<edit-config>").append(NEW_LINE)
request.append(RpcMessageUtils.TARGET_OPEN).append(NEW_LINE)
@@ -127,16 +130,25 @@ class NetconfMessageUtils {
return doWrappedRpc(messageId, request.toString())
}
- fun commit(messageId: String, confirmed: Boolean, confirmTimeout: Int, persist: String,
- persistId: String): String {
+ fun commit(
+ messageId: String,
+ confirmed: Boolean,
+ confirmTimeout: Int,
+ persist: String,
+ persistId: String
+ ): String {
if (!persist.isEmpty() && !persistId.isEmpty()) {
- throw NetconfException("Can't proceed <commit> with both persist($persist) and " +
- "persistId($persistId) specified. Only one should be specified.")
+ throw NetconfException(
+ "Can't proceed <commit> with both persist($persist) and " +
+ "persistId($persistId) specified. Only one should be specified."
+ )
}
if (confirmed && !persistId.isEmpty()) {
- throw NetconfException("Can't proceed <commit> with both confirmed flag and " +
- "persistId($persistId) specified. Only one should be specified.")
+ throw NetconfException(
+ "Can't proceed <commit> with both confirmed flag and " +
+ "persistId($persistId) specified. Only one should be specified."
+ )
}
val request = StringBuilder()
@@ -221,15 +233,15 @@ class NetconfMessageUtils {
fun closeSession(messageId: String, force: Boolean): String {
val request = StringBuilder()
- //TODO: kill-session without session-id is a cisco-only variant.
- //will fail on JUNIPER device.
- //netconf RFC for kill-session requires session-id
- //Cisco can accept <kill-session/> for current session
- //or <kill-session><session-id>####</session-id></kill-session>
- //as long as session ID is not the same as the current session.
-
- //Juniperhttps://www.juniper.net/documentation/en_US/junos/topics/task/operational/netconf-session-terminating.html
- //will accept only with session-id
+ // TODO: kill-session without session-id is a cisco-only variant.
+ // will fail on JUNIPER device.
+ // netconf RFC for kill-session requires session-id
+ // Cisco can accept <kill-session/> for current session
+ // or <kill-session><session-id>####</session-id></kill-session>
+ // as long as session ID is not the same as the current session.
+
+ // Juniperhttps://www.juniper.net/documentation/en_US/junos/topics/task/operational/netconf-session-terminating.html
+ // will accept only with session-id
if (force) {
request.append("<kill-session/>")
} else {
@@ -254,7 +266,6 @@ class NetconfMessageUtils {
} catch (e: Exception) {
return false
}
-
}
fun getMsgId(message: String): String {
@@ -355,8 +366,8 @@ class NetconfMessageUtils {
if (!message.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
// chunk encode message
message =
- (RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH
- + RpcMessageUtils.NEW_LINE)
+ (RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + message.toByteArray(UTF_8).size + RpcMessageUtils.NEW_LINE + message + RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH +
+ RpcMessageUtils.NEW_LINE)
}
return message
}
@@ -373,7 +384,8 @@ class NetconfMessageUtils {
if (request.startsWith(RpcMessageUtils.NEW_LINE + RpcMessageUtils.HASH)) {
request =
request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0] + RpcMessageUtils.XML_HEADER + request.substring(
- request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length)
+ request.split("<".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[0].length
+ )
} else {
request = RpcMessageUtils.XML_HEADER + "\n" + request
}
@@ -385,12 +397,18 @@ class NetconfMessageUtils {
var request = request
if (request.contains(RpcMessageUtils.MESSAGE_ID_STRING)) {
request =
- request.replaceFirst((RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.NUMBER_BETWEEN_QUOTES_MATCHER).toRegex(),
- RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.QUOTE + messageId + RpcMessageUtils.QUOTE)
+ request.replaceFirst(
+ (RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.NUMBER_BETWEEN_QUOTES_MATCHER).toRegex(),
+ RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.QUOTE + messageId + RpcMessageUtils.QUOTE
+ )
} else if (!request.contains(RpcMessageUtils.MESSAGE_ID_STRING) && !request.contains(
- RpcMessageUtils.HELLO)) {
- request = request.replaceFirst(RpcMessageUtils.END_OF_RPC_OPEN_TAG.toRegex(),
- RpcMessageUtils.QUOTE_SPACE + RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.QUOTE + messageId + RpcMessageUtils.QUOTE + ">")
+ RpcMessageUtils.HELLO
+ )
+ ) {
+ request = request.replaceFirst(
+ RpcMessageUtils.END_OF_RPC_OPEN_TAG.toRegex(),
+ RpcMessageUtils.QUOTE_SPACE + RpcMessageUtils.MESSAGE_ID_STRING + RpcMessageUtils.EQUAL + RpcMessageUtils.QUOTE + messageId + RpcMessageUtils.QUOTE + ">"
+ )
}
return updateRequestLength(request)
}
@@ -398,12 +416,16 @@ class NetconfMessageUtils {
fun updateRequestLength(request: String): String {
if (request.contains(NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH + NEW_LINE)) {
val oldLen =
- Integer.parseInt(request.split(RpcMessageUtils.HASH.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[1].split(
- NEW_LINE.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[0])
+ Integer.parseInt(
+ request.split(RpcMessageUtils.HASH.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[1].split(
+ NEW_LINE.toRegex()
+ ).dropLastWhile({ it.isEmpty() }).toTypedArray()[0]
+ )
val rpcWithEnding = request.substring(request.indexOf('<'))
val firstBlock =
request.split(RpcMessageUtils.MSGLEN_REGEX_PATTERN.toRegex()).dropLastWhile({ it.isEmpty() }).toTypedArray()[1].split(
- (NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH + NEW_LINE).toRegex()).dropLastWhile(
+ (NEW_LINE + RpcMessageUtils.HASH + RpcMessageUtils.HASH + NEW_LINE).toRegex()
+ ).dropLastWhile(
{ it.isEmpty() }).toTypedArray()[0]
var newLen = 0
newLen = firstBlock.toByteArray(UTF_8).size
@@ -420,5 +442,4 @@ class NetconfMessageUtils {
} else false
}
}
-
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
index be3ee4614..f3df55b4b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt
@@ -54,16 +54,22 @@ class ComponentNetconfExecutorTest {
coEvery { blueprintJythonService.jythonComponentInstance(any(), any()) } returns mockAbstractScriptComponentFunction
- val componentFunctionScriptingService = ComponentFunctionScriptingService(applicationContext,
- blueprintJythonService)
+ val componentFunctionScriptingService = ComponentFunctionScriptingService(
+ applicationContext,
+ blueprintJythonService
+ )
val componentNetconfExecutor = ComponentNetconfExecutor(componentFunctionScriptingService)
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("requests/sample-activate-request.json",
- ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
+ "requests/sample-activate-request.json",
+ ExecutionServiceInput::class.java
+ )!!
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val assignmentParams = """{
"ipAddress" : "127.0.0.1",
@@ -77,12 +83,14 @@ class ComponentNetconfExecutorTest {
""".trimIndent()
bluePrintRuntimeService.assignInputs(json.asJsonType())
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams)
+ )
componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService
- //TODO("Set Attribute properties")
+ // TODO("Set Attribute properties")
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-netconf")
stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ComponentNetconfExecutor")
@@ -98,4 +106,3 @@ class ComponentNetconfExecutorTest {
}
}
}
-
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
index 4e1ff655d..ab051597b 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/DeviceInfoTest.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api
-
import org.junit.Test
import kotlin.test.assertEquals
@@ -24,13 +23,13 @@ class DeviceInfoTest {
@Test
fun testToString() {
- val di: DeviceInfo = DeviceInfo().apply {
- username = "username"
- password = "password"
- ipAddress = "localhost"
- port = 2224
- connectTimeout = 10
- }
+ val di: DeviceInfo = DeviceInfo().apply {
+ username = "username"
+ password = "password"
+ ipAddress = "localhost"
+ port = 2224
+ connectTimeout = 10
+ }
assertEquals("localhost:2224", di.toString())
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
index 70bf0158d..e5bacc547 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/api/NetconfMessageTest.kt
@@ -37,13 +37,13 @@ class NetconfMessageTest {
val dr: DeviceResponse = genUnsuccessfulEmptyDeviceResponse()
assertFalse(dr.isSuccess())
- //case 2: Success, but with error message
+ // case 2: Success, but with error message
val dr2: DeviceResponse = genUnsuccessfulEmptyDeviceResponse()
dr2.errorMessage = "Some error message."
assertFalse(dr2.isSuccess())
}
- //helper function to generate a device response
+ // helper function to generate a device response
private fun genSuccessfulEmptyDeviceResponse(): DeviceResponse {
return DeviceResponse().apply {
status = RpcStatus.SUCCESS
@@ -61,5 +61,4 @@ class NetconfMessageTest {
requestMessage = ""
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
index 2240f48c2..1991fc4f6 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfDeviceCommunicatorTest.kt
@@ -16,7 +16,13 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core
-import io.mockk.*
+import io.mockk.CapturingSlot
+import io.mockk.Runs
+import io.mockk.every
+import io.mockk.just
+import io.mockk.mockk
+import io.mockk.spyk
+import io.mockk.verify
import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
@@ -27,9 +33,10 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.utils.R
import java.io.IOException
import java.io.InputStream
import java.io.OutputStream
-import java.nio.charset.*
-import java.util.concurrent.*
-import java.util.regex.*
+import java.nio.charset.StandardCharsets
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.ConcurrentHashMap
+import java.util.regex.Pattern
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
@@ -43,10 +50,9 @@ class NetconfDeviceCommunicatorTest {
private lateinit var replies: MutableMap<String, CompletableFuture<String>>
private val endPatternCharArray: List<Int> = stringToCharArray(RpcMessageUtils.END_PATTERN)
-
companion object {
private val chunkedEnding = "\n##\n"
- //using example from section 4.2 of RFC6242 (https://tools.ietf.org/html/rfc6242#section-4.2)
+ // using example from section 4.2 of RFC6242 (https://tools.ietf.org/html/rfc6242#section-4.2)
private val validChunkedEncodedMsg = """
|
|#4
@@ -82,25 +88,27 @@ class NetconfDeviceCommunicatorTest {
val communicator: NetconfDeviceCommunicator =
NetconfDeviceCommunicator(mockInputStream, mockOutputStream, genDeviceInfo(), netconfSessionListener, replies)
communicator.join()
- //verify
+ // verify
verify { mockInputStream.read(any(), any(), any()) }
}
@Test
fun `NetconfDeviceCommunicator unregisters device on END_PATTERN`() {
- //The reader will generate RpcMessageUtils.END_PATTERN "]]>]]>" which tells Netconf
- //to unregister the device.
- //we want to capture the slot to return the value as inputStreamReader will pass a char array
- //create a slot where NetconfReceivedEvent will be placed to further verify Type.DEVICE_UNREGISTERED
+ // The reader will generate RpcMessageUtils.END_PATTERN "]]>]]>" which tells Netconf
+ // to unregister the device.
+ // we want to capture the slot to return the value as inputStreamReader will pass a char array
+ // create a slot where NetconfReceivedEvent will be placed to further verify Type.DEVICE_UNREGISTERED
val eventSlot = CapturingSlot<NetconfReceivedEvent>()
every { netconfSessionListener.accept(event = capture(eventSlot)) } just Runs
stubInputStream = RpcMessageUtils.END_PATTERN.byteInputStream(StandardCharsets.UTF_8)
val inputStreamSpy = spyk(stubInputStream)
- //RUN the test
- val communicator = NetconfDeviceCommunicator(inputStreamSpy, mockOutputStream,
- genDeviceInfo(), netconfSessionListener, replies)
+ // RUN the test
+ val communicator = NetconfDeviceCommunicator(
+ inputStreamSpy, mockOutputStream,
+ genDeviceInfo(), netconfSessionListener, replies
+ )
communicator.join()
- //Verify
+ // Verify
verify { inputStreamSpy.close() }
assertTrue { eventSlot.isCaptured }
assertEquals(NetconfReceivedEvent.Type.DEVICE_UNREGISTERED, eventSlot.captured.type)
@@ -114,11 +122,13 @@ class NetconfDeviceCommunicatorTest {
stubInputStream = "".byteInputStream(StandardCharsets.UTF_8)
val inputStreamSpy = spyk(stubInputStream)
every { inputStreamSpy.read(any(), any(), any()) } returns 1 andThenThrows IOException("Fake IO Exception")
- //RUN THE TEST
- val communicator = NetconfDeviceCommunicator(inputStreamSpy, mockOutputStream,
- genDeviceInfo(), netconfSessionListener, replies)
+ // RUN THE TEST
+ val communicator = NetconfDeviceCommunicator(
+ inputStreamSpy, mockOutputStream,
+ genDeviceInfo(), netconfSessionListener, replies
+ )
communicator.join()
- //Verify
+ // Verify
assertTrue { eventSlot.isCaptured }
assertEquals(genDeviceInfo(), eventSlot.captured.deviceInfo)
assertEquals(NetconfReceivedEvent.Type.DEVICE_ERROR, eventSlot.captured.type)
@@ -130,14 +140,16 @@ class NetconfDeviceCommunicatorTest {
val payload = "<rpc-reply>blah</rpc-reply>"
stubInputStream = "$payload${RpcMessageUtils.END_PATTERN}".byteInputStream(StandardCharsets.UTF_8)
every { netconfSessionListener.accept(event = capture(eventSlot)) } just Runs
- //RUN the test
- val communicator = NetconfDeviceCommunicator(stubInputStream, mockOutputStream,
- genDeviceInfo(), netconfSessionListener, replies)
+ // RUN the test
+ val communicator = NetconfDeviceCommunicator(
+ stubInputStream, mockOutputStream,
+ genDeviceInfo(), netconfSessionListener, replies
+ )
communicator.join()
- //Verify
- verify(exactly = 0) { mockInputStream.close() } //make sure the reader is not closed as this could cause problems
+ // Verify
+ verify(exactly = 0) { mockInputStream.close() } // make sure the reader is not closed as this could cause problems
assertTrue { eventSlot.isCaptured }
- //eventually, sessionListener is called with message type DEVICE_REPLY
+ // eventually, sessionListener is called with message type DEVICE_REPLY
assertEquals(NetconfReceivedEvent.Type.DEVICE_REPLY, eventSlot.captured.type)
assertEquals(payload, eventSlot.captured.messagePayload)
}
@@ -150,16 +162,18 @@ class NetconfDeviceCommunicatorTest {
every { netconfSessionListener.accept(event = capture(eventSlot)) } just Runs
stubInputStream = payloadWithChunkedEnding.byteInputStream(StandardCharsets.UTF_8)
- //we have to ensure that the input stream is processed, so need to create a spy object.
+ // we have to ensure that the input stream is processed, so need to create a spy object.
val inputStreamSpy = spyk(stubInputStream)
- //RUN the test
- val communicator = NetconfDeviceCommunicator(inputStreamSpy, mockOutputStream, genDeviceInfo(),
- netconfSessionListener, replies)
+ // RUN the test
+ val communicator = NetconfDeviceCommunicator(
+ inputStreamSpy, mockOutputStream, genDeviceInfo(),
+ netconfSessionListener, replies
+ )
communicator.join()
- //Verify
- verify(exactly = 0) { inputStreamSpy.close() } //make sure the reader is not closed as this could cause problems
+ // Verify
+ verify(exactly = 0) { inputStreamSpy.close() } // make sure the reader is not closed as this could cause problems
assertTrue { eventSlot.isCaptured }
- //eventually, sessionListener is called with message type DEVICE_REPLY
+ // eventually, sessionListener is called with message type DEVICE_REPLY
assertEquals(NetconfReceivedEvent.Type.DEVICE_ERROR, eventSlot.captured.type)
assertEquals("", eventSlot.captured.messagePayload)
}
@@ -170,23 +184,25 @@ class NetconfDeviceCommunicatorTest {
stubInputStream = validChunkedEncodedMsg.byteInputStream(StandardCharsets.UTF_8)
val inputStreamSpy = spyk(stubInputStream)
every { netconfSessionListener.accept(event = capture(eventSlot)) } just Runs
- //RUN the test
+ // RUN the test
NetconfDeviceCommunicator(inputStreamSpy, mockOutputStream, genDeviceInfo(), netconfSessionListener, replies).join()
- //Verify
- verify(exactly = 0) { inputStreamSpy.close() } //make sure the reader is not closed as this could cause problems
+ // Verify
+ verify(exactly = 0) { inputStreamSpy.close() } // make sure the reader is not closed as this could cause problems
assertTrue { eventSlot.isCaptured }
- //eventually, sessionListener is called with message type DEVICE_REPLY
+ // eventually, sessionListener is called with message type DEVICE_REPLY
assertEquals(NetconfReceivedEvent.Type.DEVICE_REPLY, eventSlot.captured.type)
- assertEquals("""
+ assertEquals(
+ """
<rpc message-id="102"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<close-session/>
</rpc>
- """.trimIndent(), eventSlot.captured.messagePayload)
+ """.trimIndent(), eventSlot.captured.messagePayload
+ )
}
@Test
- //test to ensure that we have a valid test message to be then used in the case of chunked message
+ // test to ensure that we have a valid test message to be then used in the case of chunked message
// validation code path
fun `chunked sample is validated by the chunked response regex`() {
val test1 = "\n#10\nblah\n##\n"
@@ -196,7 +212,7 @@ class NetconfDeviceCommunicatorTest {
}
@Test
- //Verify that our test sample passes the second pattern for chunked size
+ // Verify that our test sample passes the second pattern for chunked size
fun `chunkSizeMatcher pattern finds matches in chunkedMessageSample`() {
val sizePattern = Pattern.compile("\\n#([1-9][0-9]*)\\n")
val matcher = sizePattern.matcher(validChunkedEncodedMsg)
@@ -207,17 +223,18 @@ class NetconfDeviceCommunicatorTest {
fun `sendMessage writes the request to NetconfDeviceCommunicator Writer`() {
val msgPayload = "some text"
val msgId = "100"
- stubInputStream = "".byteInputStream(StandardCharsets.UTF_8) //no data available in the stream...
+ stubInputStream = "".byteInputStream(StandardCharsets.UTF_8) // no data available in the stream...
every { mockOutputStream.write(any(), any(), any()) } just Runs
every { mockOutputStream.write(msgPayload.toByteArray(Charsets.UTF_8)) } just Runs
every { mockOutputStream.flush() } just Runs
- //Run the command
+ // Run the command
val communicator = NetconfDeviceCommunicator(
stubInputStream, mockOutputStream,
- genDeviceInfo(), netconfSessionListener, replies)
+ genDeviceInfo(), netconfSessionListener, replies
+ )
val completableFuture = communicator.sendMessage(msgPayload, msgId)
communicator.join()
- //verify
+ // verify
verify { mockOutputStream.write(any(), any(), any()) }
verify { mockOutputStream.flush() }
assertFalse { completableFuture.isCompletedExceptionally }
@@ -227,14 +244,15 @@ class NetconfDeviceCommunicatorTest {
fun `sendMessage on IOError returns completed exceptionally future`() {
val msgPayload = "some text"
val msgId = "100"
- every { mockOutputStream.write(any(), any(), any()) } throws IOException("Some IO error occurred!")
- stubInputStream = "".byteInputStream(StandardCharsets.UTF_8) //no data available in the stream...
- //Run the command
+ every { mockOutputStream.write(any(), any(), any()) } throws IOException("Some IO error occurred!")
+ stubInputStream = "".byteInputStream(StandardCharsets.UTF_8) // no data available in the stream...
+ // Run the command
val communicator = NetconfDeviceCommunicator(
stubInputStream, mockOutputStream,
- genDeviceInfo(), netconfSessionListener, replies)
+ genDeviceInfo(), netconfSessionListener, replies
+ )
val completableFuture = communicator.sendMessage(msgPayload, msgId)
- //verify
+ // verify
verify { mockOutputStream.write(any(), any(), any()) }
verify(exactly = 0) { mockOutputStream.flush() }
assertTrue { completableFuture.isCompletedExceptionally }
@@ -248,5 +266,4 @@ class NetconfDeviceCommunicatorTest {
port = 4567
}
}
-
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfMessageStateTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfMessageStateTest.kt
index ce7594c4a..e68e5d865 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfMessageStateTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfMessageStateTest.kt
@@ -27,121 +27,166 @@ class NetconfMessageStateTest {
@Test
fun `NO_MATCHING_PATTERN transitions`() {
- assertEquals(NetconfMessageState.FIRST_BRACKET,
- NetconfMessageState.NO_MATCHING_PATTERN.evaluateChar(']'))
- assertEquals(NetconfMessageState.FIRST_LF,
- NetconfMessageState.NO_MATCHING_PATTERN.evaluateChar('\n'))
-
- charList.minus(listOf(']','\n')).forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.NO_MATCHING_PATTERN.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.FIRST_BRACKET,
+ NetconfMessageState.NO_MATCHING_PATTERN.evaluateChar(']')
+ )
+ assertEquals(
+ NetconfMessageState.FIRST_LF,
+ NetconfMessageState.NO_MATCHING_PATTERN.evaluateChar('\n')
+ )
+
+ charList.minus(listOf(']', '\n')).forEach {
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.NO_MATCHING_PATTERN.evaluateChar(it)
+ )
}
}
@Test
fun `FIRST_BRACKET transitions`() {
- assertEquals(NetconfMessageState.SECOND_BRACKET,
- NetconfMessageState.FIRST_BRACKET.evaluateChar(']'))
+ assertEquals(
+ NetconfMessageState.SECOND_BRACKET,
+ NetconfMessageState.FIRST_BRACKET.evaluateChar(']')
+ )
- charList.minus( ']').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.FIRST_BRACKET.evaluateChar(it))
+ charList.minus(']').forEach {
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.FIRST_BRACKET.evaluateChar(it)
+ )
}
}
@Test
fun `SECOND_BRACKET transitions`() {
- assertEquals(NetconfMessageState.FIRST_BIGGER,
- NetconfMessageState.SECOND_BRACKET.evaluateChar('>'))
+ assertEquals(
+ NetconfMessageState.FIRST_BIGGER,
+ NetconfMessageState.SECOND_BRACKET.evaluateChar('>')
+ )
charList.minus('>').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.SECOND_BRACKET.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.SECOND_BRACKET.evaluateChar(it)
+ )
}
}
@Test
fun `FIRST_BIGGER transitions`() {
- assertEquals(NetconfMessageState.THIRD_BRACKET,
- NetconfMessageState.FIRST_BIGGER.evaluateChar(']'))
+ assertEquals(
+ NetconfMessageState.THIRD_BRACKET,
+ NetconfMessageState.FIRST_BIGGER.evaluateChar(']')
+ )
charList.minus(']').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.FIRST_BIGGER.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.FIRST_BIGGER.evaluateChar(it)
+ )
}
}
@Test
fun `THIRD_BRACKET transitions`() {
- assertEquals(NetconfMessageState.ENDING_BIGGER,
- NetconfMessageState.THIRD_BRACKET.evaluateChar(']'))
+ assertEquals(
+ NetconfMessageState.ENDING_BIGGER,
+ NetconfMessageState.THIRD_BRACKET.evaluateChar(']')
+ )
charList.minus(']').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.THIRD_BRACKET.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.THIRD_BRACKET.evaluateChar(it)
+ )
}
}
@Test
fun `ENDING_BIGGER transitions`() {
- assertEquals(NetconfMessageState.END_PATTERN,
- NetconfMessageState.ENDING_BIGGER.evaluateChar('>'))
+ assertEquals(
+ NetconfMessageState.END_PATTERN,
+ NetconfMessageState.ENDING_BIGGER.evaluateChar('>')
+ )
charList.minus('>').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.ENDING_BIGGER.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.ENDING_BIGGER.evaluateChar(it)
+ )
}
}
@Test
fun `FIRST_LF transitions`() {
- assertEquals(NetconfMessageState.FIRST_HASH,
- NetconfMessageState.FIRST_LF.evaluateChar('#'))
- assertEquals(NetconfMessageState.FIRST_BRACKET,
- NetconfMessageState.FIRST_LF.evaluateChar(']'))
- assertEquals(NetconfMessageState.FIRST_LF,
- NetconfMessageState.FIRST_LF.evaluateChar('\n'))
+ assertEquals(
+ NetconfMessageState.FIRST_HASH,
+ NetconfMessageState.FIRST_LF.evaluateChar('#')
+ )
+ assertEquals(
+ NetconfMessageState.FIRST_BRACKET,
+ NetconfMessageState.FIRST_LF.evaluateChar(']')
+ )
+ assertEquals(
+ NetconfMessageState.FIRST_LF,
+ NetconfMessageState.FIRST_LF.evaluateChar('\n')
+ )
charList.minus(listOf('#', ']', '\n')).forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.FIRST_LF.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.FIRST_LF.evaluateChar(it)
+ )
}
}
@Test
fun `FIRST_HASH transitions`() {
- assertEquals(NetconfMessageState.SECOND_HASH,
- NetconfMessageState.FIRST_HASH.evaluateChar('#'))
+ assertEquals(
+ NetconfMessageState.SECOND_HASH,
+ NetconfMessageState.FIRST_HASH.evaluateChar('#')
+ )
charList.minus('#').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.FIRST_HASH.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.FIRST_HASH.evaluateChar(it)
+ )
}
}
@Test
fun `SECOND_HASH transitions`() {
- assertEquals(NetconfMessageState.END_CHUNKED_PATTERN,
- NetconfMessageState.SECOND_HASH.evaluateChar('\n'))
-
- charList.minus( '\n').forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.SECOND_HASH.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.END_CHUNKED_PATTERN,
+ NetconfMessageState.SECOND_HASH.evaluateChar('\n')
+ )
+
+ charList.minus('\n').forEach {
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.SECOND_HASH.evaluateChar(it)
+ )
}
}
@Test
fun `END_CHUNKED_PATTERN transitions`() {
charList.forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.END_CHUNKED_PATTERN.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.END_CHUNKED_PATTERN.evaluateChar(it)
+ )
}
}
@Test
fun `END_PATTERN transitions`() {
charList.forEach {
- assertEquals(NetconfMessageState.NO_MATCHING_PATTERN,
- NetconfMessageState.END_PATTERN.evaluateChar(it))
+ assertEquals(
+ NetconfMessageState.NO_MATCHING_PATTERN,
+ NetconfMessageState.END_PATTERN.evaluateChar(it)
+ )
}
}
-
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
index 7b0b799bc..9a3652aa1 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfRpcServiceImplTest.kt
@@ -21,7 +21,6 @@ import io.mockk.every
import io.mockk.mockk
import io.mockk.spyk
import org.junit.Before
-
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceResponse
@@ -39,11 +38,15 @@ class NetconfRpcServiceImplTest {
companion object {
private const val someString = "someString"
private const val replyStr = "this is a reply"
- private val failedDeviceResponse = DeviceResponse(status = RpcStatus.FAILURE,
- requestMessage = "request message", responseMessage = replyStr) //responseMessage will be null in this POJO
- private val successfulDeviceResponse = DeviceResponse(status = RpcStatus.SUCCESS,
- requestMessage = "request message", responseMessage = replyStr) //responseMessage will be null in this POJO
- //but will be set later from mockSession
+ private val failedDeviceResponse = DeviceResponse(
+ status = RpcStatus.FAILURE,
+ requestMessage = "request message", responseMessage = replyStr
+ ) // responseMessage will be null in this POJO
+ private val successfulDeviceResponse = DeviceResponse(
+ status = RpcStatus.SUCCESS,
+ requestMessage = "request message", responseMessage = replyStr
+ ) // responseMessage will be null in this POJO
+ // but will be set later from mockSession
private const val msgId = "100"
private const val timeout = 5
private val deviceInfo: DeviceInfo = DeviceInfo().apply {
@@ -375,4 +378,4 @@ class NetconfRpcServiceImplTest {
assertTrue { rpcResult.errorMessage!!.contains("failed in 'closeSession' command") }
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
index e3cda5a49..b94c092e3 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImplTest.kt
@@ -16,7 +16,13 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core
-import io.mockk.*
+import io.mockk.CapturingSlot
+import io.mockk.Runs
+import io.mockk.every
+import io.mockk.just
+import io.mockk.mockk
+import io.mockk.spyk
+import io.mockk.verify
import org.apache.sshd.client.SshClient
import org.apache.sshd.client.channel.ChannelSubsystem
import org.apache.sshd.client.channel.ClientChannel
@@ -37,8 +43,10 @@ import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.IOException
import java.io.InputStream
-import java.nio.charset.*
-import java.util.concurrent.*
+import java.nio.charset.StandardCharsets
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.ExecutionException
+import java.util.concurrent.TimeoutException
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
@@ -106,7 +114,7 @@ class NetconfSessionImplTest {
verify { session["startClient"]() }
}
- //look for NetconfException being thrown when cannot connect
+ // look for NetconfException being thrown when cannot connect
@Test
fun `connect throws NetconfException on error`() {
val errMsg = "$deviceInfo: Failed to establish SSH session"
@@ -119,7 +127,7 @@ class NetconfSessionImplTest {
@Test
fun `disconnect without force option for rpcService succeeds`() {
- //rpcService.closeSession succeeds with status not RpcStatus.FAILURE
+ // rpcService.closeSession succeeds with status not RpcStatus.FAILURE
every { rpcService.closeSession(false) } returns SUCCESSFUL_DEVICE_RESPONSE
every { mockClientSession.close() } just Runs
every { mockSshClient.close() } just Runs
@@ -128,9 +136,9 @@ class NetconfSessionImplTest {
netconfSessionSpy.setSession(mockClientSession)
netconfSessionSpy.setClient(mockSshClient)
netconfSessionSpy.setChannel(mockClientChannel)
- //RUN
+ // RUN
netconfSessionSpy.disconnect()
- //make sure that rpcService.close session is not called again.
+ // make sure that rpcService.close session is not called again.
verify(exactly = 0) { rpcService.closeSession(true) }
verify { mockClientSession.close() }
verify { mockSshClient.close() }
@@ -139,24 +147,23 @@ class NetconfSessionImplTest {
@Test
fun `disconnect with force option for rpcService succeeds`() {
- //rpcService.closeSession succeeds with status not RpcStatus.FAILURE
+ // rpcService.closeSession succeeds with status not RpcStatus.FAILURE
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
every { rpcService.closeSession(any()) } returns
- FAILED_DEVICE_RESPONSE andThen SUCCESSFUL_DEVICE_RESPONSE
+ FAILED_DEVICE_RESPONSE andThen SUCCESSFUL_DEVICE_RESPONSE
every { mockClientSession.close() } just Runs
every { mockSshClient.close() } just Runs
every { mockClientChannel.close() } just Runs
netconfSessionSpy.setSession(mockClientSession)
netconfSessionSpy.setClient(mockSshClient)
netconfSessionSpy.setChannel(mockClientChannel)
- //RUN
+ // RUN
netconfSessionSpy.disconnect()
- //VERIFY
+ // VERIFY
verify(exactly = 2) { rpcService.closeSession(any()) }
verify { mockClientSession.close() }
verify { mockSshClient.close() }
verify { mockClientChannel.close() }
-
}
@Test
@@ -185,9 +192,9 @@ class NetconfSessionImplTest {
every { mockSshClient.isClosed } returns true
netconfSessionSpy.setClient(mockSshClient)
every { netconfSessionSpy["startConnection"]() as Unit } just Runs
- //Call method
+ // Call method
netconfSessionSpy.checkAndReestablish()
- //Verify
+ // Verify
verify { netconfSessionSpy.clearReplies() }
verify { netconfSessionSpy["startConnection"]() }
}
@@ -200,9 +207,9 @@ class NetconfSessionImplTest {
every { netconfSessionSpy["startSession"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
netconfSessionSpy.setSession(mockClientSession)
- //Call method
+ // Call method
netconfSessionSpy.checkAndReestablish()
- //Verify
+ // Verify
verify { netconfSessionSpy.clearReplies() }
verify { netconfSessionSpy["startSession"]() }
}
@@ -217,59 +224,57 @@ class NetconfSessionImplTest {
netconfSessionSpy.setClient(mockSshClient)
netconfSessionSpy.setSession(mockClientSession)
netconfSessionSpy.setChannel(mockClientChannel)
- //Call method
+ // Call method
netconfSessionSpy.checkAndReestablish()
- //Verify
+ // Verify
verify { netconfSessionSpy.clearReplies() }
verify { netconfSessionSpy["openChannel"]() }
}
-
@Test
fun `syncRpc runs normally`() {
val netconfSessionSpy = spyk(netconfSession)
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
- //test the case where SSH connection did not need to be re-established.
- //put an existing item into the replies
+ // test the case where SSH connection did not need to be re-established.
+ // put an existing item into the replies
netconfSessionSpy.getReplies()["somekey"] = CompletableFuture.completedFuture("${futureMsg}2")
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } returns futureRet.get()
every { netconfSessionSpy.checkAndReestablish() } just Runs
- //call the method
+ // call the method
assertEquals(futureMsg, netconfSessionSpy.syncRpc("0", "0"))
- //make sure the replies didn't change
+ // make sure the replies didn't change
assertTrue {
netconfSessionSpy.getReplies().size == 1 &&
- netconfSessionSpy.getReplies().containsKey("somekey")
+ netconfSessionSpy.getReplies().containsKey("somekey")
}
verify(exactly = 0) { netconfSessionSpy.clearReplies() }
}
-
@Test
fun `syncRpc still succeeds and replies are cleared on client disconnect`() {
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
- //put an item into the replies
+ // put an item into the replies
netconfSessionSpy.getReplies()["somekey"] = CompletableFuture.completedFuture("${futureMsg}2")
- //tests the case where SSH session needs to be re-established.
+ // tests the case where SSH session needs to be re-established.
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfSessionSpy["startClient"]() as Unit } just Runs
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } returns futureRet.get()
every { mockSshClient.isClosed } returns true
netconfSessionSpy.setClient(mockSshClient)
- //call the method
+ // call the method
assertEquals(futureMsg, netconfSessionSpy.syncRpc("0", "0"))
- //make sure the replies got cleared out
+ // make sure the replies got cleared out
assertTrue { netconfSessionSpy.getReplies().isEmpty() }
verify(exactly = 1) { netconfSessionSpy.clearReplies() }
}
- //Test for handling CompletableFuture.get returns InterruptedException inside NetconfDeviceCommunicator
+ // Test for handling CompletableFuture.get returns InterruptedException inside NetconfDeviceCommunicator
@Test
fun `syncRpc throws NetconfException if InterruptedException is caught`() {
val expectedExceptionMsg = "$deviceInfo: Interrupted while waiting for reply for request: $formattedRequest"
@@ -279,21 +284,22 @@ class NetconfSessionImplTest {
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws InterruptedException("interrupted")
every { netconfSessionSpy.checkAndReestablish() } just Runs
- //call the method
+ // call the method
netconfSessionSpy.syncRpc("0", "0")
}
}
@Test
fun `syncRpc throws NetconfException if TimeoutException is caught`() {
- val expectedExceptionMsg = "$deviceInfo: Timed out while waiting for reply for request $formattedRequest after ${deviceInfo.replyTimeout} sec."
+ val expectedExceptionMsg =
+ "$deviceInfo: Timed out while waiting for reply for request $formattedRequest after ${deviceInfo.replyTimeout} sec."
assertFailsWith(exceptionClass = NetconfException::class, message = expectedExceptionMsg) {
val netconfSessionSpy = spyk(netconfSession)
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws TimeoutException("timed out")
every { netconfSessionSpy.checkAndReestablish() } just Runs
- //call the method
+ // call the method
netconfSessionSpy.syncRpc("0", "0")
}
}
@@ -306,11 +312,11 @@ class NetconfSessionImplTest {
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws
- ExecutionException("exec exception", Exception("nested exception"))
+ ExecutionException("exec exception", Exception("nested exception"))
every { netconfSessionSpy["close"]() as Unit } just Runs
every { netconfSessionSpy.checkAndReestablish() } just Runs
netconfSessionSpy.setSession(mockClientSession)
- //call the method
+ // call the method
netconfSessionSpy.syncRpc("0", "0")
}
}
@@ -323,12 +329,12 @@ class NetconfSessionImplTest {
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
every { netconfCommunicator.getFutureFromSendMessage(any(), any(), any()) } throws
- ExecutionException("exec exception", Exception("nested exception"))
+ ExecutionException("exec exception", Exception("nested exception"))
every { netconfSessionSpy["close"]() as Unit } throws IOException("got an IO exception")
every { netconfSessionSpy.checkAndReestablish() } just Runs
- //call the method
+ // call the method
netconfSessionSpy.syncRpc("0", "0")
- //make sure replies are cleared...
+ // make sure replies are cleared...
verify(exactly = 1) { netconfSessionSpy.clearReplies() }
verify(exactly = 1) { netconfSessionSpy.clearErrorReplies() }
}
@@ -340,12 +346,12 @@ class NetconfSessionImplTest {
every { netconfSessionSpy.checkAndReestablish() } just Runs
val futureRet: CompletableFuture<String> = CompletableFuture.completedFuture(futureMsg)
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
- //run the method
+ // run the method
val rpcResultFuture = netconfSessionSpy.asyncRpc("0", "0")
every { netconfSessionSpy.checkAndReestablish() } just Runs
- //make sure the future gets resolved
+ // make sure the future gets resolved
assertTrue { rpcResultFuture.get() == futureMsg }
- //make sure that clearReplies wasn't called (reestablishConnection check)
+ // make sure that clearReplies wasn't called (reestablishConnection check)
verify(exactly = 0) { netconfSessionSpy.clearReplies() }
}
@@ -357,7 +363,7 @@ class NetconfSessionImplTest {
throw Exception("blah")
}
every { netconfCommunicator.sendMessage(any(), any()) } returns futureRet
- //run the method
+ // run the method
val rpcResultFuture = netconfSessionSpy.asyncRpc("0", "0")
every { netconfSessionSpy.checkAndReestablish() } just Runs
val e = assertFailsWith(exceptionClass = ExecutionException::class, message = futureMsg) {
@@ -386,11 +392,11 @@ class NetconfSessionImplTest {
fun `startSession tries to connect to user supplied device`() {
every { mockSshClient.start() } just Runs
every { mockSshClient.properties } returns hashMapOf<String, Any>()
- //setup slots to capture values from the invocations
+ // setup slots to capture values from the invocations
val userSlot = CapturingSlot<String>()
val ipSlot = CapturingSlot<String>()
val portSlot = CapturingSlot<Int>()
- //create a future that succeeded
+ // create a future that succeeded
val succeededFuture = DefaultConnectFuture(Any(), Any())
succeededFuture.value = mockClientSession
every { mockSshClient.connect(capture(userSlot), capture(ipSlot), capture(portSlot)) } returns succeededFuture
@@ -398,9 +404,9 @@ class NetconfSessionImplTest {
every { netconfSessionSpy["authSession"]() as Unit } just Runs
every { netconfSessionSpy["setupNewSSHClient"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
- //RUN
+ // RUN
netconfSessionSpy.connect()
- //Verify
+ // Verify
verify { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) }
assertEquals(deviceInfo.username, userSlot.captured)
assertEquals(deviceInfo.ipAddress, ipSlot.captured)
@@ -411,11 +417,11 @@ class NetconfSessionImplTest {
@Test
fun `authSession throws exception if ClientSession is not AUTHED`() {
assertFailsWith(exceptionClass = NetconfException::class) {
- //after client session connects,
+ // after client session connects,
every { mockSshClient.start() } just Runs
every { mockSshClient.properties } returns hashMapOf<String, Any>()
val succeededAuthFuture = DefaultAuthFuture(Any(), Any())
- succeededAuthFuture.value = true //AuthFuture's value is Boolean
+ succeededAuthFuture.value = true // AuthFuture's value is Boolean
val passSlot = CapturingSlot<String>()
every { mockClientSession.addPasswordIdentity(capture(passSlot)) } just Runs
every { mockClientSession.auth() } returns succeededAuthFuture
@@ -423,21 +429,21 @@ class NetconfSessionImplTest {
succeededSessionFuture.value = mockClientSession
every { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) } returns succeededSessionFuture
every { mockClientSession.waitFor(any(), any()) } returns
- setOf(ClientSession.ClientSessionEvent.WAIT_AUTH, ClientSession.ClientSessionEvent.CLOSED)
+ setOf(ClientSession.ClientSessionEvent.WAIT_AUTH, ClientSession.ClientSessionEvent.CLOSED)
val netconfSessionSpy = spyk(netconfSession, recordPrivateCalls = true)
every { netconfSessionSpy["setupNewSSHClient"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
- //RUN
+ // RUN
netconfSessionSpy.connect()
}
}
- //common mock initializer for more weird tests.
- private fun setupOpenChannelMocks(): Unit {
+ // common mock initializer for more weird tests.
+ private fun setupOpenChannelMocks() {
every { mockSshClient.start() } just Runs
every { mockSshClient.properties } returns hashMapOf<String, Any>()
val succeededAuthFuture = DefaultAuthFuture(Any(), Any())
- succeededAuthFuture.value = true //AuthFuture's value is Boolean
+ succeededAuthFuture.value = true // AuthFuture's value is Boolean
val passSlot = CapturingSlot<String>()
every { mockClientSession.addPasswordIdentity(capture(passSlot)) } just Runs
every { mockClientSession.auth() } returns succeededAuthFuture
@@ -445,9 +451,11 @@ class NetconfSessionImplTest {
succeededSessionFuture.value = mockClientSession
every { mockSshClient.connect(deviceInfo.username, deviceInfo.ipAddress, deviceInfo.port) } returns succeededSessionFuture
every { mockClientSession.waitFor(any(), any()) } returns
- setOf(ClientSession.ClientSessionEvent.WAIT_AUTH,
- ClientSession.ClientSessionEvent.CLOSED,
- ClientSession.ClientSessionEvent.AUTHED)
+ setOf(
+ ClientSession.ClientSessionEvent.WAIT_AUTH,
+ ClientSession.ClientSessionEvent.CLOSED,
+ ClientSession.ClientSessionEvent.AUTHED
+ )
every { mockClientSession.createSubsystemChannel(any()) } returns mockSubsystem
every { mockClientChannel.invertedOut } returns sampleInputStream
@@ -456,7 +464,7 @@ class NetconfSessionImplTest {
@Test
fun `authSession opensChannel if ClientSession is AUTHED and session can be opened`() {
- //after client session connects, make sure the client receives authentication
+ // after client session connects, make sure the client receives authentication
setupOpenChannelMocks()
val channelFuture = DefaultOpenFuture(Any(), Any())
channelFuture.value = true
@@ -471,17 +479,16 @@ class NetconfSessionImplTest {
every { netconfSessionSpy["setupNewSSHClient"]() as Unit } just Runs
every { netconfSessionSpy["setupHandler"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
- //Run
+ // Run
netconfSessionSpy.connect()
- //Verify
+ // Verify
verify { mockSubsystem.open() }
}
-
@Test
fun `authSession throws NetconfException if ClientSession is AUTHED but channelFuture timed out or not open`() {
assertFailsWith(exceptionClass = NetconfException::class) {
- //after client session connects, make sure the client receives authentication
+ // after client session connects, make sure the client receives authentication
setupOpenChannelMocks()
val channelFuture = DefaultOpenFuture(Any(), Any())
every { mockSubsystem.open() } returns channelFuture
@@ -489,14 +496,13 @@ class NetconfSessionImplTest {
every { netconfSessionSpy["setupNewSSHClient"]() as Unit } just Runs
every { netconfSessionSpy["setupHandler"]() as Unit } just Runs
netconfSessionSpy.setClient(mockSshClient)
- //Run
+ // Run
netconfSessionSpy.connect()
- //Verify
+ // Verify
verify { mockSubsystem.open() }
}
}
-
@Test
fun `disconnect closes session, channel, and client`() {
every { rpcService.closeSession(false) } returns SUCCESSFUL_DEVICE_RESPONSE
@@ -507,16 +513,16 @@ class NetconfSessionImplTest {
netconfSessionSpy.setChannel(mockClientChannel)
netconfSessionSpy.setClient(mockSshClient)
netconfSessionSpy.setSession(mockClientSession)
- //RUN
+ // RUN
netconfSessionSpy.disconnect()
- //VERIFY
+ // VERIFY
verify { mockClientSession.close() }
verify { mockClientChannel.close() }
verify { mockSshClient.close() }
}
@Test
- fun `disconnect wraps IOException if channel doesn't close`() { //this test is equivalent to others
+ fun `disconnect wraps IOException if channel doesn't close`() { // this test is equivalent to others
every { rpcService.closeSession(false) } returns SUCCESSFUL_DEVICE_RESPONSE
every { mockClientSession.close() } just Runs
every { mockClientChannel.close() } throws IOException("channel doesn't want to close!")
@@ -524,9 +530,9 @@ class NetconfSessionImplTest {
netconfSessionSpy.setChannel(mockClientChannel)
netconfSessionSpy.setClient(mockSshClient)
netconfSessionSpy.setSession(mockClientSession)
- //RUN
+ // RUN
netconfSessionSpy.disconnect()
- //VERIFY
+ // VERIFY
verify { mockClientSession.close() }
}
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
index f3817b7fc..ab762e821 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionListenerImplTest.kt
@@ -16,16 +16,16 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.core
-import org.junit.Test
import io.mockk.every
import io.mockk.mockk
import io.mockk.verifyAll
import org.junit.Before
+import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.DeviceInfo
import org.onap.ccsdk.cds.blueprintsprocessor.functions.netconf.executor.api.NetconfReceivedEvent
class NetconfSessionListenerImplTest {
- //Note: mockk's verifyAll is akin to verify with verifyNoMoreInteractions in Mockito
+ // Note: mockk's verifyAll is akin to verify with verifyNoMoreInteractions in Mockito
private val netconSession = mockk<NetconfSessionImpl>()
@Before
@@ -36,7 +36,7 @@ class NetconfSessionListenerImplTest {
}
@Test
- //NetconfReceivedEvent wth DEVICE_UNREGISTERED TYPE should call disconnect() on the NetconfSession
+ // NetconfReceivedEvent wth DEVICE_UNREGISTERED TYPE should call disconnect() on the NetconfSession
fun deviceUnregisteredMessageShouldCallSessionDisconnect() {
val netconfSessionListener = NetconfSessionListenerImpl(netconSession)
val event: NetconfReceivedEvent = genEventByType(NetconfReceivedEvent.Type.DEVICE_UNREGISTERED)
@@ -45,7 +45,7 @@ class NetconfSessionListenerImplTest {
}
@Test
- //NetconfReceivedEvent wth SESSION_CLOSED TYPE should ALSO call disconnect() on the NetconfSession
+ // NetconfReceivedEvent wth SESSION_CLOSED TYPE should ALSO call disconnect() on the NetconfSession
fun sessionClosedMessageShouldCallSesionDisconnect() {
val netconfSessionListener = NetconfSessionListenerImpl(netconSession)
val event: NetconfReceivedEvent = genEventByType(NetconfReceivedEvent.Type.SESSION_CLOSED)
@@ -54,8 +54,8 @@ class NetconfSessionListenerImplTest {
}
@Test
- //NetconfReceivedEvent wth DEVICE_ERROR TYPE should call addDeviceErrorReply() on the NetconfSession
- //with the event message payload
+ // NetconfReceivedEvent wth DEVICE_ERROR TYPE should call addDeviceErrorReply() on the NetconfSession
+ // with the event message payload
fun deviceErrorMessageShouldCallAddDeviceErrorReply() {
val netconfSessionListener = NetconfSessionListenerImpl(netconSession)
val event: NetconfReceivedEvent = genEventByType(NetconfReceivedEvent.Type.DEVICE_ERROR)
@@ -64,7 +64,7 @@ class NetconfSessionListenerImplTest {
}
@Test
- //NetconfReceivedEvent wth DEVICE_REPLY TYPE should call addDeviceReply(messageId, payload) on the NetconfSession
+ // NetconfReceivedEvent wth DEVICE_REPLY TYPE should call addDeviceReply(messageId, payload) on the NetconfSession
fun deviceReplyMessageShouldCallAddDeviceReply() {
val netconfSessionListener = NetconfSessionListenerImpl(netconSession)
val event: NetconfReceivedEvent = genEventByType(NetconfReceivedEvent.Type.DEVICE_REPLY)
@@ -74,14 +74,14 @@ class NetconfSessionListenerImplTest {
/**
* Helper to generate {@link NetconfReceivedEvent} object based on the {@link NetconfReceivedEvent.Type}
- * @param type {@link NetconfReceivedEvent.Type} of event
+ * @param type {@link NetconfReceivedEvent.Type} of event
*/
private fun genEventByType(type: NetconfReceivedEvent.Type): NetconfReceivedEvent {
return NetconfReceivedEvent(
- type,
- "messagePayload",
- "messageId",
- DeviceInfo()
+ type,
+ "messagePayload",
+ "messageId",
+ DeviceInfo()
)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtilsTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtilsTest.kt
index fcfa12570..cec0fda66 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/NetconfMessageUtilsTest.kt
@@ -40,7 +40,7 @@ class NetconfMessageUtilsTest {
@Test
fun `test getConfig with filterContent parameter null`() {
- val outcome = NetconfMessageUtils.getConfig("customMessageId", "customConfigType",null)
+ val outcome = NetconfMessageUtils.getConfig("customMessageId", "customConfigType", null)
val expectation = JacksonUtils.getClassPathFileContent("netconf-messages/getConfig-response-filterContent-null.xml")
assertEquals("getConfig return was not correct", expectation, outcome)
}
@@ -54,16 +54,20 @@ class NetconfMessageUtilsTest {
@Test
fun `test editConfig with all parameters present`() {
- val outcome = NetconfMessageUtils.editConfig("customMessageId", "customConfigType", "customDefaultOperation",
- "customNewConfiguration")
+ val outcome = NetconfMessageUtils.editConfig(
+ "customMessageId", "customConfigType", "customDefaultOperation",
+ "customNewConfiguration"
+ )
val expectation = JacksonUtils.getClassPathFileContent("netconf-messages/editConfig-response-all-parameters.xml")
assertEquals("editConfig return was not correct", expectation, outcome)
}
@Test
fun `test editConfig with defaultOperation parameter null`() {
- val outcome = NetconfMessageUtils.editConfig("customMessageId", "customConfigType", null,
- "customNewConfiguration")
+ val outcome = NetconfMessageUtils.editConfig(
+ "customMessageId", "customConfigType", null,
+ "customNewConfiguration"
+ )
val expectation = JacksonUtils.getClassPathFileContent("netconf-messages/editConfig-response-defaultOperation-null.xml")
assertEquals("editConfig return was not correct", expectation, outcome)
}
@@ -92,21 +96,24 @@ class NetconfMessageUtilsTest {
@Test
fun `test commit with confirmed true, persistId empty and persist empty`() {
val outcome = NetconfMessageUtils.commit("customMessageId", true, 1, "", "")
- val expectation = JacksonUtils.getClassPathFileContent("netconf-messages/commit-response-confirmed-true-and-persistId-empty-and-persist-empty.xml")
+ val expectation =
+ JacksonUtils.getClassPathFileContent("netconf-messages/commit-response-confirmed-true-and-persistId-empty-and-persist-empty.xml")
assertEquals("commit return was not correct", expectation, outcome)
}
@Test
fun `test commit with confirmed false, persistId non-empty and persist empty`() {
val outcome = NetconfMessageUtils.commit("customMessageId", false, 1, "", "customPersistId")
- val expectation = JacksonUtils.getClassPathFileContent("netconf-messages/commit-response-confirmed-false-and-persistId-empty-and-persist-not-empty.xml")
+ val expectation =
+ JacksonUtils.getClassPathFileContent("netconf-messages/commit-response-confirmed-false-and-persistId-empty-and-persist-not-empty.xml")
assertEquals("commit return was not correct", expectation, outcome)
}
@Test
fun `test commit with confirmed false, persistId empty and persist non-empty`() {
val outcome = NetconfMessageUtils.commit("customMessageId", false, 1, "customPersist", "")
- val expectation = JacksonUtils.getClassPathFileContent("netconf-messages/commit-response-confirmed-false-and-persistId-not-empty-and-persist-empty.xml")
+ val expectation =
+ JacksonUtils.getClassPathFileContent("netconf-messages/commit-response-confirmed-false-and-persistId-not-empty-and-persist-empty.xml")
assertEquals("commit return was not correct", expectation, outcome)
}
@@ -173,7 +180,7 @@ class NetconfMessageUtilsTest {
assertEquals("closeSession return was not correct", expectation, outcome)
}
- //TODO validateRPCXML
+ // TODO validateRPCXML
@Test
fun `test getMsgId with valid message`() {
@@ -197,6 +204,5 @@ class NetconfMessageUtilsTest {
assertEquals("getMsgId return was not correct", expectation, outcome)
}
-//TODO validateChunkedFraming
-
+ // TODO validateChunkedFraming
}
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
index b80dc2d88..0d791c2a6 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/utils/RpcMessageUtilsTest.kt
@@ -27,29 +27,28 @@ class RpcMessageUtilsTest {
@Test
fun getConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<get-config><source><candidate/></source><filter type=\"subtree\">Test-Filter-Content</filter>"
- + "</get-config></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<get-config><source><candidate/></source><filter type=\"subtree\">Test-Filter-Content</filter>" +
+ "</get-config></rpc>")
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
val filterContent = "Test-Filter-Content"
val result =
- NetconfMessageUtils.getConfig(messageId, configType, filterContent).replace("[\n\r\t]".toRegex(), "")
+ NetconfMessageUtils.getConfig(messageId, configType, filterContent).replace("[\n\r\t]".toRegex(), "")
assertTrue(NetconfMessageUtils.validateRPCXML(result))
Assert.assertEquals(checkString, result)
}
-
@Test
fun editConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<edit-config><target><candidate/></target><default-operation>Test-Default-Operation</default-operation>"
- + "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<edit-config><target><candidate/></target><default-operation>Test-Default-Operation</default-operation>" +
+ "<config xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">Test-Filter-Content</config></edit-config></rpc>")
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -57,7 +56,7 @@ class RpcMessageUtilsTest {
val defaultOperation = "Test-Default-Operation"
val result =
- NetconfMessageUtils.editConfig(messageId, configType, defaultOperation, filterContent).replace("[\n\r\t]".toRegex(), "")
+ NetconfMessageUtils.editConfig(messageId, configType, defaultOperation, filterContent).replace("[\n\r\t]".toRegex(), "")
assertTrue(NetconfMessageUtils.validateRPCXML(result))
Assert.assertEquals(checkString, result)
@@ -65,9 +64,9 @@ class RpcMessageUtilsTest {
@Test
fun validate() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<validate><source><candidate/></source></validate></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<validate><source><candidate/></source></validate></rpc>")
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -81,16 +80,16 @@ class RpcMessageUtilsTest {
@Test
fun cancelCommit() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<cancel-commit>" +
- "<persist-id>1234</persist-id>" +
- "</cancel-commit></rpc>")
+ ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<cancel-commit>" +
+ "<persist-id>1234</persist-id>" +
+ "</cancel-commit></rpc>")
val messageId = "Test-Message-ID"
val cancelCommitPersistId =
- NetconfMessageUtils.cancelCommit(messageId, "1234").replace("[\n\r\t]".toRegex(), "")
+ NetconfMessageUtils.cancelCommit(messageId, "1234").replace("[\n\r\t]".toRegex(), "")
assertTrue(NetconfMessageUtils.validateRPCXML(cancelCommitPersistId))
Assert.assertEquals(checkString, cancelCommitPersistId)
@@ -99,10 +98,10 @@ class RpcMessageUtilsTest {
@Test
fun cancelCommitNoPersistId() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<cancel-commit>" +
- "</cancel-commit></rpc>")
+ ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<cancel-commit>" +
+ "</cancel-commit></rpc>")
val messageId = "Test-Message-ID"
@@ -114,31 +113,30 @@ class RpcMessageUtilsTest {
@Test
fun commit() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<commit></commit></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<commit></commit></rpc>")
val messageId = "Test-Message-ID"
val commit = NetconfMessageUtils.commit(messageId, false, 0, "", "").replace("[\n\r\t]".toRegex(), "")
val commitWithPersistButNotConfirmed =
- NetconfMessageUtils.commit(messageId, false, 0, "1234", "").replace("[\n\r\t]".toRegex(), "")
+ NetconfMessageUtils.commit(messageId, false, 0, "1234", "").replace("[\n\r\t]".toRegex(), "")
assertTrue(NetconfMessageUtils.validateRPCXML(commit))
Assert.assertEquals(checkString, commit)
Assert.assertEquals(checkString, commitWithPersistButNotConfirmed)
-
}
@Test
fun commitPersistId() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<commit>" +
- "<persist-id>1234</persist-id>" +
- "</commit></rpc>")
+ ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<commit>" +
+ "<persist-id>1234</persist-id>" +
+ "</commit></rpc>")
val messageId = "Test-Message-ID"
@@ -149,8 +147,10 @@ class RpcMessageUtilsTest {
try {
NetconfMessageUtils.commit(messageId, true, 30, "", "1234").replace("[\n\r\t]".toRegex(), "")
} catch (e: NetconfException) {
- Assert.assertEquals("Can't proceed <commit> with both confirmed flag and persistId(1234) specified. Only one should be specified.",
- e.message)
+ Assert.assertEquals(
+ "Can't proceed <commit> with both confirmed flag and persistId(1234) specified. Only one should be specified.",
+ e.message
+ )
return
}
@@ -160,13 +160,13 @@ class RpcMessageUtilsTest {
@Test
fun commitPersist() {
val checkString =
- ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
- "<commit>" +
- "<confirmed/>" +
- "<confirm-timeout>30</confirm-timeout>" +
- "<persist>1234</persist>" +
- "</commit></rpc>")
+ ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<commit>" +
+ "<confirmed/>" +
+ "<confirm-timeout>30</confirm-timeout>" +
+ "<persist>1234</persist>" +
+ "</commit></rpc>")
val messageId = "Test-Message-ID"
@@ -178,8 +178,10 @@ class RpcMessageUtilsTest {
try {
NetconfMessageUtils.commit(messageId, false, 30, "1234", "1234").replace("[\n\r\t]".toRegex(), "")
} catch (e: NetconfException) {
- Assert.assertEquals("Can't proceed <commit> with both persist(1234) and persistId(1234) specified. Only one should be specified.",
- e.message)
+ Assert.assertEquals(
+ "Can't proceed <commit> with both persist(1234) and persistId(1234) specified. Only one should be specified.",
+ e.message
+ )
return
}
fail()
@@ -187,9 +189,9 @@ class RpcMessageUtilsTest {
@Test
fun unlock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<unlock><target><candidate/></target></unlock></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<unlock><target><candidate/></target></unlock></rpc>")
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -202,9 +204,9 @@ class RpcMessageUtilsTest {
@Test
fun deleteConfig() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<delete-config><target><candidate/></target></delete-config></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<delete-config><target><candidate/></target></delete-config></rpc>")
val messageId = "Test-Message-ID"
val netconfTargetConfig = NetconfDatastore.CANDIDATE.datastore
@@ -226,9 +228,9 @@ class RpcMessageUtilsTest {
@Test
fun discardChanges() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<discard-changes/></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<discard-changes/></rpc>")
val messageId = "Test-Message-ID"
@@ -240,9 +242,9 @@ class RpcMessageUtilsTest {
@Test
fun lock() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">"
- + "<lock><target><candidate/></target></lock></rpc>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<rpc message-id=\"Test-Message-ID\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" +
+ "<lock><target><candidate/></target></lock></rpc>")
val messageId = "Test-Message-ID"
val configType = NetconfDatastore.CANDIDATE.datastore
@@ -271,8 +273,8 @@ class RpcMessageUtilsTest {
@Test
fun createHelloString() {
- val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> "
- +"<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
+ val checkString = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
+ "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
val capability = listOf<String>("hi", "hello")
@@ -303,19 +305,19 @@ class RpcMessageUtilsTest {
}
@Test
- fun formatRPCRequest(){
+ fun formatRPCRequest() {
val checkString = ("#199" +
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> <capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>" +
"##")
- val request = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> "
- +"<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
+ val request = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> " +
+ "<capabilities> <capability>hi</capability> <capability>hello</capability> </capabilities></hello>]]>]]>")
val messageId = "Test-Message-ID"
- val capabilities = setOf<String>("hi", "hello","urn:ietf:params:netconf:base:1.1")
+ val capabilities = setOf<String>("hi", "hello", "urn:ietf:params:netconf:base:1.1")
- val result = NetconfMessageUtils.formatRPCRequest(request,messageId,capabilities).replace("[\n\r\t]".toRegex(), "")
+ val result = NetconfMessageUtils.formatRPCRequest(request, messageId, capabilities).replace("[\n\r\t]".toRegex(), "")
Assert.assertEquals(checkString, result)
}
@@ -329,5 +331,4 @@ class RpcMessageUtilsTest {
println("Don't fear \"[Fatal Error] :1:1: Content is not allowed in prolog.\" TODO: adjust logging for NetconfMessageUtils")
assertFalse { NetconfMessageUtils.validateRPCXML("really bad XML ~~~input") }
}
-
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
index e13c150ee..b0dcc6339 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
@@ -36,8 +36,10 @@ import org.springframework.stereotype.Component
@Component("component-jython-executor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentJythonExecutor(private var applicationContext: ApplicationContext,
- private val blueprintJythonService: BlueprintJythonService) : AbstractComponentFunction() {
+open class ComponentJythonExecutor(
+ private var applicationContext: ApplicationContext,
+ private val blueprintJythonService: BlueprintJythonService
+) : AbstractComponentFunction() {
private val log = LoggerFactory.getLogger(ComponentJythonExecutor::class.java)
@@ -51,27 +53,26 @@ open class ComponentJythonExecutor(private var applicationContext: ApplicationCo
// Invoke Jython Component Script
componentFunction.executeScript(executionServiceInput)
-
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
+ .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
}
private fun populateJythonComponentInstance() {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
+ .nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName)
val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
+ ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val pythonFileName = artifactDefinition.file
- ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
+ ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
@@ -80,7 +81,7 @@ open class ComponentJythonExecutor(private var applicationContext: ApplicationCo
checkNotEmpty(content) { "artifact ($artifactName) content is empty" }
val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode
- ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
+ ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
val jythonInstance: MutableMap<String, Any> = hashMapOf()
jythonInstance["log"] = LoggerFactory.getLogger(pythonClassName)
@@ -101,4 +102,4 @@ open class ComponentJythonExecutor(private var applicationContext: ApplicationCo
componentFunction.workflowName = workflowName
componentFunction.scriptType = BluePrintConstants.SCRIPT_JYTHON
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index 91d51757a..ddfaf9ac2 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -17,12 +17,22 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
import com.fasterxml.jackson.databind.JsonNode
-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.RemoteIdentifier
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StatusType
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceConstant
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.RemoteScriptExecutionService
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotBlank
import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
+import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
@@ -33,8 +43,7 @@ import org.springframework.stereotype.Component
@ConditionalOnBean(name = [ExecutionServiceConstant.SERVICE_GRPC_REMOTE_SCRIPT_EXECUTION])
@Component("component-remote-python-executor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentRemotePythonExecutor(private val remoteScriptExecutionService: RemoteScriptExecutionService)
- : AbstractComponentFunction() {
+open class ComponentRemotePythonExecutor(private val remoteScriptExecutionService: RemoteScriptExecutionService) : AbstractComponentFunction() {
private val log = LoggerFactory.getLogger(ComponentRemotePythonExecutor::class.java)!!
@@ -103,9 +112,12 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
// If packages are defined, then install in remote server
if (packages != null) {
- val prepareEnvInput = PrepareRemoteEnvInput(requestId = processId,
- remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName,
- blueprintVersion = blueprintVersion),
+ val prepareEnvInput = PrepareRemoteEnvInput(
+ requestId = processId,
+ remoteIdentifier = RemoteIdentifier(
+ blueprintName = blueprintName,
+ blueprintVersion = blueprintVersion
+ ),
packages = packages
)
val prepareEnvOutput = remoteScriptExecutionService.prepareEnv(prepareEnvInput)
@@ -128,18 +140,21 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val properties = dynamicProperties?.returnNullIfMissing()?.rootFieldsToMap() ?: hashMapOf()
val remoteExecutionInput = RemoteScriptExecutionInput(
- requestId = processId,
- remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
- command = scriptCommand,
- properties = properties)
+ requestId = processId,
+ remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
+ command = scriptCommand,
+ properties = properties
+ )
val remoteExecutionOutput = remoteScriptExecutionService.executeCommand(remoteExecutionInput)
val logs = JacksonUtils.jsonNodeFromObject(remoteExecutionOutput.response)
if (remoteExecutionOutput.status != StatusType.SUCCESS) {
setNodeOutputErrors(remoteExecutionOutput.status.name, logs, remoteExecutionOutput.payload)
} else {
- setNodeOutputProperties(remoteExecutionOutput.status.name.asJsonPrimitive(), logs,
- remoteExecutionOutput.payload)
+ setNodeOutputProperties(
+ remoteExecutionOutput.status.name.asJsonPrimitive(), logs,
+ remoteExecutionOutput.payload
+ )
}
}
} catch (e: Exception) {
@@ -179,7 +194,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
/**
* Utility function to set the output properties and errors of the executor node, in cas of errors
*/
- private fun setNodeOutputErrors(status: String, message: JsonNode, artifacts: JsonNode = "".asJsonPrimitive() ) {
+ private fun setNodeOutputErrors(status: String, message: JsonNode, artifacts: JsonNode = "".asJsonPrimitive()) {
setAttribute(ATTRIBUTE_EXEC_CMD_STATUS, status.asJsonPrimitive())
log.info("Executor status : $status")
setAttribute(ATTRIBUTE_EXEC_CMD_LOG, message)
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
index c2055f9a5..6998f0229 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt
@@ -33,36 +33,54 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
/** Component Extensions **/
fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType {
- return nodeType(id = "component-remote-python-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- description = "This is Remote Python Execution Component.") {
-
- attribute(ComponentRemotePythonExecutor.ATTRIBUTE_PREPARE_ENV_LOG, BluePrintConstants.DATA_TYPE_STRING,
- false)
- attribute(ComponentRemotePythonExecutor.ATTRIBUTE_EXEC_CMD_LOG, BluePrintConstants.DATA_TYPE_LIST,
- false) {
+ return nodeType(
+ id = "component-remote-python-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ description = "This is Remote Python Execution Component."
+ ) {
+
+ attribute(
+ ComponentRemotePythonExecutor.ATTRIBUTE_PREPARE_ENV_LOG, BluePrintConstants.DATA_TYPE_STRING,
+ false
+ )
+ attribute(
+ ComponentRemotePythonExecutor.ATTRIBUTE_EXEC_CMD_LOG, BluePrintConstants.DATA_TYPE_LIST,
+ false
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
- attribute(ComponentRemotePythonExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
- false)
+ attribute(
+ ComponentRemotePythonExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
+ false
+ )
operation("ComponentRemotePythonExecutor", "ComponentRemotePythonExecutor Operation") {
inputs {
- property(ComponentRemotePythonExecutor.INPUT_ENDPOINT_SELECTOR, BluePrintConstants.DATA_TYPE_STRING,
- false, "Remote Container or Server selector name.") {
+ property(
+ ComponentRemotePythonExecutor.INPUT_ENDPOINT_SELECTOR, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Remote Container or Server selector name."
+ ) {
defaultValue(ComponentRemotePythonExecutor.DEFAULT_SELECTOR)
}
- property(ComponentRemotePythonExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
- false, "Dynamic Json Content or DSL Json reference.")
-
- property(ComponentRemotePythonExecutor.INPUT_ARGUMENT_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
- false, "Argument Json Content or DSL Json reference.")
-
- property(ComponentRemotePythonExecutor.INPUT_COMMAND, BluePrintConstants.DATA_TYPE_STRING,
- true, "Command to execute.")
-
- property(ComponentRemotePythonExecutor.INPUT_PACKAGES, BluePrintConstants.DATA_TYPE_LIST,
- false, "Packages to install based on type.") {
+ property(
+ ComponentRemotePythonExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Dynamic Json Content or DSL Json reference."
+ )
+
+ property(
+ ComponentRemotePythonExecutor.INPUT_ARGUMENT_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Argument Json Content or DSL Json reference."
+ )
+
+ property(
+ ComponentRemotePythonExecutor.INPUT_COMMAND, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Command to execute."
+ )
+
+ property(
+ ComponentRemotePythonExecutor.INPUT_PACKAGES, BluePrintConstants.DATA_TYPE_LIST,
+ false, "Packages to install based on type."
+ ) {
entrySchema("dt-system-packages")
}
}
@@ -71,9 +89,11 @@ fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType {
}
fun BluePrintTypes.dataTypeDtSystemPackages(): DataType {
- return dataType(id = "dt-system-packages", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
- description = "This represent System Package Data Type") {
+ return dataType(
+ id = "dt-system-packages", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
+ description = "This represent System Package Data Type"
+ ) {
property("type", BluePrintConstants.DATA_TYPE_LIST, true, "") {
constrain {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
@@ -87,10 +107,12 @@ fun BluePrintTypes.dataTypeDtSystemPackages(): DataType {
}
/** Component Builder */
-fun BluePrintTypes.nodeTemplateComponentRemotePythonExecutor(id: String,
- description: String,
- block: ComponentRemotePythonExecutorNodeTemplateBuilder.() -> Unit)
- : NodeTemplate {
+fun BluePrintTypes.nodeTemplateComponentRemotePythonExecutor(
+ id: String,
+ description: String,
+ block: ComponentRemotePythonExecutorNodeTemplateBuilder.() -> Unit
+):
+ NodeTemplate {
return ComponentRemotePythonExecutorNodeTemplateBuilder(id, description).apply(block).build()
}
@@ -112,9 +134,11 @@ class DtSystemPackageDataTypeBuilder : PropertiesAssignmentBuilder() {
}
class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder, ComponentRemotePythonExecutorNodeTemplateBuilder.InputsBuilder,
- ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(id, "component-remote-python-executor",
- "ComponentRemotePythonExecutor", description) {
+ AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder, ComponentRemotePythonExecutorNodeTemplateBuilder.InputsBuilder,
+ ComponentRemotePythonExecutorNodeTemplateBuilder.OutputsBuilder>(
+ id, "component-remote-python-executor",
+ "ComponentRemotePythonExecutor", description
+ ) {
class InputsBuilder : PropertiesAssignmentBuilder() {
@@ -161,5 +185,4 @@ class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description:
}
class OutputsBuilder : PropertiesAssignmentBuilder()
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt
index 7e00206ca..891b09d88 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/JythonComponentFunction.kt
@@ -29,5 +29,4 @@ open class JythonComponentFunction : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
throw BluePrintException("Not Implemented required")
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 11396b7e9..4e919272a 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -36,11 +36,15 @@ import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [PythonExecutorConfiguration::class, PythonExecutorProperty::class,
- ComponentJythonExecutor::class, MockInstanceConfiguration::class])
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"])
+@ContextConfiguration(
+ classes = [PythonExecutorConfiguration::class, PythonExecutorProperty::class,
+ ComponentJythonExecutor::class, MockInstanceConfiguration::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprints.processor.functions.python.executor.modulePaths=./../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../components/scripts/python/ccsdk_blueprints"]
+)
class ComponentJythonExecutorTest {
@Autowired
@@ -50,11 +54,15 @@ class ComponentJythonExecutorTest {
fun testPythonComponentInjection() {
runBlocking {
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("payload/requests/sample-activate-request.json",
- ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-activate-request.json",
+ ExecutionServiceInput::class.java
+ )!!
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython")
@@ -68,6 +76,5 @@ class ComponentJythonExecutorTest {
executionServiceInput.stepData = stepInputData
componentJythonExecutor.applyNB(executionServiceInput)
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
index 18eb77b80..5e77937bc 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSLTest.kt
@@ -25,23 +25,27 @@ class ComponentRemotePythonExecutorDSLTest {
@Test
fun testNodeTypeComponentRemotePythonExecutor() {
val nodeType = BluePrintTypes.nodeTypeComponentRemotePythonExecutor()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeComponentRemotePythonExecutor")
}
@Test
fun testNodeTemplateComponentRemotePythonExecutor() {
- val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemotePythonExecutor("test-nodetemplate",
- "test nodetemplate") {
+ val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemotePythonExecutor(
+ "test-nodetemplate",
+ "test nodetemplate"
+ ) {
definedOperation("test operation") {
inputs {
endpointSelector("remote-container")
command("python sample.py")
- dynamicProperties("""{
+ dynamicProperties(
+ """{
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent())
+ }""".trimIndent()
+ )
argumentProperties("""["one", "two"]""")
packages {
type("pip")
@@ -50,7 +54,7 @@ class ComponentRemotePythonExecutorDSLTest {
}
}
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateComponentRemotePythonExecutor")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index 89af42579..847b08018 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -22,7 +22,12 @@ 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
@@ -34,7 +39,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
-
class ComponentRemotePythonExecutorTest {
@Test
@@ -45,16 +49,21 @@ class ComponentRemotePythonExecutorTest {
val componentRemotePythonExecutor = ComponentRemotePythonExecutor(remoteScriptExecutionService)
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile("payload/requests/sample-remote-python-request.json",
- ExecutionServiceInput::class.java)!!
-
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-remote-python-request.json",
+ ExecutionServiceInput::class.java
+ )!!
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("123456-1000",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "123456-1000",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts"
+ )
/** Load Workflow Inputs */
- bluePrintRuntimeService.assignWorkflowInputs("execute-remote-python",
- executionServiceInput.payload.get("execute-remote-python-request"))
+ bluePrintRuntimeService.assignWorkflowInputs(
+ "execute-remote-python",
+ executionServiceInput.payload.get("execute-remote-python-request")
+ )
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "execute-remote-python")
@@ -97,13 +106,16 @@ class ComponentRemotePythonExecutorTest {
val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python")
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
+ )
stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor")
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
+ )
stepMetaData.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
+ )
val mapper = ObjectMapper()
val rootNode = mapper.createObjectNode()
@@ -112,13 +124,16 @@ class ComponentRemotePythonExecutorTest {
val operationalInputs: MutableMap<String, JsonNode> = hashMapOf()
operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
- "execute-remote-python")
+ BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE,
+ "execute-remote-python"
+ )
operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
- "ComponentRemotePythonExecutor")
+ BluePrintConstants.PROPERTY_CURRENT_INTERFACE,
+ "ComponentRemotePythonExecutor"
+ )
operationalInputs.putJsonElement(
- BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process"
+ )
operationalInputs.putJsonElement("endpoint-selector", "aai")
operationalInputs.putJsonElement("dynamic-properties", rootNode)
operationalInputs.putJsonElement("command", "./run.sh")
@@ -126,8 +141,9 @@ class ComponentRemotePythonExecutorTest {
every {
svc.resolveNodeTemplateInterfaceOperationInputs(
- "execute-remote-python",
- "ComponentRemotePythonExecutor", "process")
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
} returns operationalInputs
val stepInputData = StepData().apply {
@@ -136,42 +152,51 @@ class ComponentRemotePythonExecutorTest {
}
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile(
- "payload/requests/sample-remote-python-request.json",
- ExecutionServiceInput::class.java)!!
+ .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")
+ "execute-remote-python",
+ "ComponentRemotePythonExecutor", "process"
+ )
} returns operationOutputs
val bluePrintRuntimeService = BluePrintMetadataUtils
- .getBluePrintRuntime("123456-1000",
- "./../../../../components/model-" +
- "catalog/blueprint-model/test-blueprint/" +
- "remote_scripts")
+ .getBluePrintRuntime(
+ "123456-1000",
+ "./../../../../components/model-" +
+ "catalog/blueprint-model/test-blueprint/" +
+ "remote_scripts"
+ )
every {
svc.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script")
+ "execute-remote-python", "component-script"
+ )
} returns bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(
- "execute-remote-python", "component-script")
+ "execute-remote-python", "component-script"
+ )
every {
svc.setNodeTemplateAttributeValue(
- "execute-remote-python", "prepare-environment-logs",
- "prepared successfully".asJsonPrimitive())
+ "execute-remote-python", "prepare-environment-logs",
+ "prepared successfully".asJsonPrimitive()
+ )
} returns Unit
every {
svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs", "N/A".asJsonPrimitive())
+ "execute-remote-python",
+ "execute-command-logs", "N/A".asJsonPrimitive()
+ )
} returns Unit
every {
svc.setNodeTemplateAttributeValue(
- "execute-remote-python",
- "execute-command-logs",
- "processed successfully".asJsonPrimitive())
+ "execute-remote-python",
+ "execute-command-logs",
+ "processed successfully".asJsonPrimitive()
+ )
} returns Unit
every {
@@ -211,6 +236,5 @@ class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
}
override suspend fun close() {
-
}
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt
index 33f68e273..c523b6653 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/mock/MockInstanceConfiguration.kt
@@ -21,12 +21,11 @@ import org.springframework.context.annotation.Configuration
@Configuration
open class MockInstanceConfiguration {
+
@Bean(name = ["json-parser-service", "netconf-rpc-service"])
open fun createComponentFunction(): MockJythonService {
return MockJythonService()
}
}
-class MockJythonService {
-
-} \ No newline at end of file
+class MockJythonService
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt
index 3a3750acb..a65ec585b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceAssignmentRuntimeService.kt
@@ -5,8 +5,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
-class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext)
- : DefaultBluePrintRuntimeService(id, bluePrintContext) {
+class ResourceAssignmentRuntimeService(private var id: String, private var bluePrintContext: BluePrintContext) :
+ DefaultBluePrintRuntimeService(id, bluePrintContext) {
private lateinit var resolutionId: String
private var resourceStore: MutableMap<String, JsonNode> = hashMapOf()
@@ -25,7 +25,7 @@ class ResourceAssignmentRuntimeService(private var id: String, private var blueP
fun getResolutionStore(key: String): JsonNode {
return resourceStore[key]
- ?: throw BluePrintProcessorException("failed to get execution property ($key)")
+ ?: throw BluePrintProcessorException("failed to get execution property ($key)")
}
fun checkResolutionStore(key: String): Boolean {
@@ -58,7 +58,7 @@ class ResourceAssignmentRuntimeService(private var id: String, private var blueP
fun getDictionaryStore(key: String): JsonNode {
return resourceStore["dictionary-$key"]
- ?: throw BluePrintProcessorException("failed to get execution property (dictionary-$key)")
+ ?: throw BluePrintProcessorException("failed to get execution property (dictionary-$key)")
}
fun checkDictionaryStore(key: String): Boolean {
@@ -84,5 +84,4 @@ class ResourceAssignmentRuntimeService(private var id: String, private var blueP
fun getDoubleFromDictionaryStore(key: String): Double? {
return getResolutionStore("dictionary-$key").asDouble()
}
-
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
index 141bad619..7c6ba603b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSL.kt
@@ -24,32 +24,42 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
/** Resource Definition DSL **/
-fun BluePrintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit)
- : MutableMap<String, ResourceDefinition> {
+fun BluePrintTypes.resourceDefinitions(block: ResourceDefinitionsBuilder.() -> Unit):
+ MutableMap<String, ResourceDefinition> {
return ResourceDefinitionsBuilder().apply(block).build()
}
-fun BluePrintTypes.resourceDefinition(name: String, description: String,
- block: ResourceDefinitionBuilder.() -> Unit): ResourceDefinition {
+fun BluePrintTypes.resourceDefinition(
+ name: String,
+ description: String,
+ block: ResourceDefinitionBuilder.() -> Unit
+): ResourceDefinition {
return ResourceDefinitionBuilder(name, description).apply(block).build()
}
/** Resource Mapping DSL **/
-fun BluePrintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit)
- : MutableMap<String, ResourceAssignment> {
+fun BluePrintTypes.resourceAssignments(block: ResourceAssignmentsBuilder.() -> Unit):
+ MutableMap<String, ResourceAssignment> {
return ResourceAssignmentsBuilder().apply(block).build()
}
-fun BluePrintTypes.resourceAssignment(name: String, dictionaryName: String, dictionarySource: String,
- block: ResourceAssignmentBuilder.() -> Unit): ResourceAssignment {
+fun BluePrintTypes.resourceAssignment(
+ name: String,
+ dictionaryName: String,
+ dictionarySource: String,
+ block: ResourceAssignmentBuilder.() -> Unit
+): ResourceAssignment {
return ResourceAssignmentBuilder(name, dictionaryName, dictionarySource).apply(block).build()
}
class ResourceDefinitionsBuilder() {
private val resourceDefinitions: MutableMap<String, ResourceDefinition> = hashMapOf()
- fun resourceDefinition(name: String, description: String,
- block: ResourceDefinitionBuilder.() -> Unit) {
+ fun resourceDefinition(
+ name: String,
+ description: String,
+ block: ResourceDefinitionBuilder.() -> Unit
+ ) {
val resourceDefinition = ResourceDefinitionBuilder(name, description).apply(block).build()
resourceDefinitions[resourceDefinition.name] = resourceDefinition
}
@@ -82,8 +92,11 @@ class ResourceDefinitionBuilder(private val name: String, private val descriptio
resourceDefinition.property = PropertyDefinitionBuilder(name, type, required, description).build()
}
- fun property(type: String, required: Boolean,
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ type: String,
+ required: Boolean,
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
resourceDefinition.property = PropertyDefinitionBuilder(name, type, required, description).apply(block).build()
}
@@ -136,8 +149,12 @@ class ResourceDefinitionSourcesBuilder {
class ResourceAssignmentsBuilder() {
private val resourceAssignments: MutableMap<String, ResourceAssignment> = hashMapOf()
- fun resourceAssignment(name: String, dictionaryName: String, dictionarySource: String,
- block: ResourceAssignmentBuilder.() -> Unit) {
+ fun resourceAssignment(
+ name: String,
+ dictionaryName: String,
+ dictionarySource: String,
+ block: ResourceAssignmentBuilder.() -> Unit
+ ) {
val resourceAssignment = ResourceAssignmentBuilder(name, dictionaryName, dictionarySource).apply(block).build()
resourceAssignments[resourceAssignment.name] = resourceAssignment
}
@@ -151,8 +168,12 @@ class ResourceAssignmentsBuilder() {
}
}
-class ResourceAssignmentBuilder(private val name: String, private val dictionaryName: String,
- private val dictionarySource: String) {
+class ResourceAssignmentBuilder(
+ private val name: String,
+ private val dictionaryName: String,
+ private val dictionarySource: String
+) {
+
private val resourceAssignment = ResourceAssignment()
fun inputParameter(inputParameter: Boolean) {
@@ -163,8 +184,12 @@ class ResourceAssignmentBuilder(private val name: String, private val dictionary
resourceAssignment.property = PropertyDefinitionBuilder(name, type, required, description).build()
}
- fun property(type: String, required: Boolean, description: String? = "",
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ type: String,
+ required: Boolean,
+ description: String? = "",
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
resourceAssignment.property = PropertyDefinitionBuilder(name, type, required, description).apply(block).build()
}
@@ -174,27 +199,27 @@ class ResourceAssignmentBuilder(private val name: String, private val dictionary
fun sourceInput(block: SourceInputNodeTemplateBuilder.() -> Unit) {
resourceAssignment.dictionarySourceDefinition = SourceInputNodeTemplateBuilder(dictionarySource, "")
- .apply(block).build()
+ .apply(block).build()
}
fun sourceDefault(block: SourceDefaultNodeTemplateBuilder.() -> Unit) {
resourceAssignment.dictionarySourceDefinition = SourceDefaultNodeTemplateBuilder(dictionarySource, "")
- .apply(block).build()
+ .apply(block).build()
}
fun sourceDb(block: SourceDbNodeTemplateBuilder.() -> Unit) {
resourceAssignment.dictionarySourceDefinition = SourceDbNodeTemplateBuilder(dictionarySource, "")
- .apply(block).build()
+ .apply(block).build()
}
fun sourceRest(block: SourceRestNodeTemplateBuilder.() -> Unit) {
resourceAssignment.dictionarySourceDefinition = SourceRestNodeTemplateBuilder(dictionarySource, "")
- .apply(block).build()
+ .apply(block).build()
}
fun sourceCapability(block: SourceCapabilityNodeTemplateBuilder.() -> Unit) {
resourceAssignment.dictionarySourceDefinition = SourceCapabilityNodeTemplateBuilder(dictionarySource, "")
- .apply(block).build()
+ .apply(block).build()
}
fun dependencies(dependencies: MutableList<String>) {
@@ -207,4 +232,4 @@ class ResourceAssignmentBuilder(private val name: String, private val dictionary
resourceAssignment.dictionarySource = dictionarySource
return resourceAssignment
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index 0521919aa..293f29cfc 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -32,8 +32,9 @@ import org.springframework.stereotype.Component
@Component("component-resource-resolution")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceResolutionComponent(private val resourceResolutionService: ResourceResolutionService) :
- AbstractComponentFunction() {
- companion object{
+ AbstractComponentFunction() {
+
+ companion object {
const val INPUT_REQUEST_ID = "request-id"
const val INPUT_RESOURCE_ID = "resource-id"
const val INPUT_ACTION_NAME = "action-name"
@@ -54,11 +55,14 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val occurrence = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE)?.asInt() ?: 1
- val resolutionKey = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY)?.returnNullIfMissing()?.textValue() ?: ""
+ val resolutionKey =
+ getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY)?.returnNullIfMissing()?.textValue() ?: ""
val storeResult = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)?.asBoolean() ?: false
- val resourceId = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID)?.returnNullIfMissing()?.textValue() ?: ""
+ val resourceId =
+ getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID)?.returnNullIfMissing()?.textValue() ?: ""
- val resourceType = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.returnNullIfMissing()?.textValue() ?: ""
+ val resourceType =
+ getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)?.returnNullIfMissing()?.textValue() ?: ""
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult
@@ -69,8 +73,10 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val jsonResponse = JsonNodeFactory.instance.objectNode()
// Initialize Output Attribute to empty JSON
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse)
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse
+ )
// validate inputs if we need to store the resource and template resolution.
if (storeResult) {
@@ -79,8 +85,10 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
} else if ((resourceType.isNotEmpty() && resourceId.isEmpty()) || (resourceType.isEmpty() && resourceId.isNotEmpty())) {
throw BluePrintProcessorException("Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.")
} else if (resourceType.isEmpty() && resourceId.isEmpty() && resolutionKey.isEmpty()) {
- throw BluePrintProcessorException("Can't proceed with the resolution: can't persist resolution without a correlation key. " +
- "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false.")
+ throw BluePrintProcessorException(
+ "Can't proceed with the resolution: can't persist resolution without a correlation key. " +
+ "Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false."
+ )
}
}
@@ -90,10 +98,12 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
for (j in 1..occurrence) {
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = j
- val response = resourceResolutionService.resolveResources(bluePrintRuntimeService,
- nodeTemplateName,
- artifactPrefixNames,
- properties)
+ val response = resourceResolutionService.resolveResources(
+ bluePrintRuntimeService,
+ nodeTemplateName,
+ artifactPrefixNames,
+ properties
+ )
// provide indexed result in output if we have multiple resolution
if (occurrence != 1) {
@@ -101,15 +111,16 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
} else {
jsonResponse.setAll(response.asObjectNode())
}
-
}
// Set Output Attributes with resolved value
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse)
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ nodeTemplateName,
+ ResourceResolutionConstants.OUTPUT_ASSIGNMENT_PARAMS, jsonResponse
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError().addError(runtimeException.message!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
index 40ea47e33..25338c6ca 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -17,81 +17,118 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplateOperationImplBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
/** Component Extensions **/
fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
- return nodeType(id = "component-resource-resolution", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- description = "Resource Assignment Component") {
-
- attribute(ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_PARAM, BluePrintConstants.DATA_TYPE_STRING,
- true)
- attribute(ResourceResolutionComponent.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING,
- true)
+ return nodeType(
+ id = "component-resource-resolution", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ description = "Resource Assignment Component"
+ ) {
+
+ attribute(
+ ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_PARAM, BluePrintConstants.DATA_TYPE_STRING,
+ true
+ )
+ attribute(
+ ResourceResolutionComponent.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true
+ )
operation("ResourceResolutionComponent", "ResourceResolutionComponent Operation") {
inputs {
- property(ResourceResolutionComponent.INPUT_REQUEST_ID, BluePrintConstants.DATA_TYPE_STRING,
- true, "Request Id, Unique Id for the request.")
-
- property(ResourceResolutionComponent.INPUT_RESOURCE_ID, BluePrintConstants.DATA_TYPE_STRING,
- false, "Resource Id.")
-
- property(ResourceResolutionComponent.INPUT_ACTION_NAME, BluePrintConstants.DATA_TYPE_STRING,
- false, "Action Name of the process")
-
- property(ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
- false, "Dynamic Json Content or DSL Json reference.")
-
- property(ResourceResolutionComponent.INPUT_RESOLUTION_KEY, BluePrintConstants.DATA_TYPE_STRING,
- false, "Key for service instance related correlation.")
-
- property(ResourceResolutionComponent.INPUT_OCCURRENCE, BluePrintConstants.DATA_TYPE_INTEGER,
- false, "Number of time to perform the resolution.") {
+ property(
+ ResourceResolutionComponent.INPUT_REQUEST_ID, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Request Id, Unique Id for the request."
+ )
+
+ property(
+ ResourceResolutionComponent.INPUT_RESOURCE_ID, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Resource Id."
+ )
+
+ property(
+ ResourceResolutionComponent.INPUT_ACTION_NAME, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Action Name of the process"
+ )
+
+ property(
+ ResourceResolutionComponent.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Dynamic Json Content or DSL Json reference."
+ )
+
+ property(
+ ResourceResolutionComponent.INPUT_RESOLUTION_KEY, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Key for service instance related correlation."
+ )
+
+ property(
+ ResourceResolutionComponent.INPUT_OCCURRENCE, BluePrintConstants.DATA_TYPE_INTEGER,
+ false, "Number of time to perform the resolution."
+ ) {
defaultValue(1)
}
- property(ResourceResolutionComponent.INPUT_STORE_RESULT, BluePrintConstants.DATA_TYPE_BOOLEAN,
- false, "Whether or not to store the output.")
+ property(
+ ResourceResolutionComponent.INPUT_STORE_RESULT, BluePrintConstants.DATA_TYPE_BOOLEAN,
+ false, "Whether or not to store the output."
+ )
- property(ResourceResolutionComponent.INPUT_RESOURCE_TYPE, BluePrintConstants.DATA_TYPE_STRING,
- false, "Request type.")
+ property(
+ ResourceResolutionComponent.INPUT_RESOURCE_TYPE, BluePrintConstants.DATA_TYPE_STRING,
+ false, "Request type."
+ )
- property(ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, BluePrintConstants.DATA_TYPE_LIST,
- true, "Template , Resource Assignment Artifact Prefix names") {
+ property(
+ ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, BluePrintConstants.DATA_TYPE_LIST,
+ true, "Template , Resource Assignment Artifact Prefix names"
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
}
outputs {
- property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, BluePrintConstants.DATA_TYPE_STRING,
- true, "Output Response")
- property(ResourceResolutionComponent.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
- true, "Status of the Component Execution ( success or failure )")
+ property(
+ ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Output Response"
+ )
+ property(
+ ResourceResolutionComponent.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Status of the Component Execution ( success or failure )"
+ )
}
}
}
}
/** Component Builder */
-fun BluePrintTypes.nodeTemplateComponentResourceResolution(id: String,
- description: String,
- block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit)
- : NodeTemplate {
+fun BluePrintTypes.nodeTemplateComponentResourceResolution(
+ id: String,
+ description: String,
+ block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit
+):
+ NodeTemplate {
return ComponentResourceResolutionNodeTemplateBuilder(id, description).apply(block).build()
}
class ComponentResourceResolutionNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
- ComponentResourceResolutionNodeTemplateBuilder.InputsBuilder,
- ComponentResourceResolutionNodeTemplateBuilder.OutputsBuilder>(id, "component-script-executor",
- "ComponentResourceResolution",
- description) {
+ AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
+ ComponentResourceResolutionNodeTemplateBuilder.InputsBuilder,
+ ComponentResourceResolutionNodeTemplateBuilder.OutputsBuilder>(
+ id, "component-script-executor",
+ "ComponentResourceResolution",
+ description
+ ) {
class InputsBuilder : PropertiesAssignmentBuilder() {
@@ -146,7 +183,7 @@ class ComponentResourceResolutionNodeTemplateBuilder(id: String, description: St
fun artifactPrefixNames(artifactPrefixNames: String) = artifactPrefixNames(artifactPrefixNames.jsonAsJsonType())
fun artifactPrefixNames(artifactPrefixNameList: List<String>) =
- artifactPrefixNames(artifactPrefixNameList.asJsonString())
+ artifactPrefixNames(artifactPrefixNameList.asJsonString())
fun artifactPrefixNames(artifactPrefixNames: JsonNode) {
property(ResourceResolutionComponent.INPUT_ARTIFACT_PREFIX_NAMES, artifactPrefixNames)
@@ -162,10 +199,10 @@ class ComponentResourceResolutionNodeTemplateBuilder(id: String, description: St
}
fun resourceAssignmentParams(resourceAssignmentParams: String) =
- resourceAssignmentParams(resourceAssignmentParams.asJsonType())
+ resourceAssignmentParams(resourceAssignmentParams.asJsonType())
fun resourceAssignmentParams(resourceAssignmentParams: JsonNode) {
property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_PARAMS, resourceAssignmentParams)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt
index 13ff0a73f..219040e6b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConfiguration.kt
@@ -22,5 +22,3 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan
open class ResourceResolutionConfiguration
-
-
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
index 537074383..0726d2871 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
@@ -19,15 +19,15 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
object ResourceResolutionConstants {
- const val SERVICE_RESOURCE_RESOLUTION = "resource-resolution-service"
- const val PREFIX_RESOURCE_RESOLUTION_PROCESSOR = "rr-processor-"
- const val INPUT_ARTIFACT_PREFIX_NAMES = "artifact-prefix-names"
- const val OUTPUT_ASSIGNMENT_PARAMS = "assignment-params"
- const val FILE_NAME_RESOURCE_DEFINITION_TYPES = "resources_definition_types.json"
- const val RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY = "resolution-key"
- const val RESOURCE_RESOLUTION_INPUT_STORE_RESULT = "store-result"
- const val RESOURCE_RESOLUTION_INPUT_OCCURRENCE = "occurrence"
- const val RESOURCE_RESOLUTION_INPUT_RESOURCE_ID = "resource-id"
- const val RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE = "resource-type"
- const val RESOURCE_RESOLUTION_LOG_PROTECTED_METADATA = "log-protect"
-} \ No newline at end of file
+ const val SERVICE_RESOURCE_RESOLUTION = "resource-resolution-service"
+ const val PREFIX_RESOURCE_RESOLUTION_PROCESSOR = "rr-processor-"
+ const val INPUT_ARTIFACT_PREFIX_NAMES = "artifact-prefix-names"
+ const val OUTPUT_ASSIGNMENT_PARAMS = "assignment-params"
+ const val FILE_NAME_RESOURCE_DEFINITION_TYPES = "resources_definition_types.json"
+ const val RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY = "resolution-key"
+ const val RESOURCE_RESOLUTION_INPUT_STORE_RESULT = "store-result"
+ const val RESOURCE_RESOLUTION_INPUT_OCCURRENCE = "occurrence"
+ const val RESOURCE_RESOLUTION_INPUT_RESOURCE_ID = "resource-id"
+ const val RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE = "resource-type"
+ const val RESOURCE_RESOLUTION_LOG_PROTECTED_METADATA = "log-protect"
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
index ab01b15b7..53ce65d0b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionExtensions.kt
@@ -20,18 +20,18 @@ import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
-
/**
* Register the Resolution module exposed dependency
*/
fun BluePrintDependencyService.resourceResolutionService(): ResourceResolutionService =
- instance(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-
+ instance(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-suspend fun AbstractComponentFunction.storedContentFromResolvedArtifactNB(resolutionKey: String,
- artifactName: String): String {
+suspend fun AbstractComponentFunction.storedContentFromResolvedArtifactNB(
+ resolutionKey: String,
+ artifactName: String
+): String {
return BluePrintDependencyService.resourceResolutionService()
- .resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
+ .resolveFromDatabase(bluePrintRuntimeService, artifactName, resolutionKey)
}
/**
@@ -39,16 +39,15 @@ suspend fun AbstractComponentFunction.storedContentFromResolvedArtifactNB(resolu
*/
suspend fun AbstractComponentFunction.contentFromResolvedArtifactNB(artifactPrefix: String): String {
return BluePrintDependencyService.resourceResolutionService()
- .resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactPrefix, mapOf())
+ .resolveResources(bluePrintRuntimeService, nodeTemplateName, artifactPrefix, mapOf())
}
-
/**
* Blocking Methods called from Jython Scripts
*/
-fun AbstractComponentFunction.storedContentFromResolvedArtifact(resolutionKey: String, artifactName: String)
- : String = runBlocking {
+fun AbstractComponentFunction.storedContentFromResolvedArtifact(resolutionKey: String, artifactName: String):
+ String = runBlocking {
storedContentFromResolvedArtifactNB(resolutionKey, artifactName)
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index 28e7d395a..14e60bc95 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -27,7 +27,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.T
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceDefinitionUtils.createResourceAssignments
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintTemplateService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -37,80 +41,109 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.BulkResourceS
import org.slf4j.LoggerFactory
import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.UUID
interface ResourceResolutionService {
fun registeredResourceSources(): List<String>
- suspend fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>, artifactTemplate: String,
- resolutionKey: String): String
-
- suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactNames: List<String>, properties: Map<String, Any>): MutableMap<String, String>
-
- suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactPrefix: String, properties: Map<String, Any>): String
+ suspend fun resolveFromDatabase(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ artifactTemplate: String,
+ resolutionKey: String
+ ): String
+
+ suspend fun resolveResources(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactNames: List<String>,
+ properties: Map<String, Any>
+ ): MutableMap<String, String>
+
+ suspend fun resolveResources(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactPrefix: String,
+ properties: Map<String, Any>
+ ): String
/** Resolve resources for all the sources defined in a particular resource Definition[resolveDefinition]
* with other [resourceDefinitions] dependencies for the sources [sources]
* Used to get the same resource values from multiple sources. **/
- suspend fun resolveResourceDefinition(blueprintRuntimeService: BluePrintRuntimeService<*>,
- resourceDefinitions: MutableMap<String, ResourceDefinition>,
- resolveDefinition: String, sources: List<String>)
- : MutableMap<String, JsonNode>
-
- suspend fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>,
- resourceDefinitions: MutableMap<String, ResourceDefinition>,
- resourceAssignments: MutableList<ResourceAssignment>,
- artifactPrefix: String,
- properties: Map<String, Any>)
+ suspend fun resolveResourceDefinition(
+ blueprintRuntimeService: BluePrintRuntimeService<*>,
+ resourceDefinitions: MutableMap<String, ResourceDefinition>,
+ resolveDefinition: String,
+ sources: List<String>
+ ):
+ MutableMap<String, JsonNode>
+
+ suspend fun resolveResourceAssignments(
+ blueprintRuntimeService: BluePrintRuntimeService<*>,
+ resourceDefinitions: MutableMap<String, ResourceDefinition>,
+ resourceAssignments: MutableList<ResourceAssignment>,
+ artifactPrefix: String,
+ properties: Map<String, Any>
+ )
}
@Service(ResourceResolutionConstants.SERVICE_RESOURCE_RESOLUTION)
-open class ResourceResolutionServiceImpl(private var applicationContext: ApplicationContext,
- private var templateResolutionDBService: TemplateResolutionService,
- private var blueprintTemplateService: BluePrintTemplateService,
- private var resourceResolutionDBService: ResourceResolutionDBService) :
- ResourceResolutionService {
+open class ResourceResolutionServiceImpl(
+ private var applicationContext: ApplicationContext,
+ private var templateResolutionDBService: TemplateResolutionService,
+ private var blueprintTemplateService: BluePrintTemplateService,
+ private var resourceResolutionDBService: ResourceResolutionDBService
+) :
+ ResourceResolutionService {
private val log = LoggerFactory.getLogger(ResourceResolutionService::class.java)
override fun registeredResourceSources(): List<String> {
return applicationContext.getBeanNamesForType(ResourceAssignmentProcessor::class.java)
- .filter { it.startsWith(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) }
- .map { it.substringAfter(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) }
+ .filter { it.startsWith(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) }
+ .map { it.substringAfter(ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR) }
}
- override suspend fun resolveFromDatabase(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- artifactTemplate: String,
- resolutionKey: String): String {
+ override suspend fun resolveFromDatabase(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ artifactTemplate: String,
+ resolutionKey: String
+ ): String {
return templateResolutionDBService.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- bluePrintRuntimeService,
- artifactTemplate,
- resolutionKey)
+ bluePrintRuntimeService,
+ artifactTemplate,
+ resolutionKey
+ )
}
- override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactNames: List<String>,
- properties: Map<String, Any>): MutableMap<String, String> {
+ override suspend fun resolveResources(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactNames: List<String>,
+ properties: Map<String, Any>
+ ): MutableMap<String, String> {
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(bluePrintRuntimeService, artifactNames.toString())
+ ResourceAssignmentUtils.transformToRARuntimeService(bluePrintRuntimeService, artifactNames.toString())
val resolvedParams: MutableMap<String, String> = hashMapOf()
artifactNames.forEach { artifactName ->
- val resolvedContent = resolveResources(resourceAssignmentRuntimeService, nodeTemplateName,
- artifactName, properties)
+ val resolvedContent = resolveResources(
+ resourceAssignmentRuntimeService, nodeTemplateName,
+ artifactName, properties
+ )
resolvedParams[artifactName] = resolvedContent
}
return resolvedParams
}
-
- override suspend fun resolveResources(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- artifactPrefix: String, properties: Map<String, Any>): String {
+ override suspend fun resolveResources(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactPrefix: String,
+ properties: Map<String, Any>
+ ): String {
// Velocity Artifact Definition Name
val artifactTemplate = "$artifactPrefix-template"
@@ -121,39 +154,47 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
log.info("Resolving resource for template artifact($artifactTemplate) with resource assignment artifact($artifactMapping)")
val resourceAssignmentContent =
- bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactMapping)
+ bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactMapping)
val resourceAssignments: MutableList<ResourceAssignment> =
- JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment::class.java)
- as? MutableList<ResourceAssignment>
- ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions")
+ JacksonUtils.getListFromJson(resourceAssignmentContent, ResourceAssignment::class.java)
+ as? MutableList<ResourceAssignment>
+ ?: throw BluePrintProcessorException("couldn't get Dictionary Definitions")
if (isToStore(properties)) {
val existingResourceResolution = isNewResolution(bluePrintRuntimeService, properties, artifactPrefix)
if (existingResourceResolution.isNotEmpty()) {
- updateResourceAssignmentWithExisting(bluePrintRuntimeService as ResourceAssignmentRuntimeService,
- existingResourceResolution, resourceAssignments)
+ updateResourceAssignmentWithExisting(
+ bluePrintRuntimeService as ResourceAssignmentRuntimeService,
+ existingResourceResolution, resourceAssignments
+ )
}
}
// Get the Resource Dictionary Name
val resourceDefinitions: MutableMap<String, ResourceDefinition> = ResourceAssignmentUtils
- .resourceDefinitions(bluePrintRuntimeService.bluePrintContext().rootPath)
+ .resourceDefinitions(bluePrintRuntimeService.bluePrintContext().rootPath)
// Resolve resources
- resolveResourceAssignments(bluePrintRuntimeService,
- resourceDefinitions,
- resourceAssignments,
- artifactPrefix,
- properties)
+ resolveResourceAssignments(
+ bluePrintRuntimeService,
+ resourceDefinitions,
+ resourceAssignments,
+ artifactPrefix,
+ properties
+ )
val resolvedParamJsonContent =
- ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
+ ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments.toList())
- resolvedContent = blueprintTemplateService.generateContent(bluePrintRuntimeService, nodeTemplateName,
- artifactTemplate, resolvedParamJsonContent, false,
- mutableMapOf(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to
- properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive()))
+ resolvedContent = blueprintTemplateService.generateContent(
+ bluePrintRuntimeService, nodeTemplateName,
+ artifactTemplate, resolvedParamJsonContent, false,
+ mutableMapOf(
+ ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE to
+ properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive()
+ )
+ )
if (isToStore(properties)) {
templateResolutionDBService.write(properties, resolvedContent, bluePrintRuntimeService, artifactPrefix)
@@ -163,16 +204,21 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
return resolvedContent
}
- override suspend fun resolveResourceDefinition(blueprintRuntimeService: BluePrintRuntimeService<*>,
- resourceDefinitions: MutableMap<String, ResourceDefinition>,
- resolveDefinition: String, sources: List<String>)
- : MutableMap<String, JsonNode> {
+ override suspend fun resolveResourceDefinition(
+ blueprintRuntimeService: BluePrintRuntimeService<*>,
+ resourceDefinitions: MutableMap<String, ResourceDefinition>,
+ resolveDefinition: String,
+ sources: List<String>
+ ):
+ MutableMap<String, JsonNode> {
// Populate Dummy Resource Assignments
val resourceAssignments = createResourceAssignments(resourceDefinitions, resolveDefinition, sources)
- resolveResourceAssignments(blueprintRuntimeService, resourceDefinitions, resourceAssignments,
- UUID.randomUUID().toString(), hashMapOf())
+ resolveResourceAssignments(
+ blueprintRuntimeService, resourceDefinitions, resourceAssignments,
+ UUID.randomUUID().toString(), hashMapOf()
+ )
// Get the data from Resource Assignments
return ResourceAssignmentUtils.generateResourceForAssignments(resourceAssignments)
@@ -183,11 +229,13 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
* name, then get the type of the Resource Definition, Get the instance for the Resource Type and process the
* request.
*/
- override suspend fun resolveResourceAssignments(blueprintRuntimeService: BluePrintRuntimeService<*>,
- resourceDefinitions: MutableMap<String, ResourceDefinition>,
- resourceAssignments: MutableList<ResourceAssignment>,
- artifactPrefix: String,
- properties: Map<String, Any>) {
+ override suspend fun resolveResourceAssignments(
+ blueprintRuntimeService: BluePrintRuntimeService<*>,
+ resourceDefinitions: MutableMap<String, ResourceDefinition>,
+ resourceAssignments: MutableList<ResourceAssignment>,
+ artifactPrefix: String,
+ properties: Map<String, Any>
+ ) {
val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments)
@@ -204,56 +252,62 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
bulkSequenced.forEach { batchResourceAssignments ->
// Execute Non Dependent Assignments in parallel ( ie asynchronously )
val deferred = batchResourceAssignments
- .filter { it.name != "*" && it.name != "start" }
- .filter { it.status != BluePrintConstants.STATUS_SUCCESS }
- .map { resourceAssignment ->
- async {
- val dictionaryName = resourceAssignment.dictionaryName
- val dictionarySource = resourceAssignment.dictionarySource
-
- val processorName = processorName(dictionaryName!!, dictionarySource!!, resourceDefinitions)
-
- val resourceAssignmentProcessor =
- applicationContext.getBean(processorName) as? ResourceAssignmentProcessor
- ?: throw BluePrintProcessorException("failed to get resource processor ($processorName) " +
- "for resource assignment(${resourceAssignment.name})")
- try {
- // Set BluePrint Runtime Service
- resourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService
- // Set Resource Dictionaries
- resourceAssignmentProcessor.resourceDictionaries = resourceDefinitions
- // Invoke Apply Method
- resourceAssignmentProcessor.applyNB(resourceAssignment)
-
- if (isToStore(properties)) {
- resourceResolutionDBService.write(properties,
- blueprintRuntimeService,
- artifactPrefix,
- resourceAssignment)
- log.info("Resource resolution saved into database successfully : (${resourceAssignment.name})")
- }
-
- // Set errors from RA
- blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError())
- } catch (e: RuntimeException) {
- log.error("Fail in processing ${resourceAssignment.name}", e)
- throw BluePrintProcessorException(e)
+ .filter { it.name != "*" && it.name != "start" }
+ .filter { it.status != BluePrintConstants.STATUS_SUCCESS }
+ .map { resourceAssignment ->
+ async {
+ val dictionaryName = resourceAssignment.dictionaryName
+ val dictionarySource = resourceAssignment.dictionarySource
+
+ val processorName = processorName(dictionaryName!!, dictionarySource!!, resourceDefinitions)
+
+ val resourceAssignmentProcessor =
+ applicationContext.getBean(processorName) as? ResourceAssignmentProcessor
+ ?: throw BluePrintProcessorException(
+ "failed to get resource processor ($processorName) " +
+ "for resource assignment(${resourceAssignment.name})"
+ )
+ try {
+ // Set BluePrint Runtime Service
+ resourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService
+ // Set Resource Dictionaries
+ resourceAssignmentProcessor.resourceDictionaries = resourceDefinitions
+ // Invoke Apply Method
+ resourceAssignmentProcessor.applyNB(resourceAssignment)
+
+ if (isToStore(properties)) {
+ resourceResolutionDBService.write(
+ properties,
+ blueprintRuntimeService,
+ artifactPrefix,
+ resourceAssignment
+ )
+ log.info("Resource resolution saved into database successfully : (${resourceAssignment.name})")
}
+
+ // Set errors from RA
+ blueprintRuntimeService.setBluePrintError(resourceAssignmentRuntimeService.getBluePrintError())
+ } catch (e: RuntimeException) {
+ log.error("Fail in processing ${resourceAssignment.name}", e)
+ throw BluePrintProcessorException(e)
}
}
+ }
log.debug("Resolving (${deferred.size})resources parallel.")
deferred.awaitAll()
}
}
-
}
/**
* If the Source instance is "input", then it is not mandatory to have source Resource Definition, So it can
* derive the default input processor.
*/
- private fun processorName(dictionaryName: String, dictionarySource: String,
- resourceDefinitions: MutableMap<String, ResourceDefinition>): String {
+ private fun processorName(
+ dictionaryName: String,
+ dictionarySource: String,
+ resourceDefinitions: MutableMap<String, ResourceDefinition>
+ ): String {
val processorName: String = when (dictionarySource) {
"input" -> {
"${ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-input"
@@ -263,10 +317,10 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
}
else -> {
val resourceDefinition = resourceDefinitions[dictionaryName]
- ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dictionaryName")
+ ?: throw BluePrintProcessorException("couldn't get resource dictionary definition for $dictionaryName")
val resourceSource = resourceDefinition.sources[dictionarySource]
- ?: throw BluePrintProcessorException("couldn't get resource definition $dictionaryName source($dictionarySource)")
+ ?: throw BluePrintProcessorException("couldn't get resource definition $dictionaryName source($dictionarySource)")
ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR.plus(resourceSource.type)
}
@@ -276,19 +330,20 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
}
return processorName
-
}
// Check whether to store or not the resolution of resource and template
private fun isToStore(properties: Map<String, Any>): Boolean {
- return properties.containsKey(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)
- && properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] as Boolean
+ return properties.containsKey(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT) &&
+ properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] as Boolean
}
// Check whether resolution already exist in the database for the specified resolution-key or resourceId/resourceType
- private suspend fun isNewResolution(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- properties: Map<String, Any>,
- artifactPrefix: String): List<ResourceResolution> {
+ private suspend fun isNewResolution(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ properties: Map<String, Any>,
+ artifactPrefix: String
+ ): List<ResourceResolution> {
val occurrence = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] as Int
val resolutionKey = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY] as String
val resourceId = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] as String
@@ -296,28 +351,34 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
if (resolutionKey.isNotEmpty()) {
val existingResourceAssignments =
- resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- bluePrintRuntimeService,
- resolutionKey,
- occurrence,
- artifactPrefix)
+ resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
+ bluePrintRuntimeService,
+ resolutionKey,
+ occurrence,
+ artifactPrefix
+ )
if (existingResourceAssignments.isNotEmpty()) {
- log.info("Resolution with resolutionKey=($resolutionKey) already exist - will resolve all resources not already resolved.",
- resolutionKey)
+ log.info(
+ "Resolution with resolutionKey=($resolutionKey) already exist - will resolve all resources not already resolved.",
+ resolutionKey
+ )
}
return existingResourceAssignments
} else if (resourceId.isNotEmpty() && resourceType.isNotEmpty()) {
val existingResourceAssignments =
- resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- bluePrintRuntimeService,
- resourceId,
- resourceType,
-
- occurrence,
- artifactPrefix)
+ resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
+ bluePrintRuntimeService,
+ resourceId,
+ resourceType,
+
+ occurrence,
+ artifactPrefix
+ )
if (existingResourceAssignments.isNotEmpty()) {
- log.info("Resolution with resourceId=($resourceId) and resourceType=($resourceType) already exist - will resolve " +
- "all resources not already resolved.")
+ log.info(
+ "Resolution with resourceId=($resourceId) and resourceType=($resourceType) already exist - will resolve " +
+ "all resources not already resolved."
+ )
}
return existingResourceAssignments
}
@@ -325,9 +386,11 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
}
// Update the resource assignment list with the status of the resource that have already been resolved
- private fun updateResourceAssignmentWithExisting(raRuntimeService : ResourceAssignmentRuntimeService,
- resourceResolutionList: List<ResourceResolution>,
- resourceAssignmentList: MutableList<ResourceAssignment>) {
+ private fun updateResourceAssignmentWithExisting(
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ resourceResolutionList: List<ResourceResolution>,
+ resourceAssignmentList: MutableList<ResourceAssignment>
+ ) {
resourceResolutionList.forEach { resourceResolution ->
if (resourceResolution.status == BluePrintConstants.STATUS_SUCCESS) {
resourceAssignmentList.forEach {
@@ -347,15 +410,19 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
// Comparision between what we have in the database vs what we have to assign.
private fun compareOne(resourceResolution: ResourceResolution, resourceAssignment: ResourceAssignment): Boolean {
- return (resourceResolution.name == resourceAssignment.name
- && resourceResolution.dictionaryName == resourceAssignment.dictionaryName
- && resourceResolution.dictionarySource == resourceAssignment.dictionarySource
- && resourceResolution.dictionaryVersion == resourceAssignment.version)
+ return (resourceResolution.name == resourceAssignment.name &&
+ resourceResolution.dictionaryName == resourceAssignment.dictionaryName &&
+ resourceResolution.dictionarySource == resourceAssignment.dictionarySource &&
+ resourceResolution.dictionaryVersion == resourceAssignment.version)
}
- private fun exposeOccurrencePropertyInResourceAssignments(raRuntimeService: ResourceAssignmentRuntimeService,
- properties: Map<String, Any>) {
- raRuntimeService.putResolutionStore(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE,
- properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive())
+ private fun exposeOccurrencePropertyInResourceAssignments(
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ properties: Map<String, Any>
+ ) {
+ raRuntimeService.putResolutionStore(
+ ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE,
+ properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE].asJsonPrimitive()
+ )
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
index 182f3a178..d541fe60c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSL.kt
@@ -18,7 +18,11 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplatePropertyImplBuilder
@@ -27,149 +31,220 @@ import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
import kotlin.reflect.KClass
fun BluePrintTypes.nodeTypeSourceInput(): NodeType {
- return nodeType(id = "source-input", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- description = "This is Input Resource Source Node Type") {}
+ return nodeType(
+ id = "source-input", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ description = "This is Input Resource Source Node Type"
+ ) {}
}
fun BluePrintTypes.nodeTypeSourceDefault(): NodeType {
- return nodeType(id = "source-default", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- description = "This is Default Resource Source Node Type") {}
+ return nodeType(
+ id = "source-default", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ description = "This is Default Resource Source Node Type"
+ ) {}
}
fun BluePrintTypes.nodeTypeSourceDb(): NodeType {
- return nodeType(id = "source-db", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- description = "This is Database Resource Source Node Type") {
- property("type", BluePrintConstants.DATA_TYPE_STRING,
- true, "") {
+ return nodeType(
+ id = "source-db", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ description = "This is Database Resource Source Node Type"
+ ) {
+ property(
+ "type", BluePrintConstants.DATA_TYPE_STRING,
+ true, ""
+ ) {
defaultValue("SQL".asJsonPrimitive())
constrain {
validValues(arrayListOf("SQL".asJsonPrimitive(), "PLSQL".asJsonPrimitive()))
}
}
- property("endpoint-selector", BluePrintConstants.DATA_TYPE_STRING,
- false, "")
- property("query", BluePrintConstants.DATA_TYPE_STRING,
- true, "")
- property("input-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
- true, "") {
+ property(
+ "endpoint-selector", BluePrintConstants.DATA_TYPE_STRING,
+ false, ""
+ )
+ property(
+ "query", BluePrintConstants.DATA_TYPE_STRING,
+ true, ""
+ )
+ property(
+ "input-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
+ true, ""
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
- property("output-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
- false, "") {
+ property(
+ "output-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
+ false, ""
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
- property("key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
- true, "Resource Resolution dependency dictionary names.") {
+ property(
+ "key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
+ true, "Resource Resolution dependency dictionary names."
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
}
}
fun BluePrintTypes.nodeTypeSourceRest(): NodeType {
- return nodeType(id = "source-rest", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- description = "This is Rest Resource Source Node Type") {
- property("type", BluePrintConstants.DATA_TYPE_STRING,
- true, "") {
+ return nodeType(
+ id = "source-rest", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ description = "This is Rest Resource Source Node Type"
+ ) {
+ property(
+ "type", BluePrintConstants.DATA_TYPE_STRING,
+ true, ""
+ ) {
defaultValue("JSON".asJsonPrimitive())
constrain {
validValues(arrayListOf("JSON".asJsonPrimitive(), "XML".asJsonPrimitive()))
}
}
- property("verb", BluePrintConstants.DATA_TYPE_STRING,
- true, "") {
+ property(
+ "verb", BluePrintConstants.DATA_TYPE_STRING,
+ true, ""
+ ) {
defaultValue("GET".asJsonPrimitive())
constrain {
- validValues(arrayListOf("GET".asJsonPrimitive(), "POST".asJsonPrimitive(),
- "DELETE".asJsonPrimitive(), "PUT".asJsonPrimitive()))
+ validValues(
+ arrayListOf(
+ "GET".asJsonPrimitive(), "POST".asJsonPrimitive(),
+ "DELETE".asJsonPrimitive(), "PUT".asJsonPrimitive()
+ )
+ )
}
}
- property("payload", BluePrintConstants.DATA_TYPE_STRING,
- false, "") {
+ property(
+ "payload", BluePrintConstants.DATA_TYPE_STRING,
+ false, ""
+ ) {
defaultValue("".asJsonPrimitive())
}
- property("endpoint-selector", BluePrintConstants.DATA_TYPE_STRING,
- false, "")
- property("url-path", BluePrintConstants.DATA_TYPE_STRING,
- true, "")
- property("path", BluePrintConstants.DATA_TYPE_STRING,
- true, "")
- property("expression-type", BluePrintConstants.DATA_TYPE_STRING,
- false, "") {
+ property(
+ "endpoint-selector", BluePrintConstants.DATA_TYPE_STRING,
+ false, ""
+ )
+ property(
+ "url-path", BluePrintConstants.DATA_TYPE_STRING,
+ true, ""
+ )
+ property(
+ "path", BluePrintConstants.DATA_TYPE_STRING,
+ true, ""
+ )
+ property(
+ "expression-type", BluePrintConstants.DATA_TYPE_STRING,
+ false, ""
+ ) {
defaultValue("JSON_PATH".asJsonPrimitive())
constrain {
validValues(arrayListOf("JSON_PATH".asJsonPrimitive(), "JSON_POINTER".asJsonPrimitive()))
}
}
- property("input-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
- true, "") {
+ property(
+ "input-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
+ true, ""
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
- property("output-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
- false, "") {
+ property(
+ "output-key-mapping", BluePrintConstants.DATA_TYPE_MAP,
+ false, ""
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
- property("key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
- true, "Resource Resolution dependency dictionary names.") {
+ property(
+ "key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
+ true, "Resource Resolution dependency dictionary names."
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
}
}
fun BluePrintTypes.nodeTypeSourceCapability(): NodeType {
- return nodeType(id = "source-capability", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- description = "This is Component Resource Source Node Type") {
- property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING,
- true, "Request Id, Unique Id for the request.") {
+ return nodeType(
+ id = "source-capability", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ description = "This is Component Resource Source Node Type"
+ ) {
+ property(
+ ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Request Id, Unique Id for the request."
+ ) {
defaultValue(BluePrintConstants.SCRIPT_KOTLIN)
constrain {
- validValues(arrayListOf(BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive(),
+ validValues(
+ arrayListOf(
+ BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive(),
BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(),
- BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive()))
+ BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive()
+ )
+ )
}
}
- property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
- true, "Kotlin Script class name or jython script name.")
- property("key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
- true, "Resource Resolution dependency dictionary names.") {
+ property(
+ ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Kotlin Script class name or jython script name."
+ )
+ property(
+ "key-dependencies", BluePrintConstants.DATA_TYPE_LIST,
+ true, "Resource Resolution dependency dictionary names."
+ ) {
entrySchema(BluePrintConstants.DATA_TYPE_STRING)
}
}
}
/** Node Template Source Input **/
-fun BluePrintTypes.nodeTemplateSourceInput(id: String, description: String,
- block: SourceInputNodeTemplateBuilder.() -> Unit): NodeTemplate {
+fun BluePrintTypes.nodeTemplateSourceInput(
+ id: String,
+ description: String,
+ block: SourceInputNodeTemplateBuilder.() -> Unit
+): NodeTemplate {
return SourceInputNodeTemplateBuilder(id, description).apply(block).build()
}
class SourceInputNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplatePropertyImplBuilder<PropertiesAssignmentBuilder>(id,
- "source-input", description)
+ AbstractNodeTemplatePropertyImplBuilder<PropertiesAssignmentBuilder>(
+ id,
+ "source-input", description
+ )
/** Node Template Source Default **/
-fun BluePrintTypes.nodeTemplateSourceDefault(id: String, description: String,
- block: SourceDefaultNodeTemplateBuilder.() -> Unit): NodeTemplate {
+fun BluePrintTypes.nodeTemplateSourceDefault(
+ id: String,
+ description: String,
+ block: SourceDefaultNodeTemplateBuilder.() -> Unit
+): NodeTemplate {
return SourceDefaultNodeTemplateBuilder(id, description).apply(block).build()
}
class SourceDefaultNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplatePropertyImplBuilder<PropertiesAssignmentBuilder>(id,
- "source-default", description)
+ AbstractNodeTemplatePropertyImplBuilder<PropertiesAssignmentBuilder>(
+ id,
+ "source-default", description
+ )
/** Node Template Source DB **/
-fun BluePrintTypes.nodeTemplateSourceDb(id: String, description: String,
- block: SourceDbNodeTemplateBuilder.() -> Unit): NodeTemplate {
+fun BluePrintTypes.nodeTemplateSourceDb(
+ id: String,
+ description: String,
+ block: SourceDbNodeTemplateBuilder.() -> Unit
+): NodeTemplate {
return SourceDbNodeTemplateBuilder(id, description).apply(block).build()
}
class SourceDbNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplatePropertyImplBuilder<SourceDbNodeTemplateBuilder.PropertiesBuilder>(id,
- "source-db", description) {
+ AbstractNodeTemplatePropertyImplBuilder<SourceDbNodeTemplateBuilder.PropertiesBuilder>(
+ id,
+ "source-db", description
+ ) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
fun type(type: String) = type(type.asJsonPrimitive())
@@ -221,16 +296,20 @@ class KeyMappingBuilder() {
}
}
-
/** Node Template Source Rest **/
-fun BluePrintTypes.nodeTemplateSourceRest(id: String, description: String,
- block: SourceRestNodeTemplateBuilder.() -> Unit): NodeTemplate {
+fun BluePrintTypes.nodeTemplateSourceRest(
+ id: String,
+ description: String,
+ block: SourceRestNodeTemplateBuilder.() -> Unit
+): NodeTemplate {
return SourceRestNodeTemplateBuilder(id, description).apply(block).build()
}
class SourceRestNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplatePropertyImplBuilder<SourceRestNodeTemplateBuilder.PropertiesBuilder>(id,
- "source-rest", description) {
+ AbstractNodeTemplatePropertyImplBuilder<SourceRestNodeTemplateBuilder.PropertiesBuilder>(
+ id,
+ "source-rest", description
+ ) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
fun type(type: String) = type(type.asJsonPrimitive())
@@ -296,14 +375,19 @@ class SourceRestNodeTemplateBuilder(id: String, description: String) :
}
/** Node Template Source Rest **/
-fun BluePrintTypes.nodeTemplateSourceCapability(id: String, description: String,
- block: SourceCapabilityNodeTemplateBuilder.() -> Unit): NodeTemplate {
+fun BluePrintTypes.nodeTemplateSourceCapability(
+ id: String,
+ description: String,
+ block: SourceCapabilityNodeTemplateBuilder.() -> Unit
+): NodeTemplate {
return SourceCapabilityNodeTemplateBuilder(id, description).apply(block).build()
}
class SourceCapabilityNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplatePropertyImplBuilder<SourceCapabilityNodeTemplateBuilder.PropertiesBuilder>(id,
- "source-capability", description) {
+ AbstractNodeTemplatePropertyImplBuilder<SourceCapabilityNodeTemplateBuilder.PropertiesBuilder>(
+ id,
+ "source-capability", description
+ ) {
class PropertiesBuilder : PropertiesAssignmentBuilder() {
fun type(type: String) = type(type.asJsonPrimitive())
@@ -330,4 +414,4 @@ class SourceCapabilityNodeTemplateBuilder(id: String, description: String) :
property("key-dependencies", keyDependencies)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
index 2a0e7a443..636e81dda 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceProperties.kt
@@ -78,4 +78,4 @@ open class CapabilityResourceSource : ResourceSourceProperties() {
var instanceDependencies: List<String>? = null
@get:JsonProperty("key-dependencies")
lateinit var keyDependencies: MutableList<String>
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
index 781cafd97..db023acfb 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
@@ -22,8 +22,15 @@ import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
@EntityListeners(AuditingEntityListener::class)
@Entity
@@ -56,8 +63,10 @@ class ResourceResolution : Serializable {
@Column(name = "status", nullable = false)
var status: String? = null
- @get:ApiModelProperty(value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
- required = true)
+ @get:ApiModelProperty(
+ value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
+ required = true
+ )
@Column(name = "resolution_key", nullable = false)
var resolutionKey: String? = null
@@ -69,8 +78,10 @@ class ResourceResolution : Serializable {
@Column(name = "resource_id", nullable = false)
var resourceId: String? = null
- @get:ApiModelProperty(value = "If resolution occurred multiple time, this field provides the index.",
- required = true)
+ @get:ApiModelProperty(
+ value = "If resolution occurred multiple time, this field provides the index.",
+ required = true
+ )
@Column(name = "occurrence", nullable = false)
var occurrence: Int = 0
@@ -78,8 +89,10 @@ class ResourceResolution : Serializable {
@Column(name = "dictionary_name", nullable = false)
var dictionaryName: String? = null
- @get:ApiModelProperty(value = "Source associated with the data dictionary used for the resolution.",
- required = true)
+ @get:ApiModelProperty(
+ value = "Source associated with the data dictionary used for the resolution.",
+ required = true
+ )
@Column(name = "dictionary_status", nullable = false)
var dictionarySource: String? = null
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
index e5a13a630..f8bf7bd09 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBService.kt
@@ -26,7 +26,7 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.UUID
@Service
class ResourceResolutionDBService(private val resourceResolutionRepository: ResourceResolutionRepository) {
@@ -34,8 +34,11 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
private val log = LoggerFactory.getLogger(ResourceResolutionDBService::class.toString())
suspend fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- bluePrintRuntimeService: BluePrintRuntimeService<*>, key: String,
- occurrence: Int, artifactPrefix: String): List<ResourceResolution> {
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ key: String,
+ occurrence: Int,
+ artifactPrefix: String
+ ): List<ResourceResolution> {
return try {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
@@ -47,16 +50,20 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
blueprintVersion,
artifactPrefix,
key,
- occurrence)
+ occurrence
+ )
} catch (e: EmptyResultDataAccessException) {
emptyList()
}
}
suspend fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- bluePrintRuntimeService: BluePrintRuntimeService<*>, resourceId: String,
- resourceType: String, occurrence: Int,
- artifactPrefix: String): List<ResourceResolution> {
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ resourceId: String,
+ resourceType: String,
+ occurrence: Int,
+ artifactPrefix: String
+ ): List<ResourceResolution> {
return try {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
@@ -70,55 +77,67 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
artifactPrefix,
resourceId,
resourceType,
- occurrence)
+ occurrence
+ )
} catch (e: EmptyResultDataAccessException) {
emptyList()
}
}
- suspend fun readValue(blueprintName: String,
- blueprintVersion: String,
- artifactPrefix: String,
- resolutionKey: String,
- name: String): ResourceResolution = withContext(Dispatchers.IO) {
+ suspend fun readValue(
+ blueprintName: String,
+ blueprintVersion: String,
+ artifactPrefix: String,
+ resolutionKey: String,
+ name: String
+ ): ResourceResolution = withContext(Dispatchers.IO) {
resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndName(
resolutionKey,
blueprintName,
blueprintVersion,
artifactPrefix,
- name)
+ name
+ )
}
- suspend fun readWithResolutionKey(blueprintName: String,
- blueprintVersion: String,
- artifactPrefix: String,
- resolutionKey: String): List<ResourceResolution> = withContext(Dispatchers.IO) {
+ suspend fun readWithResolutionKey(
+ blueprintName: String,
+ blueprintVersion: String,
+ artifactPrefix: String,
+ resolutionKey: String
+ ): List<ResourceResolution> = withContext(Dispatchers.IO) {
resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
resolutionKey,
blueprintName,
blueprintVersion,
- artifactPrefix)
+ artifactPrefix
+ )
}
- suspend fun readWithResourceIdAndResourceType(blueprintName: String,
- blueprintVersion: String,
- resourceId: String,
- resourceType: String): List<ResourceResolution> =
+ suspend fun readWithResourceIdAndResourceType(
+ blueprintName: String,
+ blueprintVersion: String,
+ resourceId: String,
+ resourceType: String
+ ): List<ResourceResolution> =
withContext(Dispatchers.IO) {
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndResourceIdAndResourceType(
blueprintName,
blueprintVersion,
resourceId,
- resourceType)
+ resourceType
+ )
}
- suspend fun write(properties: Map<String, Any>,
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
- artifactPrefix: String,
- resourceAssignment: ResourceAssignment): ResourceResolution = withContext(Dispatchers.IO) {
+ suspend fun write(
+ properties: Map<String, Any>,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ artifactPrefix: String,
+ resourceAssignment: ResourceAssignment
+ ): ResourceResolution = withContext(Dispatchers.IO) {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
@@ -130,24 +149,28 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
val resourceType = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] as String
val occurrence = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] as Int
- write(blueprintName,
+ write(
+ blueprintName,
blueprintVersion,
resolutionKey,
resourceId,
resourceType,
artifactPrefix,
resourceAssignment,
- occurrence)
+ occurrence
+ )
}
- suspend fun write(blueprintName: String,
- blueprintVersion: String,
- resolutionKey: String,
- resourceId: String,
- resourceType: String,
- artifactPrefix: String,
- resourceAssignment: ResourceAssignment,
- occurrence: Int = 0): ResourceResolution = withContext(Dispatchers.IO) {
+ suspend fun write(
+ blueprintName: String,
+ blueprintVersion: String,
+ resolutionKey: String,
+ resourceId: String,
+ resourceType: String,
+ artifactPrefix: String,
+ resourceAssignment: ResourceAssignment,
+ occurrence: Int = 0
+ ): ResourceResolution = withContext(Dispatchers.IO) {
val resourceResolution = ResourceResolution()
resourceResolution.id = UUID.randomUUID().toString()
@@ -175,4 +198,4 @@ class ResourceResolutionDBService(private val resourceResolutionRepository: Reso
throw BluePrintException("Failed to store resource resolution result.", ex)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt
index 429041e14..a2a3a753b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionRepository.kt
@@ -16,31 +16,40 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db
import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
+@Repository
interface ResourceResolutionRepository : JpaRepository<ResourceResolution, String> {
- fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndName(key: String,
- blueprintName: String?,
- blueprintVersion: String?,
- artifactName: String,
- name: String): ResourceResolution
+ fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndName(
+ key: String,
+ blueprintName: String?,
+ blueprintVersion: String?,
+ artifactName: String,
+ name: String
+ ): ResourceResolution
- fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(resolutionKey: String,
- blueprintName: String,
- blueprintVersion: String,
- artifactPrefix: String): List<ResourceResolution>
+ fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ resolutionKey: String,
+ blueprintName: String,
+ blueprintVersion: String,
+ artifactPrefix: String
+ ): List<ResourceResolution>
- fun findByBlueprintNameAndBlueprintVersionAndResourceIdAndResourceType(blueprintName: String,
- blueprintVersion: String,
- resourceId: String,
- resourceType: String): List<ResourceResolution>
+ fun findByBlueprintNameAndBlueprintVersionAndResourceIdAndResourceType(
+ blueprintName: String,
+ blueprintVersion: String,
+ resourceId: String,
+ resourceType: String
+ ): List<ResourceResolution>
fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
blueprintName: String?,
blueprintVersion: String?,
artifactName: String,
resolutionKey: String,
- occurrence: Int): List<ResourceResolution>
+ occurrence: Int
+ ): List<ResourceResolution>
fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
blueprintName: String?,
@@ -48,5 +57,6 @@ interface ResourceResolutionRepository : JpaRepository<ResourceResolution, Strin
artifactName: String,
resourceId: String,
resourceType: String,
- occurrence: Int): List<ResourceResolution>
-} \ No newline at end of file
+ occurrence: Int
+ ): List<ResourceResolution>
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
index 9d5a3f5d5..8b235925b 100755
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
@@ -22,8 +22,15 @@ import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
@EntityListeners(AuditingEntityListener::class)
@Entity
@@ -48,8 +55,10 @@ class TemplateResolution : Serializable {
@Column(name = "result", nullable = false)
var result: String? = null
- @get:ApiModelProperty(value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
- required = true)
+ @get:ApiModelProperty(
+ value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
+ required = true
+ )
@Column(name = "resolution_key", nullable = false)
var resolutionKey: String? = null
@@ -61,8 +70,10 @@ class TemplateResolution : Serializable {
@Column(name = "resource_id", nullable = false)
var resourceId: String? = null
- @get:ApiModelProperty(value = "If resolution occurred multiple time, this field provides the index.",
- required = true)
+ @get:ApiModelProperty(
+ value = "If resolution occurred multiple time, this field provides the index.",
+ required = true
+ )
@Column(name = "occurrence", nullable = false)
var occurrence: Int = 1
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
index 440663f25..642a41b1c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionRepository.kt
@@ -16,8 +16,10 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db
import org.springframework.data.jpa.repository.JpaRepository
+import org.springframework.stereotype.Repository
import javax.transaction.Transactional
+@Repository
interface TemplateResolutionRepository : JpaRepository<TemplateResolution, String> {
fun findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -26,14 +28,16 @@ interface TemplateResolutionRepository : JpaRepository<TemplateResolution, Strin
blueprintName: String?,
blueprintVersion: String?,
artifactName: String,
- occurrence: Int): TemplateResolution ?
+ occurrence: Int
+ ): TemplateResolution?
fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
key: String,
blueprintName: String?,
blueprintVersion: String?,
artifactName: String,
- occurrence: Int): TemplateResolution ?
+ occurrence: Int
+ ): TemplateResolution?
@Transactional
fun deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -42,7 +46,8 @@ interface TemplateResolutionRepository : JpaRepository<TemplateResolution, Strin
blueprintName: String?,
blueprintVersion: String?,
artifactName: String,
- occurrence: Int)
+ occurrence: Int
+ )
@Transactional
fun deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -50,5 +55,6 @@ interface TemplateResolutionRepository : JpaRepository<TemplateResolution, Strin
blueprintName: String?,
blueprintVersion: String?,
artifactName: String,
- occurrence: Int)
+ occurrence: Int
+ )
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
index c64605ef0..895bc993f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionService.kt
@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory
import org.springframework.dao.DataIntegrityViolationException
import org.springframework.dao.EmptyResultDataAccessException
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.UUID
@Service
class TemplateResolutionService(private val templateResolutionRepository: TemplateResolutionRepository) {
@@ -35,7 +35,8 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
suspend fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
bluePrintRuntimeService: BluePrintRuntimeService<*>,
artifactPrefix: String,
- resolutionKey: String): String =
+ resolutionKey: String
+ ): String =
withContext(Dispatchers.IO) {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
@@ -43,17 +44,21 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
val blueprintVersion = metadata[BluePrintConstants.METADATA_TEMPLATE_VERSION]!!
val blueprintName = metadata[BluePrintConstants.METADATA_TEMPLATE_NAME]!!
- findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(blueprintName,
+ findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ blueprintName,
blueprintVersion,
artifactPrefix,
- resolutionKey)
+ resolutionKey
+ )
}
- suspend fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(blueprintName: String,
- blueprintVersion: String,
- artifactPrefix: String,
- resolutionKey: String,
- occurrence: Int = 1): String =
+ suspend fun findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ blueprintName: String,
+ blueprintVersion: String,
+ artifactPrefix: String,
+ resolutionKey: String,
+ occurrence: Int = 1
+ ): String =
withContext(Dispatchers.IO) {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -61,15 +66,18 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
blueprintName,
blueprintVersion,
artifactPrefix,
- occurrence)?.result ?: throw EmptyResultDataAccessException(1)
+ occurrence
+ )?.result ?: throw EmptyResultDataAccessException(1)
}
- suspend fun findByResoureIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactName(blueprintName: String,
- blueprintVersion: String,
- artifactPrefix: String,
- resourceId: String,
- resourceType: String,
- occurrence: Int = 1): String =
+ suspend fun findByResoureIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactName(
+ blueprintName: String,
+ blueprintVersion: String,
+ artifactPrefix: String,
+ resourceId: String,
+ resourceType: String,
+ occurrence: Int = 1
+ ): String =
withContext(Dispatchers.IO) {
templateResolutionRepository.findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
@@ -78,12 +86,16 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
blueprintName,
blueprintVersion,
artifactPrefix,
- occurrence)?.result!!
+ occurrence
+ )?.result!!
}
- suspend fun write(properties: Map<String, Any>,
- result: String, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- artifactPrefix: String): TemplateResolution = withContext(Dispatchers.IO) {
+ suspend fun write(
+ properties: Map<String, Any>,
+ result: String,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ artifactPrefix: String
+ ): TemplateResolution = withContext(Dispatchers.IO) {
val metadata = bluePrintRuntimeService.bluePrintContext().metadata!!
@@ -93,19 +105,28 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
val resourceId = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] as String
val resourceType = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] as String
val occurrence = properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] as Int
- write(blueprintName,
+ write(
+ blueprintName,
blueprintVersion,
artifactPrefix,
result,
occurrence,
resolutionKey,
resourceId,
- resourceType)
+ resourceType
+ )
}
- suspend fun write(blueprintName: String, blueprintVersion: String, artifactPrefix: String,
- template: String, occurrence: Int = 1, resolutionKey: String = "", resourceId: String = "",
- resourceType: String = ""): TemplateResolution =
+ suspend fun write(
+ blueprintName: String,
+ blueprintVersion: String,
+ artifactPrefix: String,
+ template: String,
+ occurrence: Int = 1,
+ resolutionKey: String = "",
+ resourceId: String = "",
+ resourceType: String = ""
+ ): TemplateResolution =
withContext(Dispatchers.IO) {
val resourceResolutionResult = TemplateResolution()
@@ -122,37 +143,49 @@ class TemplateResolutionService(private val templateResolutionRepository: Templa
// Overwrite template resolution-key of resourceId/resourceType already existant
if (resolutionKey.isNotEmpty()) {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- resolutionKey, blueprintName, blueprintVersion, artifactPrefix, occurrence)?.let {
- log.info("Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)")
+ resolutionKey, blueprintName, blueprintVersion, artifactPrefix, occurrence
+ )?.let {
+ log.info(
+ "Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
+ "artifactName=($artifactPrefix) and resolutionKey=($resolutionKey)"
+ )
templateResolutionRepository.deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resolutionKey,
blueprintName,
blueprintVersion,
artifactPrefix,
- occurrence)
+ occurrence
+ )
}
} else if (resourceId.isNotEmpty() && resourceType.isNotEmpty()) {
templateResolutionRepository.findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- resourceId, resourceType, blueprintName, blueprintVersion, artifactPrefix, occurrence)?.let {
- log.info("Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
- "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)")
+ resourceId, resourceType, blueprintName, blueprintVersion, artifactPrefix, occurrence
+ )?.let {
+ log.info(
+ "Overwriting template resolution for blueprintName=($blueprintVersion), blueprintVersion=($blueprintName), " +
+ "artifactName=($artifactPrefix), resourceId=($resourceId) and resourceType=($resourceType)"
+ )
templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
resourceId,
resourceType,
blueprintName,
blueprintVersion,
artifactPrefix,
- occurrence)
+ occurrence
+ )
}
}
try {
- log.info("Writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence")
+ log.info(
+ "Writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence"
+ )
templateResolutionRepository.saveAndFlush(resourceResolutionResult)
} catch (ex: DataIntegrityViolationException) {
- log.error("Error writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
- " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message)
+ log.error(
+ "Error writing out template_resolution result: bpName: $blueprintName bpVer $blueprintVersion resKey:$resolutionKey" +
+ " (resourceId: $resourceId resourceType: $resourceType) occurrence:$occurrence error: {}", ex.message
+ )
throw BluePrintException("Failed to store resource api result.", ex)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
index 9867cd658..feef4c2fe 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
@@ -90,8 +90,8 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, runtimeException.message)
}
- suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>)
- : ResourceAssignmentProcessor {
+ suspend fun scriptInstance(scriptType: String, scriptClassReference: String, instanceDependencies: List<String>):
+ ResourceAssignmentProcessor {
log.info(
"creating resource resolution of script type($scriptType), reference name($scriptClassReference) and" +
@@ -106,5 +106,4 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc
return scriptComponent
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
index 0f5d91415..53698ca82 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
@@ -18,8 +18,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor
import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
@@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.HashMap
/**
* DatabaseResourceAssignmentProcessor
@@ -44,7 +44,7 @@ import java.util.*
@Service("${PREFIX_RESOURCE_RESOLUTION_PROCESSOR}source-db")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class DatabaseResourceAssignmentProcessor(
- private val bluePrintDBLibPropertySevice: BluePrintDBLibPropertySevice,
+ private val bluePrintDBLibPropertyService: BluePrintDBLibPropertyService,
private val primaryDBLibGenericService: PrimaryDBLibGenericService
) : ResourceAssignmentProcessor() {
@@ -91,8 +91,10 @@ open class DatabaseResourceAssignmentProcessor(
"failed to get input-key-mappings for $dName under $dSource properties"
}
- logger.info("DatabaseResource ($dSource) dictionary information: " +
- "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})")
+ logger.info(
+ "DatabaseResource ($dSource) dictionary information: " +
+ "Query:($sql), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ )
val jdbcTemplate = blueprintDBLibService(sourceProperties)
val rows = jdbcTemplate.query(sql, populateNamedParameter(inputKeyMapping))
@@ -106,11 +108,10 @@ open class DatabaseResourceAssignmentProcessor(
private fun blueprintDBLibService(sourceProperties: DatabaseResourceSource): BluePrintDBLibGenericService {
return if (isNotEmpty(sourceProperties.endpointSelector)) {
val dbPropertiesJson = raRuntimeService.resolveDSLExpression(sourceProperties.endpointSelector!!)
- bluePrintDBLibPropertySevice.JdbcTemplate(dbPropertiesJson)
+ bluePrintDBLibPropertyService.JdbcTemplate(dbPropertiesJson)
} else {
primaryDBLibGenericService
}
-
}
@Throws(BluePrintProcessorException::class)
@@ -119,14 +120,13 @@ open class DatabaseResourceAssignmentProcessor(
checkNotEmpty(resourceAssignment.dictionaryName) {
"resource assignment dictionary name is not defined for template key (${resourceAssignment.name})"
}
- check(resourceAssignment.dictionarySource in getListOfDBSources())
- {
+ check(resourceAssignment.dictionarySource in getListOfDBSources()) {
"resource assignment source is not ${ResourceDictionaryConstants.PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
}
}
- //placeholder to get the list of DB sources.
- //TODO: This will be replaced with a DB
+ // placeholder to get the list of DB sources.
+ // TODO: This will be replaced with a DB
private fun getListOfDBSources(): Array<String> = arrayOf(ResourceDictionaryConstants.PROCESSOR_DB)
private fun populateNamedParameter(inputKeyMapping: Map<String, String>): Map<String, Any> {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
index 9a83b0cc0..7705c1102 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
@@ -53,10 +53,9 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() {
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, e.message)
throw BluePrintProcessorException("Failed in template key ($resourceAssignment) assignments with: ${e.message}", e)
}
-
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
index a78e7872e..f04a787db 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
@@ -17,10 +17,12 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.DatabaseResourceSource
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.PREFIX_RESOURCE_RESOLUTION_PROCESSOR
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
@@ -41,8 +43,8 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
override suspend fun processNB(resourceAssignment: ResourceAssignment) {
try {
- if (isNotEmpty(resourceAssignment.name)) {
- setFromInput(resourceAssignment)
+ if (isNotEmpty(resourceAssignment.name) && !setFromInput(resourceAssignment)) {
+ setFromKeyDependencies(resourceAssignment)
}
// Check the value has populated for mandatory case
ResourceAssignmentUtils.assertTemplateKeyValueNotNull(resourceAssignment)
@@ -52,7 +54,30 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
}
}
+ // usecase: where input data attribute doesn't match with resourceName, and needs an alternate mapping provided under key-dependencies.
+ private fun setFromKeyDependencies(resourceAssignment: ResourceAssignment) {
+ val dName = resourceAssignment.dictionaryName!!
+ val dSource = resourceAssignment.dictionarySource!!
+ val resourceDefinition = resourceDefinition(dName)
+
+ /** Check Resource Assignment has the source definitions, If not get from Resource Definition **/
+ val resourceSource = resourceAssignment.dictionarySourceDefinition
+ ?: resourceDefinition?.sources?.get(dSource)
+ ?: throw BluePrintProcessorException("couldn't get resource definition $dName source($dSource)")
+ val resourceSourceProperties = checkNotNull(resourceSource.properties) {
+ "failed to get source properties for $dName "
+ }
+ val sourceProperties =
+ JacksonUtils.getInstanceFromMap(resourceSourceProperties, DatabaseResourceSource::class.java)
+
+ val keyDependency = checkNotNull(sourceProperties.keyDependencies) {
+ "failed to get input-key-mappings for $dName under $dSource properties"
+ }
+ // keyDependency = service-instance.service-instance-id
+ setFromInputKeyDependencies(keyDependency, resourceAssignment); // New API which picks arrtibute from Input
+ }
+
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index e513170a8..454a899aa 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -22,13 +22,17 @@ import com.fasterxml.jackson.databind.JsonNode
import org.apache.commons.collections.MapUtils
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.onap.ccsdk.cds.controllerblueprints.core.isNullOrMissing
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.slf4j.LoggerFactory
-import java.util.*
+import java.util.HashMap
abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssignment, Boolean> {
@@ -52,8 +56,10 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
try {
val value = raRuntimeService.getInputValue(resourceAssignment.name)
if (!value.isNullOrMissing()) {
- log.debug("For Resource:(${resourceAssignment.name}) found value:({}) in input-data.",
- ResourceAssignmentUtils.getValueToLog(resourceAssignment.property?.metadata, value))
+ log.debug(
+ "For Resource:(${resourceAssignment.name}) found value:({}) in input-data.",
+ ResourceAssignmentUtils.getValueToLog(resourceAssignment.property?.metadata, value)
+ )
ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
return true
}
@@ -63,6 +69,25 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
return false
}
+ open fun setFromInputKeyDependencies(keys: MutableList<String>, resourceAssignment: ResourceAssignment): Boolean {
+ try {
+ for (dependencyKey in keys) {
+ var value = raRuntimeService.getInputValue(dependencyKey)
+ if (!value.isNullOrMissing()) {
+ log.debug(
+ "For Resource:(${resourceAssignment.name}) found value:({}) in input-data under: ($dependencyKey).",
+ ResourceAssignmentUtils.getValueToLog(resourceAssignment.property?.metadata, value)
+ )
+ ResourceAssignmentUtils.setResourceDataValue(resourceAssignment, raRuntimeService, value)
+ return true
+ }
+ }
+ } catch (e: BluePrintProcessorException) {
+ // NoOp - couldn't find value from input
+ }
+ return false
+ }
+
open fun resourceDefinition(name: String): ResourceDefinition? {
return if (resourceDictionaries.containsKey(name)) resourceDictionaries[name] else null
}
@@ -83,7 +108,7 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
if (valueToResolve.isEmpty() || !valueToResolve.contains("$")) {
return valueToResolve
}
- //TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
+ // TODO("Optimize to JSON Node directly without velocity").asJsonNode().toString()
return BluePrintVelocityTemplateService.generateContent(valueToResolve, keyMapping.asJsonNode().toString())
}
@@ -171,4 +196,4 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
fun addError(error: String) {
raRuntimeService.getBluePrintError().addError(error)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
index e9aa2749a..2ff5c441e 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
@@ -81,8 +81,10 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
resolveFromInputKeyMapping(checkNotNull(sourceProperties.urlPath), resolvedInputKeyMapping)
val verb = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.verb), resolvedInputKeyMapping)
- logger.info("RestResource ($dSource) dictionary information: " +
- "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})")
+ logger.info(
+ "RestResource ($dSource) dictionary information: " +
+ "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ )
val requestHeaders = sourceProperties.headers
logger.info("$dSource dictionary information : ($urlPath), ($inputKeyMapping), (${sourceProperties.outputKeyMapping})")
// Get the Rest Client Service
@@ -125,8 +127,10 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
@Throws(BluePrintProcessorException::class)
private fun populateResource(
- resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource,
- restResponse: String, path: String
+ resourceAssignment: ResourceAssignment,
+ sourceProperties: RestResourceSource,
+ restResponse: String,
+ path: String
) {
val dName = resourceAssignment.dictionaryName
val dSource = resourceAssignment.dictionarySource
@@ -168,5 +172,4 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
raRuntimeService.getBluePrintError().addError(runtimeException.message!!)
}
-
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
index 688713469..b818cc2b1 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt
@@ -25,14 +25,25 @@ import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.TextNode
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isComplexType
+import org.onap.ccsdk.cds.controllerblueprints.core.isNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.isNullOrMissing
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonReactorUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.slf4j.LoggerFactory
-import java.util.*
+import java.util.Date
class ResourceAssignmentUtils {
companion object {
@@ -51,7 +62,8 @@ class ResourceAssignmentUtils {
@Throws(BluePrintProcessorException::class)
fun setResourceDataValue(
resourceAssignment: ResourceAssignment,
- raRuntimeService: ResourceAssignmentRuntimeService, value: Any?
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ value: Any?
) {
// TODO("See if Validation is needed in future with respect to conversion and Types")
return setResourceDataValue(resourceAssignment, raRuntimeService, value.asJsonType())
@@ -60,7 +72,8 @@ class ResourceAssignmentUtils {
@Throws(BluePrintProcessorException::class)
fun setResourceDataValue(
resourceAssignment: ResourceAssignment,
- raRuntimeService: ResourceAssignmentRuntimeService, value: JsonNode
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ value: JsonNode
) {
val resourceProp = checkNotNull(resourceAssignment.property) {
"Failed in setting resource value for resource mapping $resourceAssignment"
@@ -102,7 +115,8 @@ class ResourceAssignmentUtils {
private fun setResourceValue(
resourceAssignment: ResourceAssignment,
- raRuntimeService: ResourceAssignmentRuntimeService, value: JsonNode
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ value: JsonNode
) {
// TODO("See if Validation is needed wrt to type before storing")
raRuntimeService.putResolutionStore(resourceAssignment.name, value)
@@ -211,7 +225,8 @@ class ResourceAssignmentUtils {
@Throws(BluePrintProcessorException::class)
fun getPropertyType(
- raRuntimeService: ResourceAssignmentRuntimeService, dataTypeName: String,
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ dataTypeName: String,
propertyName: String
): String {
lateinit var type: String
@@ -231,8 +246,10 @@ class ResourceAssignmentUtils {
@Throws(BluePrintProcessorException::class)
fun parseResponseNode(
- responseNode: JsonNode, resourceAssignment: ResourceAssignment,
- raRuntimeService: ResourceAssignmentRuntimeService, outputKeyMapping: MutableMap<String, String>
+ responseNode: JsonNode,
+ resourceAssignment: ResourceAssignment,
+ raRuntimeService: ResourceAssignmentRuntimeService,
+ outputKeyMapping: MutableMap<String, String>
): JsonNode {
val metadata = resourceAssignment.property!!.metadata
try {
@@ -297,7 +314,8 @@ class ResourceAssignmentUtils {
}
private fun parseResponseNodeForCollection(
- responseNode: JsonNode, resourceAssignment: ResourceAssignment,
+ responseNode: JsonNode,
+ resourceAssignment: ResourceAssignment,
raRuntimeService: ResourceAssignmentRuntimeService,
outputKeyMapping: MutableMap<String, String>
): JsonNode {
@@ -368,9 +386,11 @@ class ResourceAssignmentUtils {
}
private fun parseSingleElementOfArrayResponseNode(
- entrySchemaType: String, outputKeyMapping: MutableMap<String, String>,
+ entrySchemaType: String,
+ outputKeyMapping: MutableMap<String, String>,
raRuntimeService: ResourceAssignmentRuntimeService,
- responseNode: JsonNode, metadata: MutableMap<String, String>?
+ responseNode: JsonNode,
+ metadata: MutableMap<String, String>?
): ObjectNode {
val outputKeyMappingHasOnlyOneElement = checkIfOutputKeyMappingProvideOneElement(outputKeyMapping)
when (entrySchemaType) {
@@ -421,8 +441,10 @@ class ResourceAssignmentUtils {
}
private fun parseObjectResponseNode(
- entrySchemaType: String, outputKeyMapping: MutableMap<String, String>,
- responseArrayNode: MutableMap<String, JsonNode>, metadata: MutableMap<String, String>?
+ entrySchemaType: String,
+ outputKeyMapping: MutableMap<String, String>,
+ responseArrayNode: MutableMap<String, JsonNode>,
+ metadata: MutableMap<String, String>?
): ObjectNode {
val outputKeyMappingHasOnlyOneElement = checkIfOutputKeyMappingProvideOneElement(outputKeyMapping)
if (outputKeyMappingHasOnlyOneElement) {
@@ -437,8 +459,12 @@ class ResourceAssignmentUtils {
}
private fun parseSingleElementNodeWithOneOutputKeyMapping(
- responseSingleJsonNode: JsonNode, outputKeyMappingKey:
- String, outputKeyMappingValue: String, type: String, metadata: MutableMap<String, String>?
+ responseSingleJsonNode: JsonNode,
+ outputKeyMappingKey:
+ String,
+ outputKeyMappingValue: String,
+ type: String,
+ metadata: MutableMap<String, String>?
): ObjectNode {
val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
@@ -457,7 +483,8 @@ class ResourceAssignmentUtils {
private fun parseSingleElementNodeWithAllOutputKeyMapping(
responseSingleJsonNode: JsonNode,
outputKeyMapping: MutableMap<String, String>,
- type: String, metadata: MutableMap<String, String>?
+ type: String,
+ metadata: MutableMap<String, String>?
): ObjectNode {
val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
outputKeyMapping.map {
@@ -475,8 +502,10 @@ class ResourceAssignmentUtils {
private fun parseObjectResponseNodeWithOneOutputKeyMapping(
responseArrayNode: MutableMap<String, JsonNode>,
- outputKeyMappingKey: String, outputKeyMappingValue: String,
- type: String, metadata: MutableMap<String, String>?
+ outputKeyMappingKey: String,
+ outputKeyMappingValue: String,
+ type: String,
+ metadata: MutableMap<String, String>?
): ObjectNode {
val objectNode = JacksonUtils.objectMapper.createObjectNode()
val responseSingleJsonNode = responseArrayNode.filterKeys { key ->
@@ -494,7 +523,8 @@ class ResourceAssignmentUtils {
}
private fun parseResponseNodeForComplexType(
- responseNode: JsonNode, resourceAssignment: ResourceAssignment,
+ responseNode: JsonNode,
+ resourceAssignment: ResourceAssignment,
raRuntimeService: ResourceAssignmentRuntimeService,
outputKeyMapping: MutableMap<String, String>
): JsonNode {
@@ -536,7 +566,8 @@ class ResourceAssignmentUtils {
}
private fun checkOutputKeyMappingAllElementsInDataTypeProperties(
- dataTypeName: String, outputKeyMapping: MutableMap<String, String>,
+ dataTypeName: String,
+ outputKeyMapping: MutableMap<String, String>,
raRuntimeService: ResourceAssignmentRuntimeService
): Boolean {
val dataTypeProps = raRuntimeService.bluePrintContext().dataTypeByName(dataTypeName)?.properties
@@ -583,4 +614,4 @@ class ResourceAssignmentUtils {
return checkProtected
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
index 15a8c6c80..d3641a850 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceDefinitionUtils.kt
@@ -40,19 +40,22 @@ object ResourceDefinitionUtils {
}
/** Create a processing resource assignments for the resource definition */
- fun createResourceAssignments(resourceDefinitions: MutableMap<String, ResourceDefinition>,
- resolveDefinition: String, sources: List<String>)
- : MutableList<ResourceAssignment> {
+ fun createResourceAssignments(
+ resourceDefinitions: MutableMap<String, ResourceDefinition>,
+ resolveDefinition: String,
+ sources: List<String>
+ ):
+ MutableList<ResourceAssignment> {
/** Check if resolve definition is defined in the resource definition Map */
val resourceDefinition = resourceDefinitions[resolveDefinition]
- ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)")
+ ?: throw BluePrintProcessorException("failed to get resolve definition($resolveDefinition)")
val resourceAssignments: MutableList<ResourceAssignment> = arrayListOf()
/** Get the dependency property fields for the the resource definition to resolve */
val definitionDependencies = definitionDependencies(resourceDefinition, sources)
definitionDependencies.forEach { definitionDependencyName ->
val definitionDependency = resourceDefinitions[definitionDependencyName]
- ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
+ ?: throw BluePrintProcessorException("failed to get dependency definition($definitionDependencyName)")
val resourceAssignment = ResourceAssignment().apply {
name = definitionDependency.name
@@ -73,7 +76,7 @@ object ResourceDefinitionUtils {
dictionarySourceDefinition = source
// Clone the PropertyDefinition, otherwise property value will be overridden
property = JacksonUtils
- .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
+ .readValue(resourceDefinition.property.asJsonString(), PropertyDefinition::class.java)
val keyDependenciesExists = source.properties?.containsKey("key-dependencies") ?: false
if (keyDependenciesExists) {
dependencies = source.properties!!["key-dependencies"]!!.asListOfString().toMutableList()
@@ -85,4 +88,4 @@ object ResourceDefinitionUtils {
// Populate Resource Definition's dependencies as Input Resource Assignment
return resourceAssignments
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/SimpleRAProcessor.kt
index 32f04e6a0..32f04e6a0 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/InternalRAProcessor.cba.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/scripts/SimpleRAProcessor.kt
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt
index f8f0e991e..7dcaab733 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceDefinitionDSLTest.kt
@@ -25,8 +25,10 @@ class ResourceDefinitionDSLTest {
@Test
fun testResourceDefinitionDSL() {
- val testResourceDefinition = BluePrintTypes.resourceDefinition("service-instance-id",
- "VFW Service Instance Name") {
+ val testResourceDefinition = BluePrintTypes.resourceDefinition(
+ "service-instance-id",
+ "VFW Service Instance Name"
+ ) {
tags("service-instance-name, vfw, resources")
updatedBy("brindasanth@onap.com")
property("string", true)
@@ -74,7 +76,7 @@ class ResourceDefinitionDSLTest {
}
}
}
- //println(resourceDefinition.asJsonString(true))
+ // println(resourceDefinition.asJsonString(true))
assertNotNull(testResourceDefinition, "failed to generate testResourceDefinition")
val testResourceDefinitions = BluePrintTypes.resourceDefinitions {
@@ -86,26 +88,30 @@ class ResourceDefinitionDSLTest {
@Test
fun testResourceAssignment() {
- val testResourceAssignment = BluePrintTypes.resourceAssignment("instance-name",
- "service-instance-name", "odl-mdsal") {
+ val testResourceAssignment = BluePrintTypes.resourceAssignment(
+ "instance-name",
+ "service-instance-name", "odl-mdsal"
+ ) {
inputParameter(true)
property("string", true)
dependencies(arrayListOf("service-instance-id"))
}
- //println(resourceAssignment.asJsonString(true))
+ // println(resourceAssignment.asJsonString(true))
assertNotNull(testResourceAssignment, "failed to generate resourceAssignment")
val testResourceAssignments = BluePrintTypes.resourceAssignments {
resourceAssignment(testResourceAssignment)
- resourceAssignment("instance-name1",
- "service-instance-name", "odl-mdsal") {
+ resourceAssignment(
+ "instance-name1",
+ "service-instance-name", "odl-mdsal"
+ ) {
inputParameter(true)
property("string", true)
dependencies(arrayListOf("service-instance-id"))
}
}
- //println(testResourceAssignments.asJsonString(true))
+ // println(testResourceAssignments.asJsonString(true))
assertNotNull(testResourceAssignments, "failed to generate testResourceAssignments")
assertEquals(2, testResourceAssignments.size, "testResourceAssignments size doesn't match")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
index 671acff95..ae9b4208f 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSLTest.kt
@@ -26,7 +26,7 @@ class ResourceResolutionComponentDSLTest {
@Test
fun testNodeTypeComponentResourceResolution() {
val nodeType = BluePrintTypes.nodeTypeComponentResourceResolution()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeComponentResourceResolution")
}
@@ -42,11 +42,13 @@ class ResourceResolutionComponentDSLTest {
resourceType("vnf")
storeResult(false)
artifactPrefixNames(arrayListOf("template1", "template2"))
- dynamicProperties("""{
+ dynamicProperties(
+ """{
"prop1" : "1234",
"prop2" : true,
"prop3" : 23
- }""".trimIndent())
+ }""".trimIndent()
+ )
}
outputs {
resourceAssignmentParams(getAttribute("assignment-params"))
@@ -54,7 +56,7 @@ class ResourceResolutionComponentDSLTest {
}
}
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateComponentResourceResolution")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
index b63fa6798..83dd0ce34 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
@@ -50,7 +50,6 @@ class ResourceResolutionComponentTest {
private val executionRequest = ExecutionServiceInput()
-
@Before
fun setup() {
@@ -81,8 +80,10 @@ class ResourceResolutionComponentTest {
try {
resourceResolutionComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
- assertEquals("Can't proceed with the resolution: either provide resolution-key OR combination of resource-id and resource-type.",
- e.message)
+ assertEquals(
+ "Can't proceed with the resolution: either provide resolution-key OR combination of resource-id and resource-type.",
+ e.message
+ )
return@runBlocking
}
fail()
@@ -98,8 +99,10 @@ class ResourceResolutionComponentTest {
try {
resourceResolutionComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
- assertEquals("Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.",
- e.message)
+ assertEquals(
+ "Can't proceed with the resolution: both resource-id and resource-type should be provided, one of them is missing.",
+ e.message
+ )
return@runBlocking
}
fail()
@@ -116,9 +119,11 @@ class ResourceResolutionComponentTest {
try {
resourceResolutionComponent.processNB(executionRequest)
} catch (e: BluePrintProcessorException) {
- assertEquals("Can't proceed with the resolution: can't persist resolution without a correlation key. " +
+ assertEquals(
+ "Can't proceed with the resolution: can't persist resolution without a correlation key. " +
"Either provide a resolution-key OR combination of resource-id and resource-type OR set `storeResult` to false.",
- e.message)
+ e.message
+ )
return@runBlocking
}
fail()
@@ -136,22 +141,23 @@ class ResourceResolutionComponentTest {
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE] = occurrence
coEvery {
- resourceResolutionService.resolveResources(any(),
- any(),
- any<List<String>>(),
- any<MutableMap<String, Any>>())
+ resourceResolutionService.resolveResources(
+ any(),
+ any(),
+ any<List<String>>(),
+ any<MutableMap<String, Any>>()
+ )
} returns mutableMapOf()
-
runBlocking {
resourceResolutionComponent.processNB(executionRequest)
}
-// FIXME add verification
-// coVerify {
-// resourceResolutionService.resolveResources(eq(bluePrintRuntimeService),
-// eq(nodeTemplateName), eq(artifactNames), eq(properties))
-// }
+ // FIXME add verification
+ // coVerify {
+ // resourceResolutionService.resolveResources(eq(bluePrintRuntimeService),
+ // eq(nodeTemplateName), eq(artifactNames), eq(properties))
+ // }
}
@Test
@@ -165,4 +171,4 @@ class ResourceResolutionComponentTest {
assertEquals(1, blueprintError.errors.size)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
index db453acf4..264b45789 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
@@ -25,18 +25,14 @@ import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.PayloadUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.*
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.MockCapabilityScriptRA
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -57,12 +53,9 @@ import kotlin.test.assertTrue
* @author Brinda Santh DATE : 8/15/2018
*/
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [ResourceResolutionServiceImpl::class,
- InputResourceResolutionProcessor::class, DefaultResourceResolutionProcessor::class,
- DatabaseResourceAssignmentProcessor::class, RestResourceResolutionProcessor::class,
- CapabilityResourceResolutionProcessor::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
- BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
+@ContextConfiguration(
+ classes = [TestDatabaseConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@EnableAutoConfiguration
@@ -92,8 +85,14 @@ class ResourceResolutionServiceTest {
fun testRegisteredSource() {
val sources = resourceResolutionService.registeredResourceSources()
assertNotNull(sources, "failed to get registered sources")
- assertTrue(sources.containsAll(arrayListOf("source-input", "source-default", "source-db",
- "source-rest", "source-capability")), "failed to get registered sources : $sources")
+ assertTrue(
+ sources.containsAll(
+ arrayListOf(
+ "source-input", "source-default", "source-db",
+ "source-rest", "source-capability"
+ )
+ ), "failed to get registered sources : $sources"
+ )
}
@Test
@@ -103,29 +102,36 @@ class ResourceResolutionServiceTest {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java)!!
-
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(bluePrintRuntimeService,
- "testResolveResource")
-
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResource"
+ )
// Prepare Inputs
- PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment")
-
- resourceResolutionService.resolveResources(resourceAssignmentRuntimeService,
- "resource-assignment",
- "baseconfig",
- props)
-
+ PayloadUtils.prepareInputsFromWorkflowPayload(
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
+ )
+
+ resourceResolutionService.resolveResources(
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ "baseconfig",
+ props
+ )
}
}
@@ -135,26 +141,33 @@ class ResourceResolutionServiceTest {
runBlocking {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java)!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val artefactNames = listOf("baseconfig", "another")
// Prepare Inputs
- PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment")
-
- resourceResolutionService.resolveResources(bluePrintRuntimeService,
- "resource-assignment",
- artefactNames,
- props)
+ PayloadUtils.prepareInputsFromWorkflowPayload(
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
+ )
+
+ resourceResolutionService.resolveResources(
+ bluePrintRuntimeService,
+ "resource-assignment",
+ artefactNames,
+ props
+ )
}
-
}
@Test
@@ -163,32 +176,41 @@ class ResourceResolutionServiceTest {
runBlocking {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java)!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate")
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
val artifactPrefix = "another"
// Prepare Inputs
- PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment")
-
- resourceResolutionService.resolveResources(resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props)
+ PayloadUtils.prepareInputsFromWorkflowPayload(
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
+ )
+
+ resourceResolutionService.resolveResources(
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
+ )
}
}
-
@Test
fun testResolveResourcesWithResourceIdAndResourceType() {
@@ -197,28 +219,38 @@ class ResourceResolutionServiceTest {
runBlocking {
Assert.assertNotNull("failed to create ResourceResolutionService", resourceResolutionService)
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput =
- JacksonUtils.readValueFromClassPathFile("payload/requests/sample-resourceresolution-request.json",
- ExecutionServiceInput::class.java)!!
+ JacksonUtils.readValueFromClassPathFile(
+ "payload/requests/sample-resourceresolution-request.json",
+ ExecutionServiceInput::class.java
+ )!!
val resourceAssignmentRuntimeService =
- ResourceAssignmentUtils.transformToRARuntimeService(bluePrintRuntimeService,
- "testResolveResourcesWithMappingAndTemplate")
+ ResourceAssignmentUtils.transformToRARuntimeService(
+ bluePrintRuntimeService,
+ "testResolveResourcesWithMappingAndTemplate"
+ )
val artifactPrefix = "another"
// Prepare Inputs
- PayloadUtils.prepareInputsFromWorkflowPayload(bluePrintRuntimeService,
- executionServiceInput.payload,
- "resource-assignment")
-
- resourceResolutionService.resolveResources(resourceAssignmentRuntimeService,
- "resource-assignment",
- artifactPrefix,
- props)
+ PayloadUtils.prepareInputsFromWorkflowPayload(
+ bluePrintRuntimeService,
+ executionServiceInput.payload,
+ "resource-assignment"
+ )
+
+ resourceResolutionService.resolveResources(
+ resourceAssignmentRuntimeService,
+ "resource-assignment",
+ artifactPrefix,
+ props
+ )
}
}
@@ -259,7 +291,7 @@ class ResourceResolutionServiceTest {
val raRuntimeService = mockk<ResourceAssignmentRuntimeService>()
every { raRuntimeService.bluePrintContext() } returns mockk<BluePrintContext>()
every { raRuntimeService.getBluePrintError() } returns BluePrintError()
- every { raRuntimeService.setBluePrintError(any())} returns Unit
+ every { raRuntimeService.setBluePrintError(any()) } returns Unit
every { raRuntimeService.getInputValue("device-id") } returns "123456".asJsonPrimitive()
every { raRuntimeService.putResolutionStore(any(), any()) } returns Unit
@@ -271,8 +303,10 @@ class ResourceResolutionServiceTest {
val sources = arrayListOf<String>("sdno", "sdnc")
val resourceResolutionService = ResourceResolutionServiceImpl(applicationContext, mockk(), mockk(), mockk())
- val resolvedResources = resourceResolutionService.resolveResourceDefinition(raRuntimeService,
- resourceDefinitions, "port-speed", sources)
+ val resolvedResources = resourceResolutionService.resolveResourceDefinition(
+ raRuntimeService,
+ resourceDefinitions, "port-speed", sources
+ )
assertNotNull(resolvedResources, "failed to resolve the resources")
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt
index 2eb208566..2e9dc9e2a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceSourceDSLTest.kt
@@ -25,53 +25,51 @@ class ResourceSourceDSLTest {
@Test
fun testNodeTypeSourceInput() {
val nodeType = BluePrintTypes.nodeTypeSourceInput()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeSourceInput")
}
@Test
fun testNodeTypeSourceDefault() {
val nodeType = BluePrintTypes.nodeTypeSourceDefault()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeSourceDefault")
}
@Test
fun testNodeTypeSourceDb() {
val nodeType = BluePrintTypes.nodeTypeSourceDb()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeSourceDb")
}
@Test
fun testNodeTypeSourceRest() {
val nodeType = BluePrintTypes.nodeTypeSourceRest()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeSourceRest")
}
@Test
fun testNodeTypeSourceCapability() {
val nodeType = BluePrintTypes.nodeTypeSourceCapability()
- //println(nodeType.asJsonString(true))
+ // println(nodeType.asJsonString(true))
assertNotNull(nodeType, "failed to generate nodeTypeSourceCapability")
}
@Test
fun testNodeTemplateSourceInput() {
val nodeTemplate = BluePrintTypes.nodeTemplateSourceInput("InputSystem", "") {
-
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceInput")
}
@Test
fun testNodeTemplateSourceDefault() {
val nodeTemplate = BluePrintTypes.nodeTemplateSourceDefault("DefaultSystem", "") {
-
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceDefault")
}
@@ -91,7 +89,7 @@ class ResourceSourceDSLTest {
keyDependencies(arrayListOf("name"))
}
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceDb")
}
@@ -115,7 +113,7 @@ class ResourceSourceDSLTest {
keyDependencies(arrayListOf("name"))
}
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceRest")
}
@@ -128,7 +126,7 @@ class ResourceSourceDSLTest {
keyDependencies(arrayListOf("name"))
}
}
- //println(nodeTemplate.asJsonString(true))
+ // println(nodeTemplate.asJsonString(true))
assertNotNull(nodeTemplate, "failed to generate nodeTemplateSourceCapability")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..121fff7cb
--- /dev/null
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/TestDatabaseConfiguration.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.functions.resource.resolution
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
index dcf2e64a5..4f864a49c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolutionDBServiceTest.kt
@@ -72,13 +72,15 @@ open class ResourceResolutionDBServiceTest {
val list = listOf(rr1, rr2)
every {
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns list
runBlocking {
val res =
resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- bluePrintRuntimeService, resolutionKey, occurrence, artifactPrefix)
+ bluePrintRuntimeService, resolutionKey, occurrence, artifactPrefix
+ )
assertEquals(2, res.size)
}
@@ -88,12 +90,14 @@ open class ResourceResolutionDBServiceTest {
fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrenceTestException() {
every {
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} throws EmptyResultDataAccessException(1)
runBlocking {
val res =
resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKeyAndOccurrence(
- bluePrintRuntimeService, resolutionKey, occurrence, artifactPrefix)
+ bluePrintRuntimeService, resolutionKey, occurrence, artifactPrefix
+ )
assert(res.isEmpty())
}
@@ -107,13 +111,15 @@ open class ResourceResolutionDBServiceTest {
val list = listOf(rr1, rr2)
every {
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- any(), any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any(), any()
+ )
} returns list
runBlocking {
val res =
resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- bluePrintRuntimeService, resourceId, resourceType, occurrence, artifactPrefix)
+ bluePrintRuntimeService, resourceId, resourceType, occurrence, artifactPrefix
+ )
assertEquals(2, res.size)
}
@@ -123,12 +129,14 @@ open class ResourceResolutionDBServiceTest {
fun findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrenceTestException() {
every {
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- any(), any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any(), any()
+ )
} throws EmptyResultDataAccessException(1)
runBlocking {
val res =
resourceResolutionDBService.findByBlueprintNameAndBlueprintVersionAndArtifactNameAndResourceIdAndResourceTypeAndOccurrence(
- bluePrintRuntimeService, resourceId, resourceType, occurrence, artifactPrefix)
+ bluePrintRuntimeService, resourceId, resourceType, occurrence, artifactPrefix
+ )
assert(res.isEmpty())
}
@@ -141,12 +149,14 @@ open class ResourceResolutionDBServiceTest {
rr.value = "testValue"
every {
resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndName(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns rr
runBlocking {
val res =
resourceResolutionDBService.readValue(
- blueprintName, blueprintVersion, artifactPrefix, resolutionKey, "bob")
+ blueprintName, blueprintVersion, artifactPrefix, resolutionKey, "bob"
+ )
assertEquals(rr.name, res.name)
assertEquals(rr.value, res.value)
@@ -160,12 +170,14 @@ open class ResourceResolutionDBServiceTest {
val list = listOf(rr1, rr2)
every {
resourceResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- any(), any(), any(), any())
+ any(), any(), any(), any()
+ )
} returns list
runBlocking {
val res =
resourceResolutionDBService.readWithResolutionKey(
- blueprintName, blueprintVersion, artifactPrefix, resolutionKey)
+ blueprintName, blueprintVersion, artifactPrefix, resolutionKey
+ )
assertEquals(2, res.size)
}
}
@@ -177,12 +189,14 @@ open class ResourceResolutionDBServiceTest {
val list = listOf(rr1, rr2)
every {
resourceResolutionRepository.findByBlueprintNameAndBlueprintVersionAndResourceIdAndResourceType(
- any(), any(), any(), any())
+ any(), any(), any(), any()
+ )
} returns list
runBlocking {
val res =
resourceResolutionDBService.readWithResourceIdAndResourceType(
- blueprintName, blueprintVersion, resourceId, resourceType)
+ blueprintName, blueprintVersion, resourceId, resourceType
+ )
assertEquals(2, res.size)
}
}
@@ -203,9 +217,10 @@ open class ResourceResolutionDBServiceTest {
runBlocking {
val res =
resourceResolutionDBService.write(
- props, bluePrintRuntimeService, artifactPrefix, resourceAssignment)
+ props, bluePrintRuntimeService, artifactPrefix, resourceAssignment
+ )
assertEquals(resourceResolution, res)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt
index 48c6f02ef..71d895574 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolutionServiceTest.kt
@@ -54,11 +54,13 @@ class TemplateResolutionServiceTest {
runBlocking {
every {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns tr
val res =
templateResolutionService.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- bluePrintRuntimeService, artifactPrefix, resolutionKey)
+ bluePrintRuntimeService, artifactPrefix, resolutionKey
+ )
assertEquals(tr.result, res)
}
}
@@ -69,10 +71,12 @@ class TemplateResolutionServiceTest {
runBlocking {
every {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns tr
templateResolutionService.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
- bluePrintRuntimeService, artifactPrefix, resolutionKey)
+ bluePrintRuntimeService, artifactPrefix, resolutionKey
+ )
}
}
@@ -83,7 +87,8 @@ class TemplateResolutionServiceTest {
every { templateResolutionRepository.saveAndFlush(any<TemplateResolution>()) } returns tr
every {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns null
val res = templateResolutionService.write(props, result, bluePrintRuntimeService, artifactPrefix)
assertEquals(tr, res)
@@ -97,16 +102,19 @@ class TemplateResolutionServiceTest {
every { templateResolutionRepository.saveAndFlush(any<TemplateResolution>()) } returns tr
every {
templateResolutionRepository.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns tr
every {
templateResolutionRepository.deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any()
+ )
} returns Unit
val res = templateResolutionService.write(props, result, bluePrintRuntimeService, artifactPrefix)
verify {
templateResolutionRepository.deleteByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- eq(resolutionKey), eq(blueprintName), eq(blueprintVersion), eq(artifactPrefix), eq(occurrence))
+ eq(resolutionKey), eq(blueprintName), eq(blueprintVersion), eq(artifactPrefix), eq(occurrence)
+ )
}
assertEquals(tr, res)
}
@@ -120,18 +128,26 @@ class TemplateResolutionServiceTest {
every { templateResolutionRepository.saveAndFlush(any<TemplateResolution>()) } returns tr
every {
templateResolutionRepository.findByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any(), any()
+ )
} returns tr
every {
templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- any(), any(), any(), any(), any(), any())
+ any(), any(), any(), any(), any(), any()
+ )
} returns Unit
val res = templateResolutionService.write(props, result, bluePrintRuntimeService, artifactPrefix)
verify {
templateResolutionRepository.deleteByResourceIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactNameAndOccurrence(
- eq(resourceId), eq(resourceType), eq(blueprintName), eq(blueprintVersion), eq(artifactPrefix), eq(occurrence))
+ eq(resourceId),
+ eq(resourceType),
+ eq(blueprintName),
+ eq(blueprintVersion),
+ eq(artifactPrefix),
+ eq(occurrence)
+ )
}
assertEquals(tr, res)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintResLibPropertyService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
index f64ba2bbd..61e9f51c9 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintResLibPropertyService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBluePrintRestLibPropertyService.kt
@@ -20,17 +20,17 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
class MockBluePrintRestLibPropertyService(bluePrintProperties: BluePrintPropertiesService) :
- BluePrintRestLibPropertyService(bluePrintProperties) {
+ BluePrintRestLibPropertyService(bluePrintProperties) {
- fun mockBlueprintWebClientService (selector: String):
- MockBlueprintWebClientService {
+ fun mockBlueprintWebClientService(selector: String):
+ MockBlueprintWebClientService {
val prefix = "blueprintsprocessor.restclient.$selector"
val restClientProperties = restClientProperties(prefix)
return mockBlueprintWebClientService(restClientProperties)
}
private fun mockBlueprintWebClientService(restClientProperties: RestClientProperties):
- MockBlueprintWebClientService {
+ MockBlueprintWebClientService {
return MockBlueprintWebClientService(restClientProperties)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
index fede7be7b..e27f3ef1b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt
@@ -25,32 +25,38 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientSer
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import java.nio.charset.Charset
-import java.util.*
+import java.util.Base64
-class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties): BlueprintWebClientService {
+class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) :
+ BlueprintWebClientService {
private var mockServer: ClientAndServer
private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080"
- else restClientProperties.url.split(":")[2]
+ else restClientProperties.url.split(":")[2]
private var headers: Map<String, String>
init {
- mockServer = ClientAndServer.startClientAndServer(port.toInt())
- headers = defaultHeaders()
+ mockServer = ClientAndServer.startClientAndServer(port.toInt())
+ headers = defaultHeaders()
// Create expected requests and responses
setRequest("GET", "/aai/v14/network/generic-vnfs/generic-vnf/123456")
- setRequest("GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
- "vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name")
- setRequestWithPayload("PUT", "/query",
- "{\r\n\"start\": \"\\/nodes\\/vf-modules?vf-module-name=vf-module-name\",\r\n\"query\": \"\\/query\\/related-to?startingNodeType=vf-module&relatedToNodeType=generic-vnf\"\r\n}")
+ setRequest(
+ "GET", "/config/GENERIC-RESOURCE-API:services/service/10/service-data/vnfs/vnf/123456/" +
+ "vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name"
+ )
+ setRequestWithPayload(
+ "PUT", "/query",
+ "{\r\n\"start\": \"\\/nodes\\/vf-modules?vf-module-name=vf-module-name\",\r\n\"query\": \"\\/query\\/related-to?startingNodeType=vf-module&relatedToNodeType=generic-vnf\"\r\n}"
+ )
}
override fun defaultHeaders(): Map<String, String> {
val encodedCredentials = this.setBasicAuth("admin", "aaiTest")
return mapOf(
- HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials")
+ HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
+ HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
+ HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials"
+ )
}
override fun host(uri: String): String {
@@ -61,7 +67,11 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
mockServer.close()
}
- override fun exchangeResource(method: String, path: String, payload: String): BlueprintWebClientService.WebClientResponse<String> {
+ override fun exchangeResource(
+ method: String,
+ path: String,
+ payload: String
+ ): BlueprintWebClientService.WebClientResponse<String> {
val header = arrayOf(BasicHeader(HttpHeaders.AUTHORIZATION, headers[HttpHeaders.AUTHORIZATION]))
return when (method) {
"POST" -> {
@@ -87,11 +97,11 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
else -> {
"Get response"
}
-
}
- mockServer.`when`(request().withHeaders(Header(HttpHeaders.AUTHORIZATION, headers[HttpHeaders.AUTHORIZATION]))
- .withMethod(method)
- .withPath(path)
+ mockServer.`when`(
+ request().withHeaders(Header(HttpHeaders.AUTHORIZATION, headers[HttpHeaders.AUTHORIZATION]))
+ .withMethod(method)
+ .withPath(path)
).respond(response().withStatusCode(200).withBody("{\"aai-resource\":\"$requestResponse\"}"))
}
@@ -106,9 +116,9 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
else -> {
"Get response"
}
-
}
- mockServer.`when`(request().withHeaders(Header(HttpHeaders.AUTHORIZATION, headers[HttpHeaders.AUTHORIZATION]))
+ mockServer.`when`(
+ request().withHeaders(Header(HttpHeaders.AUTHORIZATION, headers[HttpHeaders.AUTHORIZATION]))
.withMethod(method)
.withPath(path)
.withQueryStringParameter("format", "resource")
@@ -119,6 +129,7 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient
private fun setBasicAuth(username: String, password: String): String {
val credentialsString = "$username:$password"
return Base64.getEncoder().encodeToString(
- credentialsString.toByteArray(Charset.defaultCharset()))
+ credentialsString.toByteArray(Charset.defaultCharset())
+ )
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
index 7644df37a..774c4021a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockDatabaseConfiguration.kt
@@ -24,11 +24,11 @@ import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
-open class MockDatabaseConfiguration {
+open class MockDBLibGenericService {
- @Bean(name = ["MariaDatabaseConfiguration", "MySqlDatabaseConfiguration", "PrimaryDatabaseConfiguration"])
+ @Bean(name = ["MariaDatabaseConfiguration", "MySqlDatabaseConfiguration"])
open fun createDatabaseConfiguration(): BluePrintDBLibGenericService {
- return mockk<BluePrintDBLibGenericService>()
+ return mockk<BluePrintDBLibGenericService>()
}
}
@@ -42,6 +42,4 @@ open class MockBlueprintProcessorCatalogServiceImpl {
every { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true
return bluePrintValidatorService
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
index e5b559826..3600156ce 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
@@ -29,10 +29,12 @@ import org.onap.ccsdk.cds.controllerblueprints.core.nullToEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
-import java.util.*
+import java.util.HashMap
-class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertyService:
- MockBluePrintRestLibPropertyService) : ResourceAssignmentProcessor() {
+class MockRestResourceResolutionProcessor(
+ private val blueprintRestLibPropertyService:
+ MockBluePrintRestLibPropertyService
+) : ResourceAssignmentProcessor() {
private val logger = LoggerFactory.getLogger(MockRestResourceResolutionProcessor::class.java)
@@ -77,8 +79,10 @@ class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertySe
resolveFromInputKeyMapping(checkNotNull(sourceProperties.urlPath), resolvedInputKeyMapping)
val verb = resolveFromInputKeyMapping(nullToEmpty(sourceProperties.verb), resolvedInputKeyMapping)
- logger.info("MockRestResource ($dSource) dictionary information: " +
- "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})")
+ logger.info(
+ "MockRestResource ($dSource) dictionary information: " +
+ "URL:($urlPath), input-key-mapping:($inputKeyMapping), output-key-mapping:(${sourceProperties.outputKeyMapping})"
+ )
// Get the Rest Client Service
val restClientService = blueprintWebClientService(executionRequest)
@@ -90,14 +94,18 @@ class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertySe
populateResource(executionRequest, sourceProperties, responseBody, path)
restClientService.tearDown()
} else {
- val errMsg = "Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath) response_code: ($responseStatusCode)"
+ val errMsg =
+ "Failed to get $dSource result for dictionary name ($dName) using urlPath ($urlPath) response_code: ($responseStatusCode)"
logger.warn(errMsg)
throw BluePrintProcessorException(errMsg)
}
}
} catch (e: Exception) {
ResourceAssignmentUtils.setFailedResourceDataValue(executionRequest, e.message)
- throw BluePrintProcessorException("Failed in template resolutionKey ($executionRequest) assignments with: ${e.message}", e)
+ throw BluePrintProcessorException(
+ "Failed in template resolutionKey ($executionRequest) assignments with: ${e.message}",
+ e
+ )
}
}
@@ -110,8 +118,12 @@ class MockRestResourceResolutionProcessor(private val blueprintRestLibPropertySe
}
@Throws(BluePrintProcessorException::class)
- private fun populateResource(resourceAssignment: ResourceAssignment, sourceProperties: RestResourceSource,
- restResponse: String, path: String) {
+ private fun populateResource(
+ resourceAssignment: ResourceAssignment,
+ sourceProperties: RestResourceSource,
+ restResponse: String,
+ path: String
+ ) {
val type = nullToEmpty(resourceAssignment.property?.type)
lateinit var entrySchemaType: String
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
index 98f68ebaa..8f6ac9fd5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessorTest.kt
@@ -140,9 +140,7 @@ class CapabilityResourceResolutionProcessorTest {
}
}
-open class MockCapabilityService {
-
-}
+open class MockCapabilityService
open class MockCapabilityScriptRA : ResourceAssignmentProcessor() {
val log = logger(MockCapabilityScriptRA::class)
@@ -157,6 +155,6 @@ open class MockCapabilityScriptRA : ResourceAssignmentProcessor() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
index ac5ba3c46..57d2c1b60 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
@@ -18,15 +18,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.pro
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceAssignmentRuntimeService
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.TestDatabaseConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockBlueprintProcessorCatalogServiceImpl
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockDatabaseConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.mock.MockDBLibGenericService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
@@ -38,10 +35,12 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [DatabaseResourceAssignmentProcessor::class, BluePrintPropertyConfiguration::class,
- BluePrintPropertiesService::class, BluePrintDBLibPropertySevice::class, BluePrintDBLibConfiguration::class,
- BluePrintCoreConfiguration::class, MockDatabaseConfiguration::class, MockBlueprintProcessorCatalogServiceImpl::class,
- BluePrintPropertiesService::class, PrimaryDatabaseConfiguration::class])
+@ContextConfiguration(
+ classes = [TestDatabaseConfiguration::class,
+ PrimaryDBLibGenericService::class, BluePrintDBLibPropertyService::class,
+ DatabaseResourceAssignmentProcessor::class, MockDBLibGenericService::class,
+ MockBlueprintProcessorCatalogServiceImpl::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class DatabaseResourceResolutionProcessorTest {
@@ -52,13 +51,14 @@ class DatabaseResourceResolutionProcessorTest {
fun `test database resource resolution processor db`() {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
databaseResourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService
databaseResourceAssignmentProcessor.resourceDictionaries = ResourceAssignmentUtils
- .resourceDefinitions(bluePrintContext.rootPath)
+ .resourceDefinitions(bluePrintContext.rootPath)
val resourceAssignment = ResourceAssignment().apply {
name = "service-instance-id"
@@ -73,4 +73,4 @@ class DatabaseResourceResolutionProcessorTest {
assertNotNull(processorName, "couldn't get Database resource assignment processor name")
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt
index 093a3347a..a109131fe 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessorTest.kt
@@ -40,7 +40,8 @@ class DefaultResourceResolutionProcessorTest {
fun `test default resource resolution`() {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
@@ -61,4 +62,4 @@ class DefaultResourceResolutionProcessorTest {
println(processorName)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
index 242739067..cf8dc0c59 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessorTest.kt
@@ -46,16 +46,18 @@ class InputResourceResolutionProcessorTest {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val resourceAssignmentRuntimeService = spyk(ResourceAssignmentRuntimeService("1234", bluePrintContext))
// mocking input for resource resolution
val textNode: JsonNode = TextNode("any value")
- every {resourceAssignmentRuntimeService.getInputValue("rr-name") } returns textNode
+ every { resourceAssignmentRuntimeService.getInputValue("rr-name") } returns textNode
inputResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
- inputResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils.resourceDefinitions(bluePrintContext.rootPath)
+ inputResourceResolutionProcessor.resourceDictionaries =
+ ResourceAssignmentUtils.resourceDefinitions(bluePrintContext.rootPath)
val resourceAssignment = ResourceAssignment().apply {
name = "rr-name"
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
index 1c0f33fcd..af78a604a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessorTest.kt
@@ -36,17 +36,20 @@ import kotlin.test.BeforeTest
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class])
+@ContextConfiguration(
+ classes = [MockRestResourceResolutionProcessor::class, MockBluePrintRestLibPropertyService::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, RestClientProperties::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class RestResourceResolutionProcessorTest {
+
@Autowired
lateinit var bluePrintRestLibPropertyService: MockBluePrintRestLibPropertyService
private lateinit var restResourceResolutionProcessor: MockRestResourceResolutionProcessor
@BeforeTest
- fun init(){
+ fun init() {
restResourceResolutionProcessor = MockRestResourceResolutionProcessor(bluePrintRestLibPropertyService)
}
@@ -54,13 +57,14 @@ class RestResourceResolutionProcessorTest {
fun `test rest resource resolution`() {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
restResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
restResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils
- .resourceDefinitions(bluePrintContext.rootPath)
+ .resourceDefinitions(bluePrintContext.rootPath)
val scriptPropertyInstances: MutableMap<String, Any> = mutableMapOf()
scriptPropertyInstances["mock-service1"] = MockCapabilityService()
@@ -87,13 +91,14 @@ class RestResourceResolutionProcessorTest {
fun `test rest aai get resource resolution`() {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
restResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
restResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils
- .resourceDefinitions(bluePrintContext.rootPath)
+ .resourceDefinitions(bluePrintContext.rootPath)
val scriptPropertyInstances: MutableMap<String, Any> = mutableMapOf()
scriptPropertyInstances["mock-service1"] = MockCapabilityService()
@@ -120,13 +125,14 @@ class RestResourceResolutionProcessorTest {
fun `test rest aai put resource resolution`() {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
restResourceResolutionProcessor.raRuntimeService = resourceAssignmentRuntimeService
restResourceResolutionProcessor.resourceDictionaries = ResourceAssignmentUtils
- .resourceDefinitions(bluePrintContext.rootPath)
+ .resourceDefinitions(bluePrintContext.rootPath)
val scriptPropertyInstances: MutableMap<String, Any> = mutableMapOf()
scriptPropertyInstances["mock-service1"] = MockCapabilityService()
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
index d7a696848..c564d33c6 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
@@ -64,11 +64,12 @@ class ResourceAssignmentUtilsTest {
fun setup() {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
- "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
resourceAssignmentRuntimeService = spyk(ResourceAssignmentRuntimeService("1234", bluePrintContext))
- //Init input map and expected values for tests
+ // Init input map and expected values for tests
initInputMapAndExpectedValuesForPrimitiveType()
initInputMapAndExpectedValuesForCollection()
initInputMapAndExpectedValuesForComplexType()
@@ -111,7 +112,9 @@ class ResourceAssignmentUtilsTest {
properties = mapOfPropertiesHost
}
- every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("ip-address") } returns myDataTypeIpaddress
+ every {
+ resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("ip-address")
+ } returns myDataTypeIpaddress
every { resourceAssignmentRuntimeService.bluePrintContext().dataTypeByName("host") } returns myDataTypeHost
@@ -120,35 +123,34 @@ class ResourceAssignmentUtilsTest {
@Test
fun `generateResourceDataForAssignments - positive test`() {
- //given a valid resource assignment
+ // given a valid resource assignment
val validResourceAssignment = createResourceAssignmentForTest("valid_value")
- //and a list containing that resource assignment
+ // and a list containing that resource assignment
val resourceAssignmentList = listOf<ResourceAssignment>(validResourceAssignment)
- //when the values of the resources are evaluated
+ // when the values of the resources are evaluated
val outcome = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignmentList)
- //then the assignment should produce a valid result
+ // then the assignment should produce a valid result
val expected = "{\n" + " \"pnf-id\" : \"valid_value\"\n" + "}"
- assertEquals(expected, outcome.replace("\r\n","\n"), "unexpected outcome generated")
+ assertEquals(expected, outcome.replace("\r\n", "\n"), "unexpected outcome generated")
}
@Test
fun `generateResourceDataForAssignments - resource without value is not resolved as null`() {
- //given a valid resource assignment
+ // given a valid resource assignment
val resourceAssignmentWithNullValue = createResourceAssignmentForTest(null)
- //and a list containing that resource assignment
+ // and a list containing that resource assignment
val resourceAssignmentList = listOf<ResourceAssignment>(resourceAssignmentWithNullValue)
- //when the values of the resources are evaluated
+ // when the values of the resources are evaluated
val outcome = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignmentList)
- //then the assignment should produce a valid result
+ // then the assignment should produce a valid result
val expected = "{\n" + " \"pnf-id\" : \"\${pnf-id}\"\n" + "}"
- assertEquals(expected, outcome.replace("\r\n","\n"), "unexpected outcome generated")
-
+ assertEquals(expected, outcome.replace("\r\n", "\n"), "unexpected outcome generated")
}
private fun createResourceAssignmentForTest(resourceValue: String?): ResourceAssignment {
@@ -166,61 +168,109 @@ class ResourceAssignmentUtilsTest {
}
@Test
- fun parseResponseNodeTestForPrimitivesTypes(){
- var outcome = prepareResponseNodeForTest("sample-value", "string", "",
- inputMapToTestPrimitiveTypeWithValue)
- assertEquals(expectedValueToTestPrimitiveType, outcome, "Unexpected outcome returned for primitive type of simple String")
-
- outcome = prepareResponseNodeForTest("sample-key-value", "string", "",
- inputMapToTestPrimitiveTypeWithKeyValue)
- assertEquals(expectedValueToTestPrimitiveType, outcome, "Unexpected outcome returned for primitive type of key-value String")
+ fun parseResponseNodeTestForPrimitivesTypes() {
+ var outcome = prepareResponseNodeForTest(
+ "sample-value", "string", "",
+ inputMapToTestPrimitiveTypeWithValue
+ )
+ assertEquals(
+ expectedValueToTestPrimitiveType,
+ outcome,
+ "Unexpected outcome returned for primitive type of simple String"
+ )
+
+ outcome = prepareResponseNodeForTest(
+ "sample-key-value", "string", "",
+ inputMapToTestPrimitiveTypeWithKeyValue
+ )
+ assertEquals(
+ expectedValueToTestPrimitiveType,
+ outcome,
+ "Unexpected outcome returned for primitive type of key-value String"
+ )
}
@Test
- fun parseResponseNodeTestForCollectionsOfString(){
- var outcome = prepareResponseNodeForTest("listOfString", "list",
- "string", inputMapToTestCollectionOfPrimitiveType)
- assertEquals(expectedValueToTesCollectionOfPrimitiveType, outcome, "unexpected outcome returned for list of String")
-
- outcome = prepareResponseNodeForTest("mapOfString", "map", "string",
- inputMapToTestCollectionOfPrimitiveType)
- assertEquals(expectedValueToTesCollectionOfPrimitiveType, outcome, "unexpected outcome returned for map of String")
+ fun parseResponseNodeTestForCollectionsOfString() {
+ var outcome = prepareResponseNodeForTest(
+ "listOfString", "list",
+ "string", inputMapToTestCollectionOfPrimitiveType
+ )
+ assertEquals(
+ expectedValueToTesCollectionOfPrimitiveType,
+ outcome,
+ "unexpected outcome returned for list of String"
+ )
+
+ outcome = prepareResponseNodeForTest(
+ "mapOfString", "map", "string",
+ inputMapToTestCollectionOfPrimitiveType
+ )
+ assertEquals(
+ expectedValueToTesCollectionOfPrimitiveType,
+ outcome,
+ "unexpected outcome returned for map of String"
+ )
}
@Test
- fun parseResponseNodeTestForCollectionsOfComplexType(){
- var outcome = prepareResponseNodeForTest("listOfMyDataTypeWithOneOutputKeyMapping", "list",
- "ip-address", inputMapToTestCollectionOfComplexTypeWithOneOutputKeyMapping)
- assertEquals(expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping, outcome, "unexpected outcome returned for list of String")
-
- outcome = prepareResponseNodeForTest("listOfMyDataTypeWithAllOutputKeyMapping", "list",
- "ip-address", inputMapToTestCollectionOfComplexTypeWithAllOutputKeyMapping)
- assertEquals(expectedValueToTestCollectionOfComplexTypeWithAllOutputKeyMapping, outcome, "unexpected outcome returned for list of String")
+ fun parseResponseNodeTestForCollectionsOfComplexType() {
+ var outcome = prepareResponseNodeForTest(
+ "listOfMyDataTypeWithOneOutputKeyMapping", "list",
+ "ip-address", inputMapToTestCollectionOfComplexTypeWithOneOutputKeyMapping
+ )
+ assertEquals(
+ expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping,
+ outcome,
+ "unexpected outcome returned for list of String"
+ )
+
+ outcome = prepareResponseNodeForTest(
+ "listOfMyDataTypeWithAllOutputKeyMapping", "list",
+ "ip-address", inputMapToTestCollectionOfComplexTypeWithAllOutputKeyMapping
+ )
+ assertEquals(
+ expectedValueToTestCollectionOfComplexTypeWithAllOutputKeyMapping,
+ outcome,
+ "unexpected outcome returned for list of String"
+ )
}
@Test
- fun `parseResponseNodeTestForComplexType find one output key mapping`(){
- val outcome = prepareResponseNodeForTest("complexTypeOneKeys", "host",
- "", inputMapToTestComplexTypeWithOneOutputKeyMapping)
- assertEquals(expectedValueToTestComplexTypeWithOneOutputKeyMapping, outcome, "Unexpected outcome returned for complex type")
+ fun `parseResponseNodeTestForComplexType find one output key mapping`() {
+ val outcome = prepareResponseNodeForTest(
+ "complexTypeOneKeys", "host",
+ "", inputMapToTestComplexTypeWithOneOutputKeyMapping
+ )
+ assertEquals(
+ expectedValueToTestComplexTypeWithOneOutputKeyMapping,
+ outcome,
+ "Unexpected outcome returned for complex type"
+ )
}
@Test
- fun `parseResponseNodeTestForComplexType find all output key mapping`(){
- val outcome = prepareResponseNodeForTest("complexTypeAllKeys", "host",
- "", inputMapToTestComplexTypeWithAllOutputKeyMapping)
- assertEquals(expectedValueToTestComplexTypeWithAllOutputKeyMapping, outcome, "Unexpected outcome returned for complex type")
+ fun `parseResponseNodeTestForComplexType find all output key mapping`() {
+ val outcome = prepareResponseNodeForTest(
+ "complexTypeAllKeys", "host",
+ "", inputMapToTestComplexTypeWithAllOutputKeyMapping
+ )
+ assertEquals(
+ expectedValueToTestComplexTypeWithAllOutputKeyMapping,
+ outcome,
+ "Unexpected outcome returned for complex type"
+ )
}
private fun initInputMapAndExpectedValuesForPrimitiveType() {
inputMapToTestPrimitiveTypeWithValue = "1.2.3.1".asJsonType()
val keyValue = mutableMapOf<String, String>()
- keyValue["value"]= "1.2.3.1"
+ keyValue["value"] = "1.2.3.1"
inputMapToTestPrimitiveTypeWithKeyValue = keyValue.asJsonType()
expectedValueToTestPrimitiveType = TextNode("1.2.3.1")
}
- private fun initInputMapAndExpectedValuesForCollection(){
+ private fun initInputMapAndExpectedValuesForCollection() {
val listOfIps = arrayListOf("1.2.3.1", "1.2.3.2", "1.2.3.3")
val arrayNodeForList1 = JacksonUtils.objectMapper.createArrayNode()
listOfIps.forEach {
@@ -230,12 +280,15 @@ class ResourceAssignmentUtilsTest {
}
inputMapToTestCollectionOfPrimitiveType = arrayNodeForList1
- expectedValueToTesCollectionOfPrimitiveType = arrayListOf(ExpectedResponseIp("1.2.3.1"),
- ExpectedResponseIp( "1.2.3.2"), ExpectedResponseIp("1.2.3.3")).asJsonType()
-
+ expectedValueToTesCollectionOfPrimitiveType = arrayListOf(
+ ExpectedResponseIp("1.2.3.1"),
+ ExpectedResponseIp("1.2.3.2"), ExpectedResponseIp("1.2.3.3")
+ ).asJsonType()
- val listOfIpAddresses = arrayListOf(IpAddress("1111", "1.2.3.1").asJsonType(),
- IpAddress("2222", "1.2.3.2").asJsonType(), IpAddress("3333", "1.2.3.3").asJsonType())
+ val listOfIpAddresses = arrayListOf(
+ IpAddress("1111", "1.2.3.1").asJsonType(),
+ IpAddress("2222", "1.2.3.2").asJsonType(), IpAddress("3333", "1.2.3.3").asJsonType()
+ )
val arrayNodeForList2 = JacksonUtils.objectMapper.createArrayNode()
listOfIpAddresses.forEach {
val arrayChildNode = JacksonUtils.objectMapper.createObjectNode()
@@ -259,15 +312,20 @@ class ResourceAssignmentUtilsTest {
arrayNodeForList3.add(childNode)
inputMapToTestCollectionOfComplexTypeWithAllOutputKeyMapping = arrayNodeForList3
- expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayListOf(ExpectedResponseIpAddress(IpAddress("1111", "1.2.3.1")),
- ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")), ExpectedResponseIpAddress(
- IpAddress("3333", "1.2.3.3"))).asJsonType()
- expectedValueToTestCollectionOfComplexTypeWithAllOutputKeyMapping = arrayListOf(IpAddress("1111", "1.2.3.1"),
- IpAddress("2222", "1.2.3.2"),
- IpAddress("3333", "1.2.3.3")).asJsonType()
+ expectedValueToTestCollectionOfComplexTypeWithOneOutputKeyMapping = arrayListOf(
+ ExpectedResponseIpAddress(IpAddress("1111", "1.2.3.1")),
+ ExpectedResponseIpAddress(IpAddress("2222", "1.2.3.2")), ExpectedResponseIpAddress(
+ IpAddress("3333", "1.2.3.3")
+ )
+ ).asJsonType()
+ expectedValueToTestCollectionOfComplexTypeWithAllOutputKeyMapping = arrayListOf(
+ IpAddress("1111", "1.2.3.1"),
+ IpAddress("2222", "1.2.3.2"),
+ IpAddress("3333", "1.2.3.3")
+ ).asJsonType()
}
- private fun initInputMapAndExpectedValuesForComplexType(){
+ private fun initInputMapAndExpectedValuesForComplexType() {
val mapOfComplexType = mutableMapOf<String, JsonNode>()
mapOfComplexType["value"] = Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType()
mapOfComplexType["port"] = "8888".asJsonType()
@@ -275,7 +333,8 @@ class ResourceAssignmentUtilsTest {
inputMapToTestComplexTypeWithOneOutputKeyMapping = mapOfComplexType.asJsonType()
val objectNode = JacksonUtils.objectMapper.createObjectNode()
- expectedValueToTestComplexTypeWithOneOutputKeyMapping = objectNode.set("host", Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType())
+ expectedValueToTestComplexTypeWithOneOutputKeyMapping =
+ objectNode.set("host", Host("my-ipAddress", IpAddress("1111", "1.2.3.1")).asJsonType())
val childNode1 = JacksonUtils.objectMapper.createObjectNode()
childNode1.set("name", "my-ipAddress".asJsonPrimitive())
@@ -290,8 +349,12 @@ class ResourceAssignmentUtilsTest {
expectedValueToTestComplexTypeWithAllOutputKeyMapping = childNode2
}
- private fun prepareResponseNodeForTest(dictionary_source: String, sourceType: String, entrySchema: String,
- response: Any): JsonNode {
+ private fun prepareResponseNodeForTest(
+ dictionary_source: String,
+ sourceType: String,
+ entrySchema: String,
+ response: Any
+ ): JsonNode {
val resourceAssignment = when (sourceType) {
"list", "map" -> {
@@ -311,7 +374,12 @@ class ResourceAssignmentUtilsTest {
val outputKeyMapping = prepareOutputKeyMapping(dictionary_source)
- return ResourceAssignmentUtils.parseResponseNode(responseNode, resourceAssignment, resourceAssignmentRuntimeService, outputKeyMapping)
+ return ResourceAssignmentUtils.parseResponseNode(
+ responseNode,
+ resourceAssignment,
+ resourceAssignmentRuntimeService,
+ outputKeyMapping
+ )
}
private fun prepareRADataDictionaryOfPrimaryType(dictionary_source: String): ResourceAssignment {
@@ -325,7 +393,11 @@ class ResourceAssignmentUtilsTest {
}
}
- private fun prepareRADataDictionaryCollection(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment {
+ private fun prepareRADataDictionaryCollection(
+ dictionary_source: String,
+ sourceType: String,
+ schema: String
+ ): ResourceAssignment {
return ResourceAssignment().apply {
name = "ipAddress-list"
dictionaryName = "sample-licenses"
@@ -339,7 +411,11 @@ class ResourceAssignmentUtilsTest {
}
}
- private fun prepareRADataDictionaryComplexType(dictionary_source: String, sourceType: String, schema: String): ResourceAssignment {
+ private fun prepareRADataDictionaryComplexType(
+ dictionary_source: String,
+ sourceType: String,
+ schema: String
+ ): ResourceAssignment {
return ResourceAssignment().apply {
name = "ipAddress-complexType"
dictionaryName = "sample-licenses"
@@ -355,16 +431,16 @@ class ResourceAssignmentUtilsTest {
when (dictionary_source) {
"sample-key-value", "sample-value" -> {
- //Primary Type
- if (dictionary_source=="sample-key-value")
+ // Primary Type
+ if (dictionary_source == "sample-key-value")
outputMapping["sample-ip"] = "value"
}
"listOfString", "mapOfString" -> {
- //List of string
+ // List of string
outputMapping["ip"] = "value"
}
"listOfMyDataTypeWithOneOutputKeyMapping", "listOfMyDataTypeWithAllOutputKeyMapping" -> {
- //List or map of complex Type
+ // List or map of complex Type
if (dictionary_source == "listOfMyDataTypeWithOneOutputKeyMapping")
outputMapping["ipAddress"] = "value"
else {
@@ -373,16 +449,15 @@ class ResourceAssignmentUtilsTest {
}
}
else -> {
- //Complex Type
+ // Complex Type
if (dictionary_source == "complexTypeOneKeys")
outputMapping["host"] = "value"
else {
outputMapping["name"] = "name"
outputMapping["ipAddress"] = "ipAddress"
}
-
}
}
return outputMapping
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
index f915b1ae3..7087c232c 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/resources/logback-test.xml
@@ -24,6 +24,7 @@
</appender>
<logger name="org.springframework" level="warn"/>
+ <logger name="org.springframework.data.repository" level="debug"/>
<logger name="org.hibernate" level="info"/>
<logger name="org.mockserver.mock" level="warn"/>
<logger name="org.onap.ccsdk.cds.controllerblueprints" level="warn"/>
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt
index c4553abd6..6e468509f 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/internal/scripts/InternalSimpleRestconf.kt
@@ -14,6 +14,7 @@
* limitations under the License.
*/
@file:Suppress("unused")
+
package internal.scripts
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
@@ -29,12 +30,12 @@ open class EditConfigure : AbstractScriptComponentFunction() {
}
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
- //val webClientService = restClientService("odlparent")
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ // val webClientService = restClientService("odlparent")
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
}
@@ -53,7 +54,6 @@ open class MountNEditConfigure : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
addError("failed in restconf execution : ${runtimeException.message}")
}
-
}
/**
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
index 11e774315..ff6714f21 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorConfiguration.kt
@@ -21,9 +21,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
-
@Configuration
@ComponentScan
@EnableConfigurationProperties
@ConditionalOnProperty(name = ["blueprintsprocessor.restconfEnabled"], havingValue = "true")
-open class RestconfExecutorConfiguration \ No newline at end of file
+open class RestconfExecutorConfiguration
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
index 11a35eede..906bef9a4 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/RestconfExecutorExtensions.kt
@@ -38,10 +38,12 @@ fun AbstractScriptComponentFunction.restconfClientService(selector: String): Blu
* Generic Mount function
*/
-suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService: BlueprintWebClientService,
- deviceId: String,
- payload: Any,
- headers: Map<String, String> = mutableMapOf("Content-Type" to "application/xml")) {
+suspend fun AbstractScriptComponentFunction.restconfMountDevice(
+ webClientService: BlueprintWebClientService,
+ deviceId: String,
+ payload: Any,
+ headers: Map<String, String> = mutableMapOf("Content-Type" to "application/xml")
+) {
val mountUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
log.info("sending mount request, url: $mountUrl")
@@ -68,23 +70,28 @@ suspend fun AbstractScriptComponentFunction.restconfMountDevice(webClientService
/**
* Generic Configure function
*/
-suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(webClientService: BlueprintWebClientService,
- deviceId: String, configletResourcePath: String,
- configletToApply: Any,
- additionalHeaders: Map<String, String > = mutableMapOf("Content-Type" to "application/yang.patch+xml")) {
+suspend fun AbstractScriptComponentFunction.restconfApplyDeviceConfig(
+ webClientService: BlueprintWebClientService,
+ deviceId: String,
+ configletResourcePath: String,
+ configletToApply: Any,
+ additionalHeaders: Map<String, String> = mutableMapOf("Content-Type" to "application/yang.patch+xml")
+) {
log.debug("headers: $additionalHeaders")
log.info("configuring device: $deviceId, Configlet: $configletToApply")
val applyConfigUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
- val result:Any = webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders)
+ val result: Any = webClientService.exchangeResource("PATCH", applyConfigUrl, configletToApply as String, additionalHeaders)
log.info("Configuration application result: $result")
}
-
-suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(webClientService: BlueprintWebClientService,
- deviceId: String, configletResourcePath: String)
- : BlueprintWebClientService.WebClientResponse<String> {
+suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(
+ webClientService: BlueprintWebClientService,
+ deviceId: String,
+ configletResourcePath: String
+):
+ BlueprintWebClientService.WebClientResponse<String> {
val configPathUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/" +
"$deviceId/$configletResourcePath"
@@ -95,9 +102,12 @@ suspend fun AbstractScriptComponentFunction.restconfDeviceConfig(webClientServic
/**
* Generic UnMount function
*/
-suspend fun AbstractScriptComponentFunction.restconfUnMountDevice(webClientService: BlueprintWebClientService,
- deviceId: String, payload: String) {
+suspend fun AbstractScriptComponentFunction.restconfUnMountDevice(
+ webClientService: BlueprintWebClientService,
+ deviceId: String,
+ payload: String
+) {
val unMountUrl = "restconf/config/network-topology:network-topology/topology/topology-netconf/node/$deviceId"
log.info("sending unMount request, url: $unMountUrl")
webClientService.exchangeResource("DELETE", unMountUrl, "")
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
index 0336ce958..47cf34fad 100644
--- a/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/restconf-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restconf/executor/ComponentRestconfExecutorTest.kt
@@ -30,6 +30,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFuncti
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
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
@@ -57,7 +58,17 @@ class ComponentRestconfExecutorTest {
}
payload = JacksonUtils.jsonNode("{}") as ObjectNode
}
+
+ val blueprintContext = mockk<BluePrintContext>()
+ every {
+ blueprintContext.nodeTemplateOperationImplementation(
+ any(), any(), any()
+ )
+ } returns Implementation()
+
val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
+ every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
+
componentScriptExecutor.bluePrintRuntimeService = bluePrintRuntime
componentScriptExecutor.stepName = "sample-step"
@@ -65,9 +76,10 @@ class ComponentRestconfExecutorTest {
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "activate-restconf".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = "interfaceName".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "operationName".asJsonPrimitive()
- operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] = BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
+ operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_TYPE] =
+ BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive()
operationInputs[ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE] =
- "internal.scripts.TestRestconfConfigure".asJsonPrimitive()
+ "internal.scripts.TestRestconfConfigure".asJsonPrimitive()
val stepInputData = StepData().apply {
name = "activate-restconf"
@@ -75,20 +87,22 @@ class ComponentRestconfExecutorTest {
}
executionServiceInput.stepData = stepInputData
- val blueprintContext = mockk<BluePrintContext>()
- every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs("activate-restconf",
- "interfaceName", "operationName")
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
+ "activate-restconf",
+ "interfaceName", "operationName"
+ )
} returns operationInputs
val operationOutputs = hashMapOf<String, JsonNode>()
every {
- bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs("activate-restconf",
- "interfaceName", "operationName")
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
+ "activate-restconf",
+ "interfaceName", "operationName"
+ )
} returns operationOutputs
componentScriptExecutor.applyNB(executionServiceInput)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/pom.xml b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/pom.xml
index 5dd5f1bb2..4700c6337 100644
--- a/ms/controllerblueprints/modules/blueprint-core/pom.xml
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/pom.xml
@@ -19,9 +19,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprints</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-core</artifactId>
@@ -81,6 +81,10 @@
<groupId>com.hubspot.jinjava</groupId>
<artifactId>jinjava</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </dependency>
<!--Testing dependencies-->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
index 509b8ca3a..9520f679c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt
@@ -24,6 +24,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core
*/
object BluePrintConstants {
+ val APP_NAME = System.getProperty("APPLICATION_NAME")
+ ?: System.getProperty("APP_NAME")
+ ?: System.getProperty("APPNAME")
+ ?: "cds-controller-default"
+
+ const val DATE_TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
+
const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion"
const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion"
const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"
@@ -203,4 +210,4 @@ object BluePrintConstants {
const val MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN = "artifact-script-kotlin"
const val MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH = "artifact-directed-graph"
const val MODEL_TYPE_ARTIFACT_COMPONENT_JAR = "artifact-component-jar"
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
index 22b452ab9..66d54f52e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintError.kt
@@ -26,4 +26,4 @@ class BluePrintError {
fun addError(error: String) {
this.errors.add(error)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt
index 22be37278..a2435da13 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintException.kt
@@ -15,6 +15,7 @@
*/
package org.onap.ccsdk.cds.controllerblueprints.core
+
/**
*
*
@@ -41,9 +42,8 @@ class BluePrintException : Exception {
this.code = code
}
- constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
- : super(String.format(message, *args), cause) {
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?) :
+ super(String.format(message, *args), cause) {
this.code = code
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt
index dafd076fb..daf833494 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintExtensionFunctions.kt
@@ -16,12 +16,26 @@
package org.onap.ccsdk.cds.controllerblueprints.core
-import org.onap.ccsdk.cds.controllerblueprints.core.annotations.*
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.ArtifactExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.AttributeExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsConstrain
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsDataType
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.BluePrintsProperty
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.DSLExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.InputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.OperationOutputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.PropertyDefaultValue
+import org.onap.ccsdk.cds.controllerblueprints.core.annotations.PropertyExpression
import org.onap.ccsdk.cds.controllerblueprints.core.data.ConstraintClause
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
-import org.onap.ccsdk.cds.controllerblueprints.core.dsl.*
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.dslExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getInput
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateArtifact
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateAttribute
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateOperationOutput
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getNodeTemplateProperty
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
import kotlin.reflect.KType
@@ -58,7 +72,7 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition {
property.entrySchema = this.returnType.entitySchema()
}
this.annotations.forEach { fieldAnnotation ->
- //println("Field : ${this.name} : Annotation : $fieldAnnotation")
+ // println("Field : ${this.name} : Annotation : $fieldAnnotation")
when (fieldAnnotation) {
is BluePrintsProperty ->
property.description = fieldAnnotation.description
@@ -72,20 +86,28 @@ fun <T> KProperty1<T, *>.asPropertyDefinition(): PropertyDefinition {
property.value = getInput(fieldAnnotation.propertyName)
}
is PropertyExpression -> {
- property.value = getNodeTemplateProperty(fieldAnnotation.modelableEntityName,
- fieldAnnotation.propertyName, fieldAnnotation.subPropertyName)
+ property.value = getNodeTemplateProperty(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.propertyName, fieldAnnotation.subPropertyName
+ )
}
is AttributeExpression -> {
- property.value = getNodeTemplateAttribute(fieldAnnotation.modelableEntityName,
- fieldAnnotation.attributeName, fieldAnnotation.subAttributeName)
+ property.value = getNodeTemplateAttribute(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.attributeName, fieldAnnotation.subAttributeName
+ )
}
is ArtifactExpression -> {
- property.value = getNodeTemplateArtifact(fieldAnnotation.modelableEntityName,
- fieldAnnotation.artifactName)
+ property.value = getNodeTemplateArtifact(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.artifactName
+ )
}
is OperationOutputExpression -> {
- property.value = getNodeTemplateOperationOutput(fieldAnnotation.modelableEntityName,
- fieldAnnotation.interfaceName, fieldAnnotation.propertyName, fieldAnnotation.subPropertyName)
+ property.value = getNodeTemplateOperationOutput(
+ fieldAnnotation.modelableEntityName,
+ fieldAnnotation.interfaceName, fieldAnnotation.propertyName, fieldAnnotation.subPropertyName
+ )
}
is DSLExpression -> {
property.value = dslExpression(fieldAnnotation.propertyName)
@@ -111,16 +133,16 @@ internal fun <T : KType> T.entitySchema(): EntrySchema {
internal fun <T : KType> T.asBluePrintsDataType(propertyName: String): String {
val simpleName = (this.classifier as? KClass<*>)?.java?.simpleName
- ?: throw BluePrintException("filed to get simple name.")
+ ?: throw BluePrintException("filed to get simple name.")
return when (simpleName) {
"String", "Date" -> BluePrintConstants.DATA_TYPE_STRING
"int" -> BluePrintConstants.DATA_TYPE_INTEGER
"Boolean" -> BluePrintConstants.DATA_TYPE_BOOLEAN
"Float" -> BluePrintConstants.DATA_TYPE_FLOAT
"Double" -> BluePrintConstants.DATA_TYPE_DOUBLE
- "List" -> BluePrintConstants.DATA_TYPE_LIST
+ "List" -> BluePrintConstants.DATA_TYPE_LIST
"Map" -> BluePrintConstants.DATA_TYPE_MAP
"Object", "JsonNode", "ObjectNode", "ArrayNode" -> BluePrintConstants.DATA_TYPE_JSON
else -> simpleName
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
index 0a530708f..b0b217051 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintProcessorException.kt
@@ -23,6 +23,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core
* @author Brinda Santh
*/
class BluePrintProcessorException : RuntimeException {
+
var code: Int = 100
constructor(message: String, cause: Throwable) : super(message, cause)
@@ -42,8 +43,8 @@ class BluePrintProcessorException : RuntimeException {
this.code = code
}
- constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)
- : super(String.format(message, *args), cause) {
+ constructor(code: Int, cause: Throwable, message: String, vararg args: Any?) :
+ super(String.format(message, *args), cause) {
this.code = code
}
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt
index 30ac68abd..0e4279a3a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintTypes.kt
@@ -28,60 +28,60 @@ object BluePrintTypes {
@JvmStatic
val validNodeTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
- BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- BluePrintConstants.MODEL_TYPE_NODE_VNF,
- BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON,
- BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT
+ BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
+ BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ BluePrintConstants.MODEL_TYPE_NODE_VNF,
+ BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JYTHON,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT
)
@JvmStatic
val validArtifactTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT,
- BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION
+ BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT,
+ BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION
)
@JvmStatic
val validDataTypeDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
- BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
+ BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
+ BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
)
@JvmStatic
val validRelationShipDerivedFroms: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
- BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
)
@JvmStatic
val validCapabilityTypes: MutableList<String> = arrayListOf(
- BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH,
- BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP
+ BluePrintConstants.MODEL_TYPE_CAPABILITIES_ROOT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NODE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_COMPUTE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETWORK,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_STORAGE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_PUBLIC,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_ADMIN,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT_DATABASE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ATTACHMENT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_OPERATION_SYSTEM,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_BINDABLE,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_CONTENT,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_MAPPING,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_NETCONF,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SSH,
+ BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_SFTP
)
@JvmStatic
@@ -135,19 +135,21 @@ object BluePrintTypes {
@JvmStatic
fun validPrimitiveOrCollectionPrimitive(propertyDefinition: PropertyDefinition): Boolean {
val entrySchema = propertyDefinition.entrySchema?.type ?: BluePrintConstants.DATA_TYPE_NULL
- return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type)
- && BluePrintTypes.validPrimitiveTypes().contains(entrySchema)
+ return BluePrintTypes.validPropertyTypes().contains(propertyDefinition.type) &&
+ BluePrintTypes.validPrimitiveTypes().contains(entrySchema)
}
@JvmStatic
fun validCommands(): List<String> {
- return listOf(BluePrintConstants.EXPRESSION_DSL_REFERENCE,
- BluePrintConstants.EXPRESSION_GET_INPUT,
- BluePrintConstants.EXPRESSION_GET_ATTRIBUTE,
- BluePrintConstants.EXPRESSION_GET_PROPERTY,
- BluePrintConstants.EXPRESSION_GET_ARTIFACT,
- BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT,
- BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE)
+ return listOf(
+ BluePrintConstants.EXPRESSION_DSL_REFERENCE,
+ BluePrintConstants.EXPRESSION_GET_INPUT,
+ BluePrintConstants.EXPRESSION_GET_ATTRIBUTE,
+ BluePrintConstants.EXPRESSION_GET_PROPERTY,
+ BluePrintConstants.EXPRESSION_GET_ARTIFACT,
+ BluePrintConstants.EXPRESSION_GET_OPERATION_OUTPUT,
+ BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE
+ )
}
@JvmStatic
@@ -159,6 +161,4 @@ object BluePrintTypes {
fun rootDataTypes(): List<String> {
return listOf(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/ConfigModelConstant.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/ConfigModelConstant.kt
index e8e13f2b0..e8e13f2b0 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/ConfigModelConstant.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/ConfigModelConstant.kt
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
index 7aa2fc86c..5189d0758 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctions.kt
@@ -18,13 +18,20 @@
package org.onap.ccsdk.cds.controllerblueprints.core
import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.*
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.BooleanNode
+import com.fasterxml.jackson.databind.node.DoubleNode
+import com.fasterxml.jackson.databind.node.IntNode
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.databind.node.TextNode
import org.apache.commons.lang3.ObjectUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JsonParserUtils
import org.slf4j.LoggerFactory
import org.slf4j.helpers.MessageFormatter
-import java.util.*
+import java.util.UUID
import kotlin.reflect.KClass
/**
@@ -50,8 +57,8 @@ fun <T : Any> T.bpClone(): T {
}
fun String.isJson(): Boolean {
- return ((this.trim().startsWith("{") && this.trim().endsWith("}"))
- || (this.trim().startsWith("[") && this.trim().endsWith("]")))
+ return ((this.trim().startsWith("{") && this.trim().endsWith("}")) ||
+ (this.trim().startsWith("[") && this.trim().endsWith("]")))
}
fun Any.asJsonString(intend: Boolean? = false): String {
@@ -183,7 +190,7 @@ fun ArrayNode.asListOfString(): List<String> {
fun <T> JsonNode.asType(clazzType: Class<T>): T {
return JacksonUtils.readValue(this, clazzType)
- ?: throw BluePrintException("couldn't convert JsonNode of type $clazzType")
+ ?: throw BluePrintException("couldn't convert JsonNode of type $clazzType")
}
fun JsonNode.asListOfString(): List<String> {
@@ -228,7 +235,6 @@ fun JsonNode.removeNullNode() {
}
}
-
fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) {
val convertedValue = value.asJsonType()
this[key] = convertedValue
@@ -325,5 +331,3 @@ fun JsonNode.jsonPaths(expression: String): List<String> {
check(this.isComplexType()) { "$this is not complex or array node to apply expression" }
return JsonParserUtils.paths(this, expression)
}
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt
index 518e9b236..518e9b236 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctions.kt
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt
index 793bdc455..5995a8a9e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctions.kt
@@ -50,16 +50,16 @@ fun Graph.toAdjacencyList(): Graph.AdjacencyList<String, EdgeLabel> {
fun Graph.findAllPaths(from: String, to: String, path: List<String> = emptyList()): List<List<String>> {
if (from == to) return listOf(path + to)
return nodes[from]!!.neighbors()
- .filter { !path.contains(it.id) }
- .flatMap { findAllPaths(it.id, to, path + from) }
+ .filter { !path.contains(it.id) }
+ .flatMap { findAllPaths(it.id, to, path + from) }
}
fun Graph.findCycles(node: String): List<List<String>> {
fun findCycles(path: List<String>): List<List<String>> {
if (path.size > 3 && path.first() == path.last()) return listOf(path)
return nodes[path.last()]!!.neighbors()
- .filterNot { path.tail().contains(it.id) }
- .flatMap { findCycles(path + it.id) }
+ .filterNot { path.tail().contains(it.id) }
+ .flatMap { findCycles(path + it.id) }
}
return findCycles(listOf(node))
}
@@ -76,41 +76,40 @@ fun Graph.endNodes(): Set<Graph.Node> = this.nodes.values.filter {
fun Graph.node(node: String) = this.nodes[node]
fun Graph.edge(label: EdgeLabel) =
- this.edges.filter { it.label == label }
+ this.edges.filter { it.label == label }
fun Graph.incomingEdges(node: String) =
- this.edges.filter { it.target.id == node }
+ this.edges.filter { it.target.id == node }
fun Graph.incomingNodes(node: String) =
- this.incomingEdges(node).map { it.source }
+ this.incomingEdges(node).map { it.source }
fun Graph.outgoingEdges(node: String) =
- this.edges.filter { it.source.id == node }
+ this.edges.filter { it.source.id == node }
fun Graph.outgoingNodes(node: String) =
- this.outgoingEdges(node).map { it.target }
+ this.outgoingEdges(node).map { it.target }
fun Graph.outgoingEdges(node: String, label: EdgeLabel) =
- this.edges.filter { it.source.id == node && it.label == label }
+ this.edges.filter { it.source.id == node && it.label == label }
fun Graph.outgoingNodes(node: String, label: EdgeLabel) =
- this.outgoingEdges(node, label).map { it.target }
+ this.outgoingEdges(node, label).map { it.target }
fun Graph.outgoingNodesNotInEdgeLabels(node: String, labels: List<EdgeLabel>) =
- this.outgoingEdgesNotInLabels(node, labels).map { it.target }
+ this.outgoingEdgesNotInLabels(node, labels).map { it.target }
fun Graph.outgoingEdges(node: String, labels: List<EdgeLabel>) =
- this.edges.filter { it.source.id == node && labels.contains(it.label) }
+ this.edges.filter { it.source.id == node && labels.contains(it.label) }
fun Graph.outgoingEdgesNotInLabels(node: String, labels: List<EdgeLabel>) =
- this.edges.filter { it.source.id == node && !labels.contains(it.label) }
+ this.edges.filter { it.source.id == node && !labels.contains(it.label) }
fun Graph.outgoingNodes(node: String, labels: List<EdgeLabel>) =
- this.outgoingEdges(node, labels).map { it.target }
+ this.outgoingEdges(node, labels).map { it.target }
fun Graph.isEndNode(node: Graph.Node): Boolean {
return this.endNodes().contains(node)
}
fun <T> List<T>.tail(): List<T> = drop(1)
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt
index 001ec751e..9d81f13e3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContext.kt
@@ -24,7 +24,8 @@ import kotlin.coroutines.CoroutineContext
typealias MDCContextMap = Map<String, String>?
class MDCContext(private val contextMap: MDCContextMap = MDC.getCopyOfContextMap()) :
- ThreadContextElement<MDCContextMap>, AbstractCoroutineContextElement(Key) {
+ ThreadContextElement<MDCContextMap>, AbstractCoroutineContextElement(Key) {
+
/**
* Key of [MDCContext] in [CoroutineContext].
*/
@@ -47,4 +48,4 @@ class MDCContext(private val contextMap: MDCContextMap = MDC.getCopyOfContextMap
MDC.setContextMap(contextMap)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt
index 94392b992..c39442976 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotations.kt
@@ -16,16 +16,15 @@
package org.onap.ccsdk.cds.controllerblueprints.core.annotations
-
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import kotlin.reflect.KClass
@Target(AnnotationTarget.CLASS)
annotation class BluePrintsDataType(
- val name: String,
- val version: String = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- val description: String,
- val derivedFrom: String = "tosca.datatypes.root"
+ val name: String,
+ val version: String = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ val description: String,
+ val derivedFrom: String = "tosca.datatypes.root"
)
@Target(AnnotationTarget.CLASS)
@@ -35,13 +34,17 @@ annotation class BluePrintsWorkflowInput
annotation class BluePrintsWorkflowOutput
@Target(AnnotationTarget.CLASS)
-annotation class BluePrintsNodeType(val propertiesType: KClass<*>, val attributesType: KClass<*>,
- val inputsType: KClass<*>, val outputsType: KClass<*>)
+annotation class BluePrintsNodeType(
+ val propertiesType: KClass<*>,
+ val attributesType: KClass<*>,
+ val inputsType: KClass<*>,
+ val outputsType: KClass<*>
+)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class BluePrintsProperty(
- val name: String = "",
- val description: String = ""
+ val name: String = "",
+ val description: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
@@ -55,43 +58,43 @@ annotation class PropertyValidValue(val value: String)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class InputExpression(
- val propertyName: String
+ val propertyName: String
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class PropertyExpression(
- val modelableEntityName: String = "SELF",
- val reqOrCapEntityName: String = "",
- val propertyName: String,
- val subPropertyName: String = ""
+ val modelableEntityName: String = "SELF",
+ val reqOrCapEntityName: String = "",
+ val propertyName: String,
+ val subPropertyName: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class AttributeExpression(
- val modelableEntityName: String = "SELF",
- val reqOrCapEntityName: String = "",
- val attributeName: String,
- val subAttributeName: String = ""
+ val modelableEntityName: String = "SELF",
+ val reqOrCapEntityName: String = "",
+ val attributeName: String,
+ val subAttributeName: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class ArtifactExpression(
- val modelableEntityName: String = "SELF",
- val artifactName: String,
- val location: String = "LOCAL_FILE",
- val remove: Boolean = false
+ val modelableEntityName: String = "SELF",
+ val artifactName: String,
+ val location: String = "LOCAL_FILE",
+ val remove: Boolean = false
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class OperationOutputExpression(
- val modelableEntityName: String = "SELF",
- val interfaceName: String,
- val operationName: String,
- val propertyName: String,
- val subPropertyName: String = ""
+ val modelableEntityName: String = "SELF",
+ val interfaceName: String,
+ val operationName: String,
+ val propertyName: String,
+ val subPropertyName: String = ""
)
@Target(AnnotationTarget.FIELD, AnnotationTarget.TYPE_PARAMETER, AnnotationTarget.PROPERTY)
annotation class DSLExpression(
- val propertyName: String
-) \ No newline at end of file
+ val propertyName: String
+)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt
index 66bc3b3cb..66bc3b3cb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/common/ApplicationConstants.kt
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
index 10b902f2b..0128f64a5 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/config/BluePrintLoadConfiguration.kt
@@ -17,13 +17,12 @@
package org.onap.ccsdk.cds.controllerblueprints.core.config
-
open class BluePrintLoadConfiguration {
lateinit var blueprintDeployPath: String
lateinit var blueprintArchivePath: String
lateinit var blueprintWorkingPath: String
-
+
var loadBluePrintPaths: String? = null
var loadModeTypePaths: String? = null
var loadResourceDictionaryPaths: String? = null
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
new file mode 100644
index 000000000..37c128714
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
@@ -0,0 +1,77 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
+ *
+ * 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.
+ */
+@file:Suppress("unused")
+
+package org.onap.ccsdk.cds.controllerblueprints.core.data
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+
+/**
+ *
+ *
+ * @author Brinda Santh
+ */
+data class ExpressionData(
+ var isExpression: Boolean = false,
+ var valueNode: JsonNode,
+ var expressionNode: ObjectNode? = null,
+ var dslExpression: DSLExpression? = null,
+ var inputExpression: InputExpression? = null,
+ var propertyExpression: PropertyExpression? = null,
+ var attributeExpression: AttributeExpression? = null,
+ var artifactExpression: ArtifactExpression? = null,
+ var operationOutputExpression: OperationOutputExpression? = null,
+ var command: String? = null
+)
+
+data class InputExpression(
+ var propertyName: String
+)
+
+data class PropertyExpression(
+ var modelableEntityName: String = "SELF",
+ var reqOrCapEntityName: String? = null,
+ var propertyName: String,
+ var subPropertyName: String? = null
+)
+
+data class AttributeExpression(
+ var modelableEntityName: String = "SELF",
+ var reqOrCapEntityName: String? = null,
+ var attributeName: String,
+ var subAttributeName: String? = null
+)
+
+data class ArtifactExpression(
+ val modelableEntityName: String = "SELF",
+ val artifactName: String,
+ val location: String? = "LOCAL_FILE",
+ val remove: Boolean? = false
+)
+
+data class OperationOutputExpression(
+ val modelableEntityName: String = "SELF",
+ val interfaceName: String,
+ val operationName: String,
+ val propertyName: String,
+ var subPropertyName: String? = null
+)
+
+data class DSLExpression(
+ val propertyName: String
+)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
index fc796c9ed..9c9b1f9bf 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintGraph.kt
@@ -98,7 +98,7 @@ class Graph {
fun neighbors(): List<Node> = edges.map { edge -> edge.target(this) }
fun neighbors(label: EdgeLabel): List<Node> = edges.filter { it.label == label }
- .map { edge -> edge.target(this) }
+ .map { edge -> edge.target(this) }
fun labelEdges(label: EdgeLabel): List<Edge> = edges.filter { it.label == label }
@@ -106,19 +106,20 @@ class Graph {
}
data class Edge(
- val source: Node,
- val target: Node,
- val label: EdgeLabel,
- var status: EdgeStatus = EdgeStatus.NOT_STARTED) {
+ val source: Node,
+ val target: Node,
+ val label: EdgeLabel,
+ var status: EdgeStatus = EdgeStatus.NOT_STARTED
+ ) {
fun target(node: Node): Node = target
fun equivalentTo(other: Edge) =
- (source == other.source && target == other.target)
- || (source == other.target && target == other.source)
+ (source == other.source && target == other.target) ||
+ (source == other.target && target == other.source)
override fun toString() =
- "${source.id}>${target.id}/$label($status)"
+ "${source.id}>${target.id}/$label($status)"
}
data class TermForm(val nodes: Collection<String>, val edges: List<Term>) {
@@ -147,23 +148,27 @@ class Graph {
companion object {
fun labeledDirectedTerms(termForm: TermForm): Graph =
- createFromTerms(termForm) { graph, n1, n2, value -> graph.addEdge(n1, n2, value) }
+ createFromTerms(termForm) { graph, n1, n2, value -> graph.addEdge(n1, n2, value) }
fun labeledDirectedAdjacent(adjacencyList: AdjacencyList<String, EdgeLabel>): Graph =
- fromAdjacencyList(adjacencyList) { graph, n1, n2, value ->
- graph.addEdge(n1, n2, value)
- }
+ fromAdjacencyList(adjacencyList) { graph, n1, n2, value ->
+ graph.addEdge(n1, n2, value)
+ }
- private fun createFromTerms(termForm: TermForm,
- addFunction: (Graph, String, String, EdgeLabel) -> Unit): Graph {
+ private fun createFromTerms(
+ termForm: TermForm,
+ addFunction: (Graph, String, String, EdgeLabel) -> Unit
+ ): Graph {
val graph = Graph()
termForm.nodes.forEach { graph.addNode(it) }
termForm.edges.forEach { addFunction(graph, it.source, it.target, it.label) }
return graph
}
- private fun fromAdjacencyList(adjacencyList: AdjacencyList<String, EdgeLabel>,
- addFunction: (Graph, String, String, EdgeLabel) -> Unit): Graph {
+ private fun fromAdjacencyList(
+ adjacencyList: AdjacencyList<String, EdgeLabel>,
+ addFunction: (Graph, String, String, EdgeLabel) -> Unit
+ ): Graph {
val graph = Graph()
adjacencyList.entries.forEach { graph.addNode(it.node) }
adjacencyList.entries.forEach { (node, links) ->
@@ -172,4 +177,4 @@ class Graph {
return graph
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
index a2cba95d9..71a31dcca 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintModel.kt
@@ -31,6 +31,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
* @author Brinda Santh
*/
open class EntityType {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -48,6 +49,7 @@ open class EntityType {
authorization credentials used to access network accessible resources.
*/
class Credential {
+
@get:JsonIgnore
var id: String? = null
var protocol: String? = null
@@ -63,6 +65,7 @@ class Credential {
A constraint clause defines an operation along with one or more compatible values that can be used to define a constraint on a property or parameter’s allowed values when it is defined in a TOSCA Service Template or one of its entities.
*/
class ConstraintClause {
+
var equal: JsonNode? = null
@get:JsonProperty("greater_than")
var greaterThan: JsonNode? = null
@@ -101,6 +104,7 @@ class NodeFilterDefinition {
and implementation artifacts that are referenced within the TOSCA Service Template.
*/
class RepositoryDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -108,13 +112,13 @@ class RepositoryDefinition {
var credential: Credential? = null
}
-
/*
3.5.6 Artifact definition
An artifact definition defines a named, typed file that can be associated with Node Type
or Node Template and used by orchestration engine to facilitate deployment and implementation of interface operations.
*/
class ArtifactDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -126,7 +130,6 @@ class ArtifactDefinition {
var properties: MutableMap<String, JsonNode>? = null
}
-
/*
3.5.7 Import definition
An import definition is used within a TOSCA Service Template to locate and uniquely name
@@ -134,6 +137,7 @@ another TOSCA Service Template file which has type and template definitions to b
and referenced within another Service Template.
*/
class ImportDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var file: String
@@ -151,6 +155,7 @@ Properties are used by template authors to provide input values to TOSCA entitie
instantiated. The value of a property can be retrieved using the get_property function within TOSCA Service Templates.
*/
class PropertyDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -170,7 +175,6 @@ class PropertyDefinition {
var value: JsonNode? = null
}
-
/*
3.5.10 Attribute definition
@@ -203,6 +207,7 @@ class AttributeDefinition {
An operation definition defines a named function or procedure that can be bound to an implementation artifact (e.g., a script).
*/
class OperationDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -216,7 +221,7 @@ class Implementation {
var dependencies: MutableList<String>? = null
@get:JsonProperty("operation_host")
var operationHost: String = BluePrintConstants.PROPERTY_SELF
- //Timeout value in seconds
+ // Timeout value in seconds
var timeout: Int = 180
}
@@ -225,6 +230,7 @@ class Implementation {
An interface definition defines a named interface that can be associated with a Node or Relationship Type
*/
class InterfaceDefinition {
+
@get:JsonIgnore
var id: String? = null
var type: String? = null
@@ -237,6 +243,7 @@ class InterfaceDefinition {
An event filter definition defines criteria for selection of an attribute, for the purpose of monitoring it, within a TOSCA entity, or one its capabilities.
*/
class EventFilterDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var node: String
@@ -249,6 +256,7 @@ class EventFilterDefinition {
A trigger definition defines the event, condition and action that is used to “trigger” a policy it is associated with.
*/
class TriggerDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -271,6 +279,7 @@ class TriggerDefinition {
· Inline another workflow defined in the topology (to allow reusability)
*/
class Activity {
+
var delegate: String? = null
@get:JsonProperty("set_state")
var setState: String? = null
@@ -284,6 +293,7 @@ class Activity {
A workflow condition can be used as a filter or precondition to check if a workflow can be processed or not based on the state of the instances of a TOSCA topology deployment. When not met, the workflow will not be triggered.
*/
class PreConditionDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var target: String
@@ -297,6 +307,7 @@ class PreConditionDefinition {
A workflow step allows to define one or multiple sequenced activities in a workflow and how they are connected to other steps in the workflow. They are the building blocks of a declarative workflow.
*/
class Step {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -333,6 +344,7 @@ class CapabilityDefinition {
The Requirement definition describes a named requirement (dependencies) of a TOSCA Node Type or Node template which needs to be fulfilled by a matching Capability definition declared by another TOSCA modelable entity. The requirement definition may itself include the specific name of the fulfilling entity (explicitly) or provide an abstract type, along with additional filtering characteristics, that a TOSCA orchestrator can use to fulfill the capability at runtime (implicitly).
*/
class RequirementDefinition {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -347,11 +359,11 @@ class RequirementDefinition {
An Artifact Type is a reusable entity that defines the type of one or more files that are used to define implementation or deployment artifacts that are referenced by nodes or relationships on their operations.
*/
class ArtifactType : EntityType() {
+
@get:JsonProperty("mime_type")
var mimeType: String? = null
@get:JsonProperty("file_ext")
var fileExt: MutableList<String>? = null
-
}
/*
@@ -415,7 +427,6 @@ class GroupType : EntityType() {
var requirements: ArrayList<RequirementDefinition>? = null
var capabilities: MutableMap<String, CapabilityDefinition>? = null
var interfaces: MutableMap<String, InterfaceDefinition>? = null
-
}
/*
@@ -425,6 +436,7 @@ class GroupType : EntityType() {
(i.e., it does not prevent the application or service from being deployed or run if it did not exist).
*/
class PolicyType : EntityType() {
+
lateinit var targets: MutableList<String>
}
@@ -433,6 +445,7 @@ class PolicyType : EntityType() {
A capability assignment allows node template authors to assign values to properties and attributes for a named capability definition that is part of a Node Template’s type definition.
*/
class CapabilityAssignment {
+
@get:JsonIgnore
var id: String? = null
var attributes: MutableMap<String, JsonNode>? = null
@@ -444,6 +457,7 @@ class CapabilityAssignment {
A Relationship Template specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
*/
class GroupDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -459,6 +473,7 @@ class GroupDefinition {
A policy definition defines a policy that can be associated with a TOSCA topology or top-level entity definition (e.g., group definition, node template, etc.).
*/
class PolicyDefinition {
+
@get:JsonIgnore
var id: String? = null
lateinit var type: String
@@ -468,12 +483,12 @@ class PolicyDefinition {
var targets: MutableList<String>? = null
}
-
/*
3.8 Topology Template definition
This section defines the topology template of a cloud application. The main ingredients of the topology template are node templates representing components of the application and relationship templates representing links between the components. These elements are defined in the nested node_templates section and the nested relationship_templates sections, respectively. Furthermore, a topology template allows for defining input parameters, output parameters as well as grouping of node templates.
*/
class TopologyTemplate {
+
@get:JsonIgnore
var id: String? = null
var description: String? = null
@@ -520,7 +535,7 @@ open class NodeTemplate {
lateinit var type: String
var metadata: MutableMap<String, String>? = null
var directives: MutableList<String>? = null
- //@get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
+ // @get:JsonSerialize(using = PropertyDefinitionValueSerializer::class)
var properties: MutableMap<String, JsonNode>? = null
var attributes: MutableMap<String, JsonNode>? = null
var capabilities: MutableMap<String, CapabilityAssignment>? = null
@@ -566,11 +581,10 @@ class RequirementAssignment {
var id: String? = null
var capability: String? = null
var node: String? = null
- //Relationship Type or Relationship Template
+ // Relationship Type or Relationship Template
var relationship: String? = null
}
-
class Workflow {
@get:JsonIgnore
var id: String? = null
@@ -581,7 +595,6 @@ class Workflow {
var outputs: MutableMap<String, PropertyDefinition>? = null
}
-
class ConditionClause {
var and: ArrayList<MutableMap<String, Any>>? = null
var or: ArrayList<MutableMap<String, Any>>? = null
@@ -594,9 +607,12 @@ class ConditionClause {
A TOSCA Service Template (YAML) document contains element definitions of building blocks for cloud application, or complete models of cloud applications. This section describes the top-level structural elements (TOSCA keynames) along with their grammars, which are allowed to appear in a TOSCA Service Template document.
*/
-@JsonPropertyOrder(value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
- "topologyTemplate"])
+@JsonPropertyOrder(
+ value = ["toscaDefinitionsVersion", "description", "metadata", "imports", "dsl_definitions",
+ "topologyTemplate"]
+)
class ServiceTemplate : Cloneable {
+
@get:JsonIgnore
var id: String? = null
@get:JsonProperty("tosca_definitions_version")
@@ -620,7 +636,7 @@ class ServiceTemplate : Cloneable {
@get:JsonProperty("topology_template")
var topologyTemplate: TopologyTemplate? = null
- override public fun clone(): ServiceTemplate {
+ public override fun clone(): ServiceTemplate {
return super.clone() as ServiceTemplate
}
}
@@ -634,4 +650,3 @@ class ToscaMetaData {
var templateVersion: String? = null
var templateTags: String? = null
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintErrorCode.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
index 51d088ee1..8bdedd429 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BlueprintErrorCode.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/ErrorCode.kt
@@ -23,11 +23,12 @@ import java.util.HashMap
* @author Steve Siani
* @version 1.0
*/
-enum class ErrorCode (val value: Int, val httpCode: Int) {
+enum class ErrorCode(val value: Int, val httpCode: Int) {
- /// TODO: Add more attribute for each needed application protocol
+ // / TODO: Add more attribute for each needed application protocol
// TODO: Example: INVALID_FILE_EXTENSION(2, 415, 25)
GENERIC_FAILURE(1, 500) {
+
override fun message(detailMsg: String): String {
return "Generic failure. Details : {$detailMsg}"
}
@@ -99,4 +100,4 @@ enum class ErrorCode (val value: Int, val httpCode: Int) {
return if (map.containsKey(value)) map[value] else map[1]
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
index 182d9a050..13e9f0e5a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/AbstractNodeTemplateOperationImplBuilder.kt
@@ -18,8 +18,11 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
abstract class AbstractNodeTemplateOperationImplBuilder<Prop : PropertiesAssignmentBuilder,
In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
- id: String, type: String, private val interfaceName: String, description: String
-) : AbstractNodeTemplatePropertyImplBuilder<Prop>(id, type, description) {
+ id: String,
+ type: String,
+ private val interfaceName: String,
+ description: String
+ ) : AbstractNodeTemplatePropertyImplBuilder<Prop>(id, type, description) {
open fun definedOperation(description: String, block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
typedOperation<In, Out>(interfaceName, description, block)
@@ -27,7 +30,9 @@ abstract class AbstractNodeTemplateOperationImplBuilder<Prop : PropertiesAssignm
}
abstract class AbstractNodeTemplatePropertyImplBuilder<Prop : PropertiesAssignmentBuilder>(
- id: String, type: String, description: String
+ id: String,
+ type: String,
+ description: String
) : NodeTemplateBuilder(id, type, description) {
open fun definedProperties(block: Prop.() -> Unit) {
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
new file mode 100644
index 000000000..9964687a6
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
@@ -0,0 +1,313 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * 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.controllerblueprints.core.dsl
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
+
+// CDS DSLs
+fun blueprint(
+ name: String,
+ version: String,
+ author: String,
+ tags: String,
+ block: DSLBluePrintBuilder.() -> Unit
+): DSLBluePrint {
+ return DSLBluePrintBuilder(name, version, author, tags).apply(block).build()
+}
+
+// TOSCA DSLs
+fun serviceTemplate(
+ name: String,
+ version: String,
+ author: String,
+ tags: String,
+ block: BluePrintServiceDSLBuilder.() -> Unit
+): ServiceTemplate {
+ return BluePrintServiceDSLBuilder(name, version, author, tags).apply(block).build()
+}
+
+fun workflow(id: String, description: String, block: WorkflowBuilder.() -> Unit): Workflow {
+ return WorkflowBuilder(id, description).apply(block).build()
+}
+
+fun nodeTemplate(
+ id: String,
+ type: String,
+ description: String,
+ block: NodeTemplateBuilder.() -> Unit
+): NodeTemplate {
+ return NodeTemplateBuilder(id, type, description).apply(block).build()
+}
+
+fun nodeType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: NodeTypeBuilder.() -> Unit
+): NodeType {
+ return NodeTypeBuilder(id, version, derivedFrom, description).apply(block).build()
+}
+
+fun dataType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: DataTypeBuilder.() -> Unit
+): DataType {
+ return DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
+}
+
+fun artifactType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: ArtifactTypeBuilder.() -> Unit
+): ArtifactType {
+ return ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
+}
+
+fun relationshipType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: RelationshipTypeBuilder.() -> Unit
+): RelationshipType {
+ return RelationshipTypeBuilder(id, version, derivedFrom, description).apply(block).build()
+}
+
+// DSL Function
+fun dslExpression(key: String): JsonNode {
+ return ("*$key").asJsonPrimitive()
+}
+// Input Function
+
+fun getInput(inputKey: String, jsonPath: String? = null): JsonNode {
+ return """{"get_input": "$inputKey"}""".jsonAsJsonType()
+}
+
+fun getAttribute(attributeId: String, jsonPath: String? = null): JsonNode {
+ return getNodeTemplateAttribute("SELF", attributeId, jsonPath)
+}
+
+fun getNodeTemplateAttribute(nodeTemplateId: String, attributeId: String): JsonNode {
+ return getNodeTemplateAttribute(nodeTemplateId, attributeId, null)
+}
+
+fun getNodeTemplateAttribute(nodeTemplateId: String, attributeId: String, jsonPath: String?): JsonNode {
+ return if (jsonPath.isNullOrEmpty() || jsonPath.isNullOrBlank()) {
+ """{"get_attribute": ["$nodeTemplateId", "$attributeId"]}""".jsonAsJsonType()
+ } else {
+ """{"get_attribute": ["$nodeTemplateId", "$attributeId", "$jsonPath"]}""".jsonAsJsonType()
+ }
+}
+
+// Property Function
+
+fun getProperty(propertyId: String, jsonPath: String? = null): JsonNode {
+ return getNodeTemplateProperty("SELF", propertyId, jsonPath)
+}
+
+fun getNodeTemplateProperty(nodeTemplateName: String, propertyId: String): JsonNode {
+ return getNodeTemplateProperty(nodeTemplateName, propertyId, null)
+}
+
+fun getNodeTemplateProperty(nodeTemplateName: String, propertyId: String, jsonPath: String?): JsonNode {
+ return if (jsonPath.isNullOrEmpty() || jsonPath.isNullOrBlank()) {
+ """{"get_property": ["$nodeTemplateName", "$propertyId"]}""".jsonAsJsonType()
+ } else {
+ """{"get_property": ["$nodeTemplateName", "$propertyId", "$jsonPath"]}""".jsonAsJsonType()
+ }
+}
+
+// Artifact Function
+
+fun getArtifact(artifactId: String): JsonNode {
+ return getNodeTemplateArtifact("SELF", artifactId)
+}
+
+fun getNodeTemplateArtifact(nodeTemplateName: String, artifactId: String): JsonNode {
+ return """{"get_artifact": ["$nodeTemplateName", "$artifactId"]}""".jsonAsJsonType()
+}
+
+// Operation Function
+
+fun getNodeTemplateOperationOutput(
+ nodeTemplateName: String,
+ interfaceName: String,
+ propertyId: String,
+ jsonPath: String? = null
+): JsonNode {
+ return """{"get_operation_output": ["$nodeTemplateName", "$interfaceName", "process","$propertyId","$jsonPath" ]}""".trimMargin().jsonAsJsonType()
+}
+
+/** Blueprint Type Extensions */
+
+fun BluePrintTypes.nodeTypeComponent(): NodeType {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default Component Node"
+ ) {
+ }
+}
+
+fun BluePrintTypes.nodeTypeWorkflow(): NodeType {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default Workflow Node"
+ ) {
+ }
+}
+
+fun BluePrintTypes.nodeTypeVnf(): NodeType {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_VNF,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default VNF Node"
+ ) {
+ }
+}
+
+fun BluePrintTypes.nodeTypeResourceSource(): NodeType {
+ return nodeType(
+ id = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ description = "This is default Resource Source Node"
+ ) {
+ }
+}
+
+/** Artifacts */
+
+fun BluePrintTypes.artifactTypeTemplateVelocity(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Velocity Artifact"
+ ) {
+ fileExt("vtl")
+ }
+}
+
+fun BluePrintTypes.artifactTypeTempleJinja(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Jinja Artifact"
+ ) {
+ fileExt("jinja")
+ }
+}
+
+fun BluePrintTypes.artifactTypeMappingResource(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Mapping Resource Artifact"
+ ) {
+ fileExt("json")
+ }
+}
+
+fun BluePrintTypes.artifactTypeScriptJython(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Jython Script Artifact"
+ ) {
+ fileExt("py")
+ }
+}
+
+fun BluePrintTypes.artifactTypeScriptKotlin(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Kotlin Script Artifact"
+ ) {
+ fileExt("kts")
+ }
+}
+
+fun BluePrintTypes.artifactTypeDirectedGraph(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Directed Graph Artifact"
+ ) {
+ fileExt("xml", "json")
+ }
+}
+
+fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType {
+ return artifactType(
+ id = BluePrintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ description = "Component Artifact"
+ ) {
+ fileExt("jar")
+ }
+}
+
+/** Relationship Types */
+
+fun BluePrintTypes.relationshipTypeConnectsTo(): RelationshipType {
+ return relationshipType(
+ id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ description = "Relationship connects to"
+ ) {
+ }
+}
+
+fun BluePrintTypes.relationshipTypeDependsOn(): RelationshipType {
+ return relationshipType(
+ id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ description = "Relationship depends on"
+ ) {
+ }
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
index d46d478a8..f2e964a1d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLBuilder.kt
@@ -19,15 +19,23 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
/**
* @author Brinda Santh
*/
-class DSLBluePrintBuilder(private val name: String,
- private val version: String,
- private val author: String,
- private val tags: String) {
+class DSLBluePrintBuilder(
+ private val name: String,
+ private val version: String,
+ private val author: String,
+ private val tags: String
+) {
private var dslBluePrint = DSLBluePrint()
private var metadata: MutableMap<String, String> = hashMapOf()
@@ -59,8 +67,13 @@ class DSLBluePrintBuilder(private val name: String,
dataTypes[dataType.id!!] = dataType
}
- fun dataType(id: String, version: String, derivedFrom: String, description: String,
- block: DataTypeBuilder.() -> Unit) {
+ fun dataType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: DataTypeBuilder.() -> Unit
+ ) {
dataTypes[id] = DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
@@ -68,20 +81,36 @@ class DSLBluePrintBuilder(private val name: String,
artifactTypes[artifactType.id!!] = artifactType
}
- fun artifactType(id: String, version: String, derivedFrom: String, description: String,
- block: ArtifactTypeBuilder.() -> Unit) {
+ fun artifactType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: ArtifactTypeBuilder.() -> Unit
+ ) {
artifactTypes[id] = ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun component(id: String, type: String, version: String, description: String,
- block: DSLComponentBuilder.() -> Unit) {
+ fun component(
+ id: String,
+ type: String,
+ version: String,
+ description: String,
+ block: DSLComponentBuilder.() -> Unit
+ ) {
components[id] = DSLComponentBuilder(id, type, version, description).apply(block).build()
}
- fun registryComponent(id: String, type: String, version: String, interfaceName: String, description: String,
- block: DSLRegistryComponentBuilder.() -> Unit) {
+ fun registryComponent(
+ id: String,
+ type: String,
+ version: String,
+ interfaceName: String,
+ description: String,
+ block: DSLRegistryComponentBuilder.() -> Unit
+ ) {
registryComponents[id] = DSLRegistryComponentBuilder(id, type, version, interfaceName, description)
- .apply(block).build()
+ .apply(block).build()
}
fun workflow(id: String, description: String, block: DSLWorkflowBuilder.() -> Unit) {
@@ -101,8 +130,13 @@ class DSLBluePrintBuilder(private val name: String,
}
}
-class DSLComponentBuilder(private val id: String, private val type: String,
- private val version: String, private val description: String) {
+class DSLComponentBuilder(
+ private val id: String,
+ private val type: String,
+ private val version: String,
+ private val description: String
+) {
+
private val dslComponent = DSLComponent()
var properties: MutableMap<String, PropertyDefinition>? = null
var attributes: MutableMap<String, AttributeDefinition>? = null
@@ -119,12 +153,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
attributes!![id] = attribute
}
- fun attribute(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLAttributeDefinitionBuilder.() -> Unit) {
+ fun attribute(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLAttributeDefinitionBuilder.() -> Unit
+ ) {
if (attributes == null)
attributes = hashMapOf()
val attribute = DSLAttributeDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
attributes!![id] = attribute
}
@@ -135,12 +175,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
properties!![id] = property
}
- fun property(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (properties == null)
properties = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
properties!![id] = property
}
@@ -163,7 +209,6 @@ class DSLComponentBuilder(private val id: String, private val type: String,
artifacts!![id] = ArtifactDefinitionBuilder(id, type, file).apply(block).build()
}
-
fun input(id: String, type: String, required: Boolean, expression: Any, description: String? = "") {
if (inputs == null)
inputs = hashMapOf()
@@ -171,12 +216,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
inputs!![id] = property.build()
}
- fun input(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun input(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (inputs == null)
inputs = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
inputs!![id] = property
}
@@ -187,12 +238,18 @@ class DSLComponentBuilder(private val id: String, private val type: String,
outputs!![id] = property.build()
}
- fun output(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun output(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (outputs == null)
outputs = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
outputs!![id] = property
}
@@ -212,10 +269,14 @@ class DSLComponentBuilder(private val id: String, private val type: String,
}
}
-class DSLRegistryComponentBuilder(private val id: String, private val type: String,
- private val version: String,
- private val interfaceName: String,
- private val description: String) {
+class DSLRegistryComponentBuilder(
+ private val id: String,
+ private val type: String,
+ private val version: String,
+ private val interfaceName: String,
+ private val description: String
+) {
+
private val dslComponent = DSLRegistryComponent()
var properties: MutableMap<String, JsonNode>? = null
@@ -289,8 +350,14 @@ class DSLWorkflowBuilder(private val actionName: String, private val description
inputs!![id] = property.build()
}
- fun input(id: String, type: String, required: Boolean, description: String, defaultValue: Any?,
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun input(
+ id: String,
+ type: String,
+ required: Boolean,
+ description: String,
+ defaultValue: Any?,
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
if (inputs == null)
inputs = hashMapOf()
val property = PropertyDefinitionBuilder(id, type, required, description).apply(block).build()
@@ -306,12 +373,18 @@ class DSLWorkflowBuilder(private val actionName: String, private val description
outputs!![id] = property.build()
}
- fun output(id: String, type: String, required: Boolean, expression: Any, description: String? = "",
- block: DSLPropertyDefinitionBuilder.() -> Unit) {
+ fun output(
+ id: String,
+ type: String,
+ required: Boolean,
+ expression: Any,
+ description: String? = "",
+ block: DSLPropertyDefinitionBuilder.() -> Unit
+ ) {
if (outputs == null)
outputs = hashMapOf()
val property = DSLPropertyDefinitionBuilder(id, type, required, expression.asJsonType(), description)
- .apply(block).build()
+ .apply(block).build()
outputs!![id] = property
}
@@ -337,11 +410,13 @@ class DSLWorkflowBuilder(private val actionName: String, private val description
}
}
-class DSLAttributeDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val expression: JsonNode,
- private val description: String? = "") {
+class DSLAttributeDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val expression: JsonNode,
+ private val description: String? = ""
+) {
private var attributeDefinition = AttributeDefinition()
@@ -368,11 +443,13 @@ class DSLAttributeDefinitionBuilder(private val id: String,
}
}
-class DSLPropertyDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val expression: JsonNode,
- private val description: String? = "") {
+class DSLPropertyDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val expression: JsonNode,
+ private val description: String? = ""
+) {
private var propertyDefinition: PropertyDefinition = PropertyDefinition()
@@ -397,4 +474,4 @@ class DSLPropertyDefinitionBuilder(private val id: String,
propertyDefinition.description = description
return propertyDefinition
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
index 61b52a6f9..8b5c4151a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLData.kt
@@ -18,7 +18,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
/**
* This is simplified version of DSL, which is used for generating the Service template
@@ -26,6 +32,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.*
*/
class DSLBluePrint {
+
var metadata: MutableMap<String, String> = hashMapOf()
var properties: MutableMap<String, JsonNode>? = null
var dataTypes: MutableMap<String, DataType> = hashMapOf()
@@ -59,7 +66,6 @@ class DSLComponent {
var outputs: MutableMap<String, PropertyDefinition>? = null
}
-
class DSLRegistryComponent {
lateinit var id: String
lateinit var type: String
@@ -71,4 +77,4 @@ class DSLRegistryComponent {
var artifacts: MutableMap<String, ArtifactDefinition>? = null
var inputs: MutableMap<String, JsonNode>? = null
var outputs: MutableMap<String, JsonNode>? = null
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
index 259efbf0b..ca4d56338 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
@@ -17,14 +17,28 @@
package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asBluePrintsDataTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ImportDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
import kotlin.reflect.KClass
-class ServiceTemplateBuilder(private val name: String,
- private val version: String,
- private val author: String,
- private val tags: String) {
+class BluePrintServiceDSLBuilder(
+ private val name: String,
+ private val version: String,
+ private val author: String,
+ private val tags: String
+) {
+
private var serviceTemplate = ServiceTemplate()
private var topologyTemplate: TopologyTemplate? = null
private var metadata: MutableMap<String, String> = hashMapOf()
@@ -138,36 +152,61 @@ class ServiceTemplateBuilder(private val name: String,
nodeTypes!![nodeType.id!!] = nodeType
}
- fun dataType(id: String, version: String, derivedFrom: String, description: String,
- block: DataTypeBuilder.() -> Unit) {
+ fun dataType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: DataTypeBuilder.() -> Unit
+ ) {
if (dataTypes == null)
dataTypes = hashMapOf()
dataTypes!![id] = DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun artifactType(id: String, version: String, derivedFrom: String, description: String,
- block: ArtifactTypeBuilder.() -> Unit) {
+ fun artifactType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: ArtifactTypeBuilder.() -> Unit
+ ) {
if (artifactTypes == null)
artifactTypes = hashMapOf()
artifactTypes!![id] = ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun relationshipType(id: String, version: String, derivedFrom: String, description: String,
- block: RelationshipTypeBuilder.() -> Unit) {
+ fun relationshipType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: RelationshipTypeBuilder.() -> Unit
+ ) {
if (relationshipTypes == null)
relationshipTypes = hashMapOf()
relationshipTypes!![id] = RelationshipTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun policyType(id: String, version: String, derivedFrom: String, description: String,
- block: PolicyTypeBuilder.() -> Unit) {
+ fun policyType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: PolicyTypeBuilder.() -> Unit
+ ) {
if (policyTypes == null)
policyTypes = hashMapOf()
policyTypes!![id] = PolicyTypeBuilder(id, version, derivedFrom, description).apply(block).build()
}
- fun nodeType(id: String, version: String, derivedFrom: String, description: String,
- block: NodeTypeBuilder.() -> Unit) {
+ fun nodeType(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String,
+ block: NodeTypeBuilder.() -> Unit
+ ) {
if (nodeTypes == null)
nodeTypes = hashMapOf()
nodeTypes!![id] = NodeTypeBuilder(id, version, derivedFrom, description).apply(block).build()
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt
index a4a5e05ec..d07fc9c71 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceTemplateGenerator.kt
@@ -20,7 +20,19 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.bpClone
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
/**
* Generate Service Template for the simplified DSL.
@@ -88,7 +100,6 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint)
return nodeTemplates
}
-
private fun populateWorkflow(): MutableMap<String, Workflow>? {
var workflows: MutableMap<String, Workflow>? = null
if (dslBluePrint.workflows.isNotEmpty()) {
@@ -197,4 +208,4 @@ class BluePrintServiceTemplateGenerator(private val dslBluePrint: DSLBluePrint)
}
return assignments
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
index 7f49a99c6..df4d2d849 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
@@ -19,7 +19,15 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import kotlin.reflect.KClass
import kotlin.reflect.full.createInstance
import kotlin.reflect.jvm.reflect
@@ -41,9 +49,14 @@ class TopologyTemplateBuilder {
nodeTemplates!![nodeTemplate.id!!] = nodeTemplate
}
- fun nodeTemplateOperation(nodeTemplateName: String, type: String, interfaceName: String, description: String,
- operationBlock: OperationAssignmentBuilder<PropertiesAssignmentBuilder,
- PropertiesAssignmentBuilder>.() -> Unit) {
+ fun nodeTemplateOperation(
+ nodeTemplateName: String,
+ type: String,
+ interfaceName: String,
+ description: String,
+ operationBlock: OperationAssignmentBuilder<PropertiesAssignmentBuilder,
+ PropertiesAssignmentBuilder>.() -> Unit
+ ) {
if (nodeTemplates == null)
nodeTemplates = hashMapOf()
@@ -64,9 +77,13 @@ class TopologyTemplateBuilder {
workflows!![workflow.id!!] = workflow
}
- //TODO("populate inputs, outputs")
- fun workflowNodeTemplate(actionName: String,
- nodeTemplateType: String, description: String, block: NodeTemplateBuilder.() -> Unit) {
+ // TODO("populate inputs, outputs")
+ fun workflowNodeTemplate(
+ actionName: String,
+ nodeTemplateType: String,
+ description: String,
+ block: NodeTemplateBuilder.() -> Unit
+ ) {
if (nodeTemplates == null)
nodeTemplates = hashMapOf()
@@ -88,9 +105,12 @@ class TopologyTemplateBuilder {
}
}
-open class NodeTemplateBuilder(private val id: String,
- private val type: String,
- private val description: String? = "") {
+open class NodeTemplateBuilder(
+ private val id: String,
+ private val type: String,
+ private val description: String? = ""
+) {
+
private var nodeTemplate: NodeTemplate = NodeTemplate()
private var properties: MutableMap<String, JsonNode>? = null
private var interfaces: MutableMap<String, InterfaceAssignment>? = null
@@ -116,8 +136,10 @@ open class NodeTemplateBuilder(private val id: String,
}
open fun <In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder> typedOperation(
- interfaceName: String, description: String = "",
- block: OperationAssignmentBuilder<In, Out>.() -> Unit) {
+ interfaceName: String,
+ description: String = "",
+ block: OperationAssignmentBuilder<In, Out>.() -> Unit
+ ) {
if (interfaces == null)
interfaces = hashMapOf()
@@ -125,12 +147,15 @@ open class NodeTemplateBuilder(private val id: String,
val defaultOperationName = BluePrintConstants.DEFAULT_STEP_OPERATION
interfaceAssignment.operations = hashMapOf()
interfaceAssignment.operations!![defaultOperationName] =
- OperationAssignmentBuilder<In, Out>(defaultOperationName, description).apply(block).build()
+ OperationAssignmentBuilder<In, Out>(defaultOperationName, description).apply(block).build()
interfaces!![interfaceName] = interfaceAssignment
}
- fun operation(interfaceName: String, description: String,
- block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit) {
+ fun operation(
+ interfaceName: String,
+ description: String,
+ block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit
+ ) {
typedOperation<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>(interfaceName, description, block)
}
@@ -235,9 +260,13 @@ open class CapabilityAssignmentBuilder(private val id: String) {
}
}
-open class RequirementAssignmentBuilder(private val id: String, private val capability: String,
- private val node: String,
- private val relationship: String) {
+open class RequirementAssignmentBuilder(
+ private val id: String,
+ private val capability: String,
+ private val node: String,
+ private val relationship: String
+) {
+
private var requirementAssignment: RequirementAssignment = RequirementAssignment()
fun build(): RequirementAssignment {
@@ -254,12 +283,16 @@ class InterfaceAssignmentBuilder(private val id: String) {
private var interfaceAssignment: InterfaceAssignment = InterfaceAssignment()
private var operations: MutableMap<String, OperationAssignment>? = null
- fun operation(id: String, description: String? = "",
- block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit) {
+ fun operation(
+ id: String,
+ description: String? = "",
+ block: OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>.() -> Unit
+ ) {
if (operations == null)
operations = hashMapOf()
operations!![id] = OperationAssignmentBuilder<PropertiesAssignmentBuilder, PropertiesAssignmentBuilder>(
- id, description).apply(block).build()
+ id, description
+ ).apply(block).build()
}
fun build(): InterfaceAssignment {
@@ -270,8 +303,9 @@ class InterfaceAssignmentBuilder(private val id: String) {
}
class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : PropertiesAssignmentBuilder>(
- private val id: String,
- private val description: String? = "") {
+ private val id: String,
+ private val description: String? = ""
+) {
private var operationAssignment: OperationAssignment = OperationAssignment()
@@ -286,8 +320,11 @@ class OperationAssignmentBuilder<In : PropertiesAssignmentBuilder, Out : Propert
}
}
- fun implementation(timeout: Int, operationHost: String? = BluePrintConstants.PROPERTY_SELF,
- block: ImplementationBuilder.() -> Unit) {
+ fun implementation(
+ timeout: Int,
+ operationHost: String? = BluePrintConstants.PROPERTY_SELF,
+ block: ImplementationBuilder.() -> Unit
+ ) {
operationAssignment.implementation = ImplementationBuilder(timeout, operationHost!!).apply(block).build()
}
@@ -368,4 +405,4 @@ open class AttributesAssignmentBuilder {
fun build(): MutableMap<String, JsonNode> {
return attributes
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
index 8d96e7110..e183b8090 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
@@ -18,14 +18,34 @@ package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ConstraintClause
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.EntityType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.EntrySchema
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
+
+open class EntityTypeBuilder(
+ private val id: String,
+ private val version: String,
+ private val derivedFrom: String,
+ private val description: String? = ""
+) {
-
-open class EntityTypeBuilder(private val id: String,
- private val version: String,
- private val derivedFrom: String,
- private val description: String? = "") {
var metadata: MutableMap<String, String>? = null
var properties: MutableMap<String, PropertyDefinition>? = null
var attributes: MutableMap<String, AttributeDefinition>? = null
@@ -43,8 +63,13 @@ open class EntityTypeBuilder(private val id: String,
attributes!![id] = attribute
}
- fun attribute(id: String, type: String, required: Boolean, description: String? = "",
- block: AttributeDefinitionBuilder.() -> Unit) {
+ fun attribute(
+ id: String,
+ type: String,
+ required: Boolean,
+ description: String? = "",
+ block: AttributeDefinitionBuilder.() -> Unit
+ ) {
if (attributes == null)
attributes = hashMapOf()
val attribute = AttributeDefinitionBuilder(id, type, required, description).apply(block).build()
@@ -58,8 +83,13 @@ open class EntityTypeBuilder(private val id: String,
properties!![id] = property
}
- fun property(id: String, type: String, required: Boolean, description: String? = "",
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ id: String,
+ type: String,
+ required: Boolean,
+ description: String? = "",
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
if (properties == null)
properties = hashMapOf()
val property = PropertyDefinitionBuilder(id, type, required, description).apply(block).build()
@@ -77,8 +107,13 @@ open class EntityTypeBuilder(private val id: String,
}
}
-class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class NodeTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var nodeType = NodeType()
private var capabilities: MutableMap<String, CapabilityDefinition>? = null
private var requirements: MutableMap<String, RequirementDefinition>? = null
@@ -97,12 +132,18 @@ class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
requirements!![id] = RequirementDefinitionBuilder(id, capability, node, relationship, description).build()
}
- fun requirement(id: String, capability: String, node: String, relationship: String, description: String,
- block: RequirementDefinitionBuilder.() -> Unit) {
+ fun requirement(
+ id: String,
+ capability: String,
+ node: String,
+ relationship: String,
+ description: String,
+ block: RequirementDefinitionBuilder.() -> Unit
+ ) {
if (requirements == null)
requirements = hashMapOf()
requirements!![id] = RequirementDefinitionBuilder(id, capability, node, relationship, description)
- .apply(block).build()
+ .apply(block).build()
}
fun artifact(id: String, type: String, file: String) {
@@ -125,7 +166,7 @@ class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
val defaultOperationName = "process"
interfaceDefinition.operations = hashMapOf()
interfaceDefinition.operations!![defaultOperationName] =
- OperationDefinitionBuilder(defaultOperationName, description).apply(block).build()
+ OperationDefinitionBuilder(defaultOperationName, description).apply(block).build()
interfaces!![interfaceName] = interfaceDefinition
}
@@ -139,8 +180,13 @@ class NodeTypeBuilder(id: String, version: String, derivedFrom: String,
}
}
-class ArtifactTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class ArtifactTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var artifactType = ArtifactType()
private var fileExt: MutableList<String>? = null
@@ -159,8 +205,13 @@ class ArtifactTypeBuilder(id: String, version: String, derivedFrom: String,
}
}
-class PolicyTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class PolicyTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var policyType = PolicyType()
fun targets(targetsStr: String) {
@@ -178,9 +229,13 @@ class PolicyTypeBuilder(id: String, version: String, derivedFrom: String,
}
}
-class RelationshipTypeBuilder(private val id: String, private val version: String,
- derivedFrom: String, private val description: String?)
- : EntityTypeBuilder(id, version, derivedFrom, description) {
+class RelationshipTypeBuilder(
+ private val id: String,
+ private val version: String,
+ derivedFrom: String,
+ private val description: String?
+) :
+ EntityTypeBuilder(id, version, derivedFrom, description) {
private var relationshipType = RelationshipType()
@@ -202,8 +257,13 @@ class RelationshipTypeBuilder(private val id: String, private val version: Strin
}
}
-class DataTypeBuilder(id: String, version: String, derivedFrom: String,
- description: String?) : EntityTypeBuilder(id, version, derivedFrom, description) {
+class DataTypeBuilder(
+ id: String,
+ version: String,
+ derivedFrom: String,
+ description: String?
+) : EntityTypeBuilder(id, version, derivedFrom, description) {
+
private var dataType = DataType()
fun constrain(block: ConstraintClauseBuilder.() -> Unit) {
@@ -239,8 +299,14 @@ class CapabilityDefinitionBuilder(private val id: String, private val type: Stri
}
}
-class RequirementDefinitionBuilder(private val id: String, private val capability: String, private val node: String,
- private val relationship: String, private val description: String? = "") {
+class RequirementDefinitionBuilder(
+ private val id: String,
+ private val capability: String,
+ private val node: String,
+ private val relationship: String,
+ private val description: String? = ""
+) {
+
private var requirementDefinition = RequirementDefinition()
fun build(): RequirementDefinition {
@@ -271,8 +337,11 @@ class InterfaceDefinitionBuilder(private val id: String) {
}
}
-class OperationDefinitionBuilder(private val id: String,
- private val description: String? = "") {
+class OperationDefinitionBuilder(
+ private val id: String,
+ private val description: String? = ""
+) {
+
private var operationDefinition: OperationDefinition = OperationDefinition()
fun inputs(block: PropertiesDefinitionBuilder.() -> Unit) {
@@ -290,10 +359,12 @@ class OperationDefinitionBuilder(private val id: String,
}
}
-class AttributeDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val description: String? = "") {
+class AttributeDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val description: String? = ""
+) {
private var attributeDefinition: AttributeDefinition = AttributeDefinition()
@@ -342,8 +413,13 @@ class PropertiesDefinitionBuilder {
properties[id] = property
}
- fun property(id: String, type: String?, required: Boolean?, description: String? = "",
- block: PropertyDefinitionBuilder.() -> Unit) {
+ fun property(
+ id: String,
+ type: String?,
+ required: Boolean?,
+ description: String? = "",
+ block: PropertyDefinitionBuilder.() -> Unit
+ ) {
val property = PropertyDefinitionBuilder(id, type, required, description).apply(block).build()
properties[id] = property
}
@@ -353,10 +429,12 @@ class PropertiesDefinitionBuilder {
}
}
-class PropertyDefinitionBuilder(private val id: String,
- private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
- private val required: Boolean? = false,
- private val description: String? = "") {
+class PropertyDefinitionBuilder(
+ private val id: String,
+ private val type: String? = BluePrintConstants.DATA_TYPE_STRING,
+ private val required: Boolean? = false,
+ private val description: String? = ""
+) {
private var propertyDefinition: PropertyDefinition = PropertyDefinition()
@@ -485,7 +563,6 @@ class ConstraintClauseBuilder {
}
}
-
class EntrySchemaBuilder(private val type: String) {
private var entrySchema: EntrySchema = EntrySchema()
@@ -501,4 +578,4 @@ class EntrySchemaBuilder(private val type: String) {
entrySchema.type = type
return entrySchema
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt
index 6d46ac7ad..8a1a9d63c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintWorkflowDSLBuilder.kt
@@ -72,11 +72,13 @@ class WorkflowBuilder(private val id: String, private val description: String) {
workflow.outputs = outputs
return workflow
}
-
}
-class StepBuilder(private val id: String, private val target: String,
- private val description: String) {
+class StepBuilder(
+ private val id: String,
+ private val target: String,
+ private val description: String
+) {
private var step = Step()
private var activities: ArrayList<Activity> = arrayListOf()
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
index 9b4f6b56e..bd45bed06 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintCatalogService.kt
@@ -54,4 +54,4 @@ interface BluePrintCatalogService {
@Throws(BluePrintException::class)
suspend fun deleteFromDatabase(name: String, version: String)
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt
index 8267e5dcc..fcc9bf2d7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintDefinitions.kt
@@ -57,5 +57,4 @@ abstract class AbstractBluePrintDefinitions : BluePrintDefinitions {
override fun otherDefinitions(): MutableMap<String, Any> {
return otherDefinitionMap
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
index d0b5ea743..80c91ca28 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
@@ -18,7 +18,15 @@
package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
@@ -44,7 +52,6 @@ interface BluePrintPropertyDefinitionEnhancer : BluePrintEnhancer<PropertyDefini
interface BluePrintAttributeDefinitionEnhancer : BluePrintEnhancer<AttributeDefinition>
-
interface BluePrintEnhancerService {
@Throws(BluePrintException::class)
@@ -132,11 +139,16 @@ interface BluePrintTypeEnhancerService {
}
@Suppress("UNCHECKED_CAST")
- private fun <T> doEnhancement(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, enhancers: List<BluePrintEnhancer<T>>) {
+ private fun <T> doEnhancement(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ definition: Any,
+ enhancers: List<BluePrintEnhancer<T>>
+ ) {
if (enhancers.isNotEmpty()) {
enhancers.forEach {
it.enhance(bluePrintRuntimeService, name, definition as T)
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt
index 3a6d35f4e..8d04e5489 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintRepoService.kt
@@ -18,7 +18,11 @@
package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import java.io.Serializable
/**
@@ -43,5 +47,4 @@ interface BluePrintRepoService : Serializable {
@Throws(BluePrintException::class)
fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
index 7912e781a..aa61b0c4d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintScriptsService.kt
@@ -23,12 +23,17 @@ interface BluePrintScriptsService {
suspend fun <T> scriptInstance(bluePrintSourceCode: BluePrintSourceCode, scriptClassName: String): T
- suspend fun <T> scriptInstance(blueprintBasePath: String, artifactName: String, artifactVersion: String,
- scriptClassName: String, reCompile: Boolean): T
+ suspend fun <T> scriptInstance(
+ blueprintBasePath: String,
+ artifactName: String,
+ artifactVersion: String,
+ scriptClassName: String,
+ reCompile: Boolean
+ ): T
suspend fun <T> scriptInstance(blueprintBasePath: String, scriptClassName: String, reCompile: Boolean): T
suspend fun <T> scriptInstance(cacheKey: String, scriptClassName: String): T
suspend fun <T> scriptInstance(scriptClassName: String): T
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
index 92be6753c..70c797326 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintWorkflowExecutionService.kt
@@ -20,7 +20,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
interface BluePrintWorkflowExecutionService<Input, Output> {
- suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: Input,
- properties: MutableMap<String, Any> = hashMapOf()): Output
-} \ No newline at end of file
+ suspend fun executeBluePrintWorkflow(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ executionServiceInput: Input,
+ properties: MutableMap<String, Any> = hashMapOf()
+ ): Output
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
index 932b9a09f..b56fac541 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintFunctionNode.kt
@@ -21,7 +21,6 @@ import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import java.util.function.Function
-
interface BlueprintFunctionNode<T, R> : Function<T, R> {
fun getName(): String
@@ -70,4 +69,4 @@ interface BlueprintFunctionNode<T, R> : Function<T, R> {
@Throws(BluePrintProcessorException::class)
suspend fun applyNB(t: T): R
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
index 98abf8987..6f6979772 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintTemplateService.kt
@@ -34,18 +34,21 @@ interface BlueprintTemplateService {
* @return Content result
*
**/
- suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- nodeTemplateName: String,
- artifactName: String,
- jsonData: String = "",
- ignoreJsonNull: Boolean = false,
- additionalContext: MutableMap<String, Any> = mutableMapOf()): String
+ suspend fun generateContent(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactName: String,
+ jsonData: String = "",
+ ignoreJsonNull: Boolean = false,
+ additionalContext: MutableMap<String, Any> = mutableMapOf()
+ ): String
}
/**
* Customise JsonNodeFactory and TextNode, Since it introduces quotes for string data.
*/
open class BluePrintJsonNodeFactory : JsonNodeFactory() {
+
override fun textNode(text: String): TextNode {
return BluePrintTextNode(text)
}
@@ -59,5 +62,4 @@ open class BluePrintTextNode(v: String) : TextNode(v) {
CharTypes.appendQuoted(sb, this._value)
return sb.toString()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt
index 6076f5503..c6339f449 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BlueprintValidator.kt
@@ -18,17 +18,23 @@
package org.onap.ccsdk.cds.controllerblueprints.core.interfaces
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-
interface BluePrintValidator<T> {
fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
-
}
-
interface BluePrintServiceTemplateValidator : BluePrintValidator<ServiceTemplate>
interface BluePrintTopologyTemplateValidator : BluePrintValidator<TopologyTemplate>
@@ -61,7 +67,6 @@ interface BluePrintValidatorService {
fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean
}
-
interface BluePrintTypeValidatorService {
fun <T : BluePrintValidator<*>> bluePrintValidator(referenceName: String, classType: Class<T>): T?
@@ -100,8 +105,11 @@ interface BluePrintTypeValidatorService {
doValidation(bluePrintRuntimeService, name, artifactType, validators)
}
- fun validateArtifactDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ fun validateArtifactDefinition(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
val validators = getArtifactDefinitionsValidators()
doValidation(bluePrintRuntimeService, name, artifactDefinition, validators)
}
@@ -154,12 +162,14 @@ interface BluePrintTypeValidatorService {
}
@Suppress("UNCHECKED_CAST")
- private fun <T> doValidation(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, validators: List<BluePrintValidator<T>>) {
+ private fun <T> doValidation(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ definition: Any,
+ validators: List<BluePrintValidator<T>>
+ ) {
validators.forEach {
it.validate(bluePrintRuntimeService, name, definition as T)
}
}
}
-
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
index baae3372d..b2857c6ce 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompileService.kt
@@ -30,12 +30,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import java.io.File
import java.net.URLClassLoader
-import java.util.*
+import java.util.ArrayList
import kotlin.script.experimental.api.SourceCode
import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
import kotlin.system.measureTimeMillis
-
open class BluePrintCompileService {
val log = logger(BluePrintCompileService::class)
@@ -46,8 +45,11 @@ open class BluePrintCompileService {
}
/** Compile the [bluePrintSourceCode] and get the [kClassName] instance for the constructor [args] */
- suspend fun <T> eval(bluePrintSourceCode: BluePrintSourceCode, kClassName: String,
- args: ArrayList<Any?>?): T {
+ suspend fun <T> eval(
+ bluePrintSourceCode: BluePrintSourceCode,
+ kClassName: String,
+ args: ArrayList<Any?>?
+ ): T {
/** Compile the source code */
compile(bluePrintSourceCode)
/** Get the class loader with compiled jar */
@@ -58,15 +60,17 @@ open class BluePrintCompileService {
/** Compile [bluePrintSourceCode] and put into cache */
suspend fun compile(bluePrintSourceCode: BluePrintSourceCode) {
- //TODO("Include Multiple folders")
+ // TODO("Include Multiple folders")
val sourcePath = bluePrintSourceCode.blueprintKotlinSources.first()
val compiledJarFile = bluePrintSourceCode.targetJarFile
/** Check cache is present for the blueprint scripts */
val hasCompiledCache = BluePrintCompileCache.hasClassLoader(bluePrintSourceCode.cacheKey)
- log.debug("Jar Exists : ${compiledJarFile.exists()}, Regenerate : ${bluePrintSourceCode.regenerate}," +
- " Compiled hash(${bluePrintSourceCode.cacheKey}) : $hasCompiledCache")
+ log.debug(
+ "Jar Exists : ${compiledJarFile.exists()}, Regenerate : ${bluePrintSourceCode.regenerate}," +
+ " Compiled hash(${bluePrintSourceCode.cacheKey}) : $hasCompiledCache"
+ )
if (!compiledJarFile.exists() || bluePrintSourceCode.regenerate || !hasCompiledCache) {
log.info("compiling for cache key(${bluePrintSourceCode.cacheKey})")
@@ -94,8 +98,7 @@ open class BluePrintCompileService {
val exitCode: ExitCode = k2jvmCompiler.exec(messageCollector, Services.EMPTY, arguments)
when (exitCode) {
ExitCode.OK -> {
- checkFileExists(compiledJarFile)
- { "couldn't generate compiled jar(${compiledJarFile.absolutePath})" }
+ checkFileExists(compiledJarFile) { "couldn't generate compiled jar(${compiledJarFile.absolutePath})" }
}
else -> {
throw BluePrintException("$exitCode :${messageCollector.errors().joinToString("\n")}")
@@ -112,13 +115,13 @@ open class BluePrintCompileService {
/** create class [kClassName] instance from [classLoader] */
fun <T> instance(classLoader: URLClassLoader, kClassName: String, args: ArrayList<Any?>? = arrayListOf()): T {
val kClazz = classLoader.loadClass(kClassName)
- ?: throw BluePrintException("failed to load class($kClassName) from current class loader.")
+ ?: throw BluePrintException("failed to load class($kClassName) from current class loader.")
val instance = if (args.isNullOrEmpty()) {
kClazz.newInstance()
} else {
kClazz.constructors
- .single().newInstance(*args.toArray())
+ .single().newInstance(*args.toArray())
} ?: throw BluePrintException("failed to create class($kClassName) instance for constructor argument($args).")
return instance as T
}
@@ -126,6 +129,7 @@ open class BluePrintCompileService {
/** Compile source code information */
open class BluePrintSourceCode : SourceCode {
+
lateinit var blueprintKotlinSources: MutableList<String>
lateinit var moduleName: String
lateinit var targetJarFile: File
@@ -143,9 +147,9 @@ open class BluePrintSourceCode : SourceCode {
/** Class to collect compilation Data */
data class CompiledMessageData(
- val severity: CompilerMessageSeverity,
- val message: String,
- val location: CompilerMessageLocation?
+ val severity: CompilerMessageSeverity,
+ val message: String,
+ val location: CompilerMessageLocation?
)
/** Class to collect compilation results */
@@ -160,9 +164,9 @@ class CompilationMessageCollector : MessageCollector {
}
override fun hasErrors() =
- synchronized(compiledMessages) {
- compiledMessages.any { it.severity.isError }
- }
+ synchronized(compiledMessages) {
+ compiledMessages.any { it.severity.isError }
+ }
override fun clear() {
synchronized(compiledMessages) {
@@ -171,4 +175,4 @@ class CompilationMessageCollector : MessageCollector {
}
fun errors(): List<CompiledMessageData> = compiledMessages.filter { it.severity == CompilerMessageSeverity.ERROR }
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
index f90e27f4d..fbfcfb94f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintCompilerCache.kt
@@ -25,27 +25,26 @@ import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import java.net.URL
import java.net.URLClassLoader
-
object BluePrintCompileCache {
val log = logger(BluePrintCompileCache::class)
private val classLoaderCache: LoadingCache<String, URLClassLoader> = CacheBuilder.newBuilder()
- .maximumSize(50)
- .build(BluePrintClassLoader)
+ .maximumSize(50)
+ .build(BluePrintClassLoader)
fun classLoader(key: String): URLClassLoader {
return classLoaderCache.get(key)
}
fun cleanClassLoader(key: String) {
- if(hasClassLoader(key)){
+ if (hasClassLoader(key)) {
// Make sure to close all classloader loaded resources before we let go of it.
// This fixes a Delete failure message on filesystem that keeps locks on opened jars;
// like Windows and NFS.
classLoaderCache.get(key).close()
classLoaderCache.invalidate(key)
log.info("Cleaned compiled cache($key)")
- }else{
+ } else {
log.warn("No compiled cache($key) present to clean.")
}
}
@@ -67,11 +66,11 @@ object BluePrintClassLoader : CacheLoader<String, URLClassLoader>() {
}
val urls = arrayListOf<URL>()
keyPath.walkTopDown()
- .filter { it.name.endsWith("cba-kts.jar") }
- .forEach {
- log.debug("Adding (${it.absolutePath}) to cache($key)")
- urls.add(it.toURI().toURL())
- }
+ .filter { it.name.endsWith("cba-kts.jar") }
+ .forEach {
+ log.debug("Adding (${it.absolutePath}) to cache($key)")
+ urls.add(it.toURI().toURL())
+ }
return URLClassLoader(urls.toTypedArray(), this.javaClass.classLoader)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
index c067bf3d9..f3eb1a2b9 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImpl.kt
@@ -23,8 +23,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
-import java.util.*
-
+import java.util.ArrayList
open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
@@ -35,8 +34,13 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
return bluePrintCompileService.eval(bluePrintSourceCode, scriptClassName, null)
}
- override suspend fun <T> scriptInstance(blueprintBasePath: String, artifactName: String, artifactVersion: String,
- scriptClassName: String, reCompile: Boolean): T {
+ override suspend fun <T> scriptInstance(
+ blueprintBasePath: String,
+ artifactName: String,
+ artifactVersion: String,
+ scriptClassName: String,
+ reCompile: Boolean
+ ): T {
val sources: MutableList<String> = arrayListOf()
sources.add(normalizedPathName(blueprintBasePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR))
@@ -50,24 +54,29 @@ open class BluePrintScriptsServiceImpl : BluePrintScriptsService {
return scriptInstance(scriptSource, scriptClassName)
}
- override suspend fun <T> scriptInstance(blueprintBasePath: String, scriptClassName: String,
- reCompile: Boolean): T {
+ override suspend fun <T> scriptInstance(
+ blueprintBasePath: String,
+ scriptClassName: String,
+ reCompile: Boolean
+ ): T {
val toscaMetaData = BluePrintMetadataUtils.toscaMetaData(blueprintBasePath)
checkNotNull(toscaMetaData.templateName) { "couldn't find 'Template-Name' key in TOSCA.meta" }
checkNotNull(toscaMetaData.templateVersion) { "couldn't find 'Template-Version' key in TOSCA.meta" }
- return scriptInstance(blueprintBasePath, toscaMetaData.templateName!!, toscaMetaData.templateVersion!!,
- scriptClassName, reCompile)
+ return scriptInstance(
+ blueprintBasePath, toscaMetaData.templateName!!, toscaMetaData.templateVersion!!,
+ scriptClassName, reCompile
+ )
}
override suspend fun <T> scriptInstance(cacheKey: String, scriptClassName: String): T {
val args = ArrayList<Any?>()
return BluePrintCompileCache.classLoader(cacheKey).loadClass(scriptClassName).constructors
- .single().newInstance(*args.toArray()) as T
+ .single().newInstance(*args.toArray()) as T
}
override suspend fun <T> scriptInstance(scriptClassName: String): T {
val args = ArrayList<Any?>()
return Thread.currentThread().contextClassLoader.loadClass(scriptClassName).constructors
- .single().newInstance(*args.toArray()) as T
+ .single().newInstance(*args.toArray()) as T
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt
index 159743487..7d85963dc 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintChainedService.kt
@@ -17,16 +17,25 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
+
/**
*
*
* @author Brinda Santh
*/
class BluePrintChainedService {
- var bpc : BluePrintContext
- constructor(bpc : BluePrintContext){
+ var bpc: BluePrintContext
+
+ constructor(bpc: BluePrintContext) {
this.bpc = bpc
}
@@ -42,30 +51,30 @@ class BluePrintChainedService {
recNodeTypesChained(nodeTypeName).forEach { nodeType ->
- val subAttributes = bpc.nodeTypeByName(nodeType.id!!).attributes
+ val subAttributes = bpc.nodeTypeByName(nodeType.id!!).attributes
if (subAttributes != null) {
attributes.putAll(subAttributes)
}
- val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
+ val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
if (subProperties != null) {
properties.putAll(subProperties)
}
- val subRequirements = bpc.nodeTypeByName(nodeType.id!!).requirements
+ val subRequirements = bpc.nodeTypeByName(nodeType.id!!).requirements
if (subRequirements != null) {
requirements.putAll(subRequirements)
}
- val subCapabilities = bpc.nodeTypeByName(nodeType.id!!).capabilities
+ val subCapabilities = bpc.nodeTypeByName(nodeType.id!!).capabilities
if (subCapabilities != null) {
capabilities.putAll(subCapabilities)
}
- val subInterfaces = bpc.nodeTypeByName(nodeType.id!!).interfaces
+ val subInterfaces = bpc.nodeTypeByName(nodeType.id!!).interfaces
if (subInterfaces != null) {
interfaces.putAll(subInterfaces)
}
- val subArtifacts = bpc.nodeTypeByName(nodeType.id!!).artifacts
+ val subArtifacts = bpc.nodeTypeByName(nodeType.id!!).artifacts
if (subArtifacts != null) {
artifacts.putAll(subArtifacts)
}
@@ -80,11 +89,11 @@ class BluePrintChainedService {
}
fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
- val nodeType = bpc.nodeTypeByName(nodeTypeName)
+ val nodeType = bpc.nodeTypeByName(nodeTypeName)
val properties = hashMapOf<String, PropertyDefinition>()
recNodeTypesChained(nodeTypeName).forEach { nodeType ->
- val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
+ val subProperties = bpc.nodeTypeByName(nodeType.id!!).properties
if (subProperties != null) {
properties.putAll(subProperties)
}
@@ -93,7 +102,7 @@ class BluePrintChainedService {
}
private fun recNodeTypesChained(nodeTypeName: String, nodeTypes: MutableList<NodeType>? = arrayListOf()): MutableList<NodeType> {
- val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName)
+ val nodeType: NodeType = bpc.nodeTypeByName(nodeTypeName)
nodeType.id = nodeTypeName
val derivedFrom: String = nodeType.derivedFrom
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
@@ -104,7 +113,7 @@ class BluePrintChainedService {
}
private fun recDataTypesChained(dataTypeName: String, dataTypes: MutableList<DataType>? = arrayListOf()): MutableList<DataType> {
- val dataType: DataType = bpc.dataTypeByName(dataTypeName)!!
+ val dataType: DataType = bpc.dataTypeByName(dataTypeName)!!
dataType.id = dataTypeName
val derivedFrom: String = dataType.derivedFrom
if (!BluePrintTypes.rootDataTypes().contains(derivedFrom)) {
@@ -113,5 +122,4 @@ class BluePrintChainedService {
dataTypes!!.add(dataType)
return dataTypes
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
index 99c80f8e6..47cd62ea1 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContext.kt
@@ -21,7 +21,24 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import com.fasterxml.jackson.databind.JsonNode
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.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ImportDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
@@ -67,46 +84,46 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
}
fun name(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_NAME)
- ?: throw BluePrintException("could't get template name from meta data")
+ ?: throw BluePrintException("could't get template name from meta data")
fun version(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_VERSION)
- ?: throw BluePrintException("could't get template version from meta data")
+ ?: throw BluePrintException("could't get template version from meta data")
fun author(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)
- ?: throw BluePrintException("could't get template author from meta data")
+ ?: throw BluePrintException("could't get template author from meta data")
// Workflow
fun workflows(): MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows
fun workflowByName(workFlowName: String): Workflow = workflows()?.get(workFlowName)
- ?: throw BluePrintException("could't get workflow($workFlowName)")
+ ?: throw BluePrintException("could't get workflow($workFlowName)")
fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
fun workflowStepByName(workFlowName: String, stepName: String): Step {
return workflowByName(workFlowName).steps?.get(stepName)
- ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
+ ?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
}
fun workflowStepNodeTemplate(workFlowName: String, stepName: String): String {
return workflowStepByName(workFlowName, stepName).target
- ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
+ ?: throw BluePrintException("could't get node template name for workflow($workFlowName)'s step($stepName)")
}
fun workflowFirstStepNodeTemplate(workFlowName: String): String {
val firstStepName = workflowByName(workFlowName).steps?.keys?.first()
- ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
+ ?: throw BluePrintException("could't get first step for workflow($workFlowName)")
return workflowStepNodeTemplate(workFlowName, firstStepName)
}
fun workflowStepFirstCallOperation(workFlowName: String, stepName: String): String {
return workflowStepByName(workFlowName, stepName).activities?.filter { it.callOperation != null }?.single()?.callOperation
- ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
+ ?: throw BluePrintException("couldn't get first callOperation for WorkFlow($workFlowName) ")
}
// DSL
fun dslPropertiesByName(name: String): JsonNode = dslDefinitions()?.get(name)
- ?: throw BluePrintException("couldn't get policy type for the dsl($name)")
+ ?: throw BluePrintException("couldn't get policy type for the dsl($name)")
// Data Type
fun dataTypeByName(name: String): DataType? = dataTypes()?.get(name)
@@ -118,7 +135,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun policyTypes(): MutableMap<String, PolicyType>? = serviceTemplate.policyTypes
fun policyTypeByName(policyName: String) = policyTypes()?.get(policyName)
- ?: throw BluePrintException("could't get policy type for the name($policyName)")
+ ?: throw BluePrintException("could't get policy type for the name($policyName)")
fun policyTypesDerivedFrom(name: String): MutableMap<String, PolicyType>? {
return policyTypes()?.filterValues { policyType -> policyType.derivedFrom == name }?.toMutableMap()
@@ -138,8 +155,8 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTypes(): MutableMap<String, NodeType>? = serviceTemplate.nodeTypes
fun nodeTypeByName(name: String): NodeType =
- nodeTypes()?.get(name)
- ?: throw BluePrintException("could't get node type for the name($name)")
+ nodeTypes()?.get(name)
+ ?: throw BluePrintException("could't get node type for the name($name)")
fun nodeTypeDerivedFrom(name: String): MutableMap<String, NodeType>? {
return nodeTypes()?.filterValues { nodeType -> nodeType.derivedFrom == name }?.toMutableMap()
@@ -147,24 +164,32 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTypeInterface(nodeTypeName: String, interfaceName: String): InterfaceDefinition {
return nodeTypeByName(nodeTypeName).interfaces?.get(interfaceName)
- ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
+ ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName)")
}
fun nodeTypeInterfaceOperation(nodeTypeName: String, interfaceName: String, operationName: String): OperationDefinition {
return nodeTypeInterface(nodeTypeName, interfaceName).operations?.get(operationName)
- ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
+ ?: throw BluePrintException("could't get node type($nodeTypeName)'s interface definition($interfaceName) operation definition($operationName)")
}
fun interfaceNameForNodeType(nodeTypeName: String): String {
return nodeTypeByName(nodeTypeName).interfaces?.keys?.first()
- ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
+ ?: throw BluePrintException("could't get NodeType($nodeTypeName)'s first InterfaceDefinition name")
}
- fun nodeTypeInterfaceOperationInputs(nodeTypeName: String, interfaceName: String, operationName: String): MutableMap<String, PropertyDefinition>? {
+ fun nodeTypeInterfaceOperationInputs(
+ nodeTypeName: String,
+ interfaceName: String,
+ operationName: String
+ ): MutableMap<String, PropertyDefinition>? {
return nodeTypeInterfaceOperation(nodeTypeName, interfaceName, operationName).inputs
}
- fun nodeTypeInterfaceOperationOutputs(nodeTypeName: String, interfaceName: String, operationName: String): MutableMap<String, PropertyDefinition>? {
+ fun nodeTypeInterfaceOperationOutputs(
+ nodeTypeName: String,
+ interfaceName: String,
+ operationName: String
+ ): MutableMap<String, PropertyDefinition>? {
return nodeTypeInterfaceOperation(nodeTypeName, interfaceName, operationName).outputs
}
@@ -172,7 +197,7 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplates(): MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates
fun nodeTemplateByName(name: String): NodeTemplate =
- nodeTemplates()?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
+ nodeTemplates()?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? {
return nodeTemplates()?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()
@@ -193,31 +218,31 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplateArtifact(nodeTemplateName: String, artifactName: String): ArtifactDefinition {
return nodeTemplateArtifacts(nodeTemplateName)?.get(artifactName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s ArtifactDefinition($artifactName)")
}
fun nodeTemplateArtifactForArtifactType(nodeTemplateName: String, artifactType: String): ArtifactDefinition {
return nodeTemplateArtifacts(nodeTemplateName)?.filter { it.value.type == artifactType }?.map { it.value }?.get(0)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s Artifact Type($artifactType)")
}
fun nodeTemplateFirstInterface(nodeTemplateName: String): InterfaceAssignment {
return nodeTemplateByName(nodeTemplateName).interfaces?.values?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment")
}
fun nodeTemplateFirstInterfaceName(nodeTemplateName: String): String {
return nodeTemplateByName(nodeTemplateName).interfaces?.keys?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment name")
}
fun nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName: String): String {
return nodeTemplateFirstInterface(nodeTemplateName).operations?.keys?.first()
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first InterfaceAssignment's first OperationAssignment name")
}
- fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String)
- : Implementation? {
+ fun nodeTemplateOperationImplementation(nodeTemplateName: String, interfaceName: String, operationName: String):
+ Implementation? {
return nodeTemplateInterfaceOperation(nodeTemplateName, interfaceName, operationName).implementation
}
@@ -231,27 +256,27 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTemplateInterface(nodeTemplateName: String, interfaceName: String): InterfaceAssignment {
return nodeTemplateByName(nodeTemplateName).interfaces?.get(interfaceName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName)")
}
fun nodeTemplateInterfaceOperation(nodeTemplateName: String, interfaceName: String, operationName: String): OperationAssignment {
return nodeTemplateInterface(nodeTemplateName, interfaceName).operations?.get(operationName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s InterfaceAssignment($interfaceName) OperationAssignment($operationName)")
}
fun nodeTemplateCapability(nodeTemplateName: String, capabilityName: String): CapabilityAssignment {
return nodeTemplateByName(nodeTemplateName).capabilities?.get(capabilityName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s CapabilityAssignment($capabilityName)")
}
fun nodeTemplateRequirement(nodeTemplateName: String, requirementName: String): RequirementAssignment {
return nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)
- ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
+ ?: throw BluePrintException("could't get NodeTemplate($nodeTemplateName)'s first RequirementAssignment($requirementName)")
}
fun nodeTemplateRequirementNode(nodeTemplateName: String, requirementName: String): NodeTemplate {
val filteredNodeTemplateName: String = nodeTemplateByName(nodeTemplateName).requirements?.get(requirementName)?.node
- ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
+ ?: throw BluePrintException("could't NodeTemplate for NodeTemplate's($nodeTemplateName) requirement's ($requirementName) ")
return nodeTemplateByName(filteredNodeTemplateName)
}
@@ -268,5 +293,4 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun nodeTypeChainedProperties(nodeTypeName: String): MutableMap<String, PropertyDefinition>? {
return BluePrintChainedService(this).nodeTypeChainedProperties(nodeTypeName)
}
-
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt
index 776e0411e..df3bde1b4 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintDependencyService.kt
@@ -38,16 +38,16 @@ object BluePrintDependencyService {
inline fun <reified T> instance(name: String): T {
return applicationContext.getBean(name) as? T
- ?: throw BluePrintProcessorException("failed to get instance($name)")
+ ?: throw BluePrintProcessorException("failed to get instance($name)")
}
inline fun <reified T> instance(type: Class<T>): T {
return applicationContext.getBean(type)
- ?: throw BluePrintProcessorException("failed to get instance($type)")
+ ?: throw BluePrintProcessorException("failed to get instance($type)")
}
inline fun <reified T> instance(type: KClass<*>): T {
return applicationContext.getBean(type.java) as? T
- ?: throw BluePrintProcessorException("failed to get instance($type)")
+ ?: throw BluePrintProcessorException("failed to get instance($type)")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
index fbf911664..6a3c64650 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionService.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ArrayNode
import com.fasterxml.jackson.databind.node.ObjectNode
@@ -25,7 +24,14 @@ import com.fasterxml.jackson.databind.node.TextNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DSLExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ExpressionData
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationOutputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyExpression
+import org.slf4j.LoggerFactory
/**
*
@@ -33,16 +39,16 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.*
* @author Brinda Santh
*/
object BluePrintExpressionService {
- val log= LoggerFactory.getLogger(this::class.toString())
+
+ val log = LoggerFactory.getLogger(this::class.toString())
@JvmStatic
fun checkContainsExpression(propertyAssignmentNode: JsonNode): Boolean {
val json = propertyAssignmentNode.toString()
// FIXME("Check if any Optimisation needed")
- return (json.contains(BluePrintConstants.EXPRESSION_GET_INPUT)
- || json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE)
- || json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY))
-
+ return (json.contains(BluePrintConstants.EXPRESSION_GET_INPUT) ||
+ json.contains(BluePrintConstants.EXPRESSION_GET_ATTRIBUTE) ||
+ json.contains(BluePrintConstants.EXPRESSION_GET_PROPERTY))
}
@JvmStatic
@@ -74,8 +80,9 @@ object BluePrintExpressionService {
}
}
}
- } else if (propertyAssignmentNode is TextNode
- && propertyAssignmentNode.textValue().startsWith(BluePrintConstants.EXPRESSION_DSL_REFERENCE)) {
+ } else if (propertyAssignmentNode is TextNode &&
+ propertyAssignmentNode.textValue().startsWith(BluePrintConstants.EXPRESSION_DSL_REFERENCE)
+ ) {
expressionData.isExpression = true
expressionData.command = BluePrintConstants.EXPRESSION_DSL_REFERENCE
expressionData.dslExpression = populateDSLExpression(propertyAssignmentNode)
@@ -85,8 +92,10 @@ object BluePrintExpressionService {
@JvmStatic
fun populateDSLExpression(jsonNode: TextNode): DSLExpression {
- return DSLExpression(propertyName = jsonNode.textValue()
- .removePrefix(BluePrintConstants.EXPRESSION_DSL_REFERENCE))
+ return DSLExpression(
+ propertyName = jsonNode.textValue()
+ .removePrefix(BluePrintConstants.EXPRESSION_DSL_REFERENCE)
+ )
}
@JvmStatic
@@ -98,9 +107,13 @@ object BluePrintExpressionService {
fun populatePropertyExpression(jsonNode: JsonNode): PropertyExpression {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 2) {
- throw BluePrintException(String.format("missing property expression, " +
- "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
- "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing property expression, " +
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <property_name>, " +
+ "<nested_property_name_or_index_1>, ..., <nested_property_name_or_index_n> ] , but present {}", jsonNode
+ )
+ )
}
var reqOrCapEntityName: String? = null
var propertyName = ""
@@ -121,10 +134,11 @@ object BluePrintExpressionService {
}
}
- return PropertyExpression(modelableEntityName = arrayNode[0].asText(),
- reqOrCapEntityName = reqOrCapEntityName,
- propertyName = propertyName,
- subPropertyName = subProperty
+ return PropertyExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ reqOrCapEntityName = reqOrCapEntityName,
+ propertyName = propertyName,
+ subPropertyName = subProperty
)
}
@@ -132,9 +146,13 @@ object BluePrintExpressionService {
fun populateAttributeExpression(jsonNode: JsonNode): AttributeExpression {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 2) {
- throw BluePrintException(String.format("missing attribute expression, " +
- "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
- " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing attribute expression, " +
+ "it should be [ <modelable_entity_name>, <optional_req_or_cap_name>, <attribute_name>," +
+ " <nested_attribute_name_or_index_1>, ..., <nested_attribute_name_or_index_n> ] , but present {}", jsonNode
+ )
+ )
}
var reqOrCapEntityName: String? = null
@@ -155,10 +173,11 @@ object BluePrintExpressionService {
subAttributeName = propertyPaths.joinToString("/")
}
}
- return AttributeExpression(modelableEntityName = arrayNode[0].asText(),
- reqOrCapEntityName = reqOrCapEntityName,
- attributeName = attributeName,
- subAttributeName = subAttributeName
+ return AttributeExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ reqOrCapEntityName = reqOrCapEntityName,
+ attributeName = attributeName,
+ subAttributeName = subAttributeName
)
}
@@ -167,19 +186,25 @@ object BluePrintExpressionService {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 4) {
- throw BluePrintException(String.format("missing operation output expression, " +
- "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing operation output expression, " +
+ "it should be (<modelable_entity_name>, <interface_name>, <operation_name>, <output_variable_name>) , but present {}",
+ jsonNode
+ )
+ )
}
var subPropertyName: String? = null
if (arrayNode.size() == 5)
subPropertyName = arrayNode[4].asText()
- return OperationOutputExpression(modelableEntityName = arrayNode[0].asText(),
- interfaceName = arrayNode[1].asText(),
- operationName = arrayNode[2].asText(),
- propertyName = arrayNode[3].asText(),
- subPropertyName = subPropertyName
+ return OperationOutputExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ interfaceName = arrayNode[1].asText(),
+ operationName = arrayNode[2].asText(),
+ propertyName = arrayNode[3].asText(),
+ subPropertyName = subPropertyName
)
}
@@ -188,13 +213,18 @@ object BluePrintExpressionService {
val arrayNode: ArrayNode = jsonNode.first() as ArrayNode
check(arrayNode.size() >= 2) {
- throw BluePrintException(String.format("missing artifact expression, " +
- "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", jsonNode))
+ throw BluePrintException(
+ String.format(
+ "missing artifact expression, " +
+ "it should be [ <modelable_entity_name>, <artifact_name>, <location>, <remove> ] , but present {}", jsonNode
+ )
+ )
}
- return ArtifactExpression(modelableEntityName = arrayNode[0].asText(),
- artifactName = arrayNode[1].asText(),
- location = arrayNode[2]?.asText() ?: "LOCAL_FILE",
- remove = arrayNode[3]?.asBoolean() ?: false
+ return ArtifactExpression(
+ modelableEntityName = arrayNode[0].asText(),
+ artifactName = arrayNode[1].asText(),
+ location = arrayNode[2]?.asText() ?: "LOCAL_FILE",
+ remove = arrayNode[3]?.asBoolean() ?: false
)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
index 5f6505309..24b7e261c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintImportService.kt
@@ -37,7 +37,6 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
private var importServiceTemplateMap: MutableMap<String, ServiceTemplate> = hashMapOf()
-
suspend fun getImportResolvedServiceTemplate(): ServiceTemplate {
// Populate Imported Service Templates
traverseSchema(PARENT_SERVICE_TEMPLATE, parentServiceTemplate)
@@ -70,13 +69,13 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
val decodedSystemId: String = URLDecoder.decode(file, Charset.defaultCharset().toString())
log.trace("file ({}), decodedSystemId ({}) ", file, decodedSystemId)
try {
- if (decodedSystemId.startsWith("http", true)
- || decodedSystemId.startsWith("https", true)) {
+ if (decodedSystemId.startsWith("http", true) ||
+ decodedSystemId.startsWith("https", true)
+ ) {
val givenUrl: String = URL(decodedSystemId).toString()
val systemUrl: String = File(".").toURI().toURL().toString()
log.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl)
if (givenUrl.startsWith(systemUrl)) {
-
}
} else {
if (!decodedSystemId.startsWith("/")) {
@@ -92,6 +91,4 @@ class BluePrintImportService(private val parentServiceTemplate: ServiceTemplate,
}
return serviceTemplate
}
-
-
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
index 78997fe52..fdc348bf7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
@@ -39,41 +39,56 @@ object BluePrintJinjaTemplateService {
/**
* To enable inheritance within CBA, we need Jinja runtime to know where to load the templates.
*/
- class BlueprintRelatedTemplateLocator(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val artifactName: String,
- private val artifactVersion: String) : ResourceLocator {
+ class BlueprintRelatedTemplateLocator(
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val artifactName: String,
+ private val artifactVersion: String
+ ) : ResourceLocator {
@Throws(IOException::class)
override fun getString(fullName: String, encoding: Charset, interpreter: JinjavaInterpreter): String {
try {
val deployFile =
- normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath,
+ normalizedPathName(
+ bluePrintLoadConfiguration.blueprintDeployPath,
artifactName,
artifactVersion,
- fullName)
+ fullName
+ )
return String(readAllBytes(Paths.get(deployFile)))
} catch (var5: IllegalArgumentException) {
throw ResourceNotFoundException("Couldn't find resource: $fullName")
}
-
}
}
- fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
- additionalContext: MutableMap<String, Any>,
- bluePrintLoadConfiguration: BluePrintLoadConfiguration, artifactName: String,
- artifactVersion: String): String {
-
- return generateContent(template,
+ fun generateContent(
+ template: String,
+ json: String,
+ ignoreJsonNull: Boolean,
+ additionalContext: MutableMap<String, Any>,
+ bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ artifactName: String,
+ artifactVersion: String
+ ): String {
+
+ return generateContent(
+ template,
json,
ignoreJsonNull,
additionalContext,
- BlueprintRelatedTemplateLocator(bluePrintLoadConfiguration, artifactName, artifactVersion))
+ BlueprintRelatedTemplateLocator(bluePrintLoadConfiguration, artifactName, artifactVersion)
+ )
}
- fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
- additionalContext: MutableMap<String, Any>, resourceLocator: ResourceLocator? = null): String {
+ fun generateContent(
+ template: String,
+ json: String,
+ ignoreJsonNull: Boolean,
+ additionalContext: MutableMap<String, Any>,
+ resourceLocator: ResourceLocator? = null
+ ): String {
val jinJava = Jinjava(JinjavaConfig())
if (resourceLocator != null) {
jinJava.resourceLocator = resourceLocator
@@ -98,4 +113,3 @@ object BluePrintJinjaTemplateService {
return jinJava.render(template, additionalContext)
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt
index 4b02492da..1f71495a3 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileService.kt
@@ -16,27 +16,33 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
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.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoService {
- private val log= LoggerFactory.getLogger(BluePrintRepoFileService::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintRepoFileService::class.toString())
private val dataTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
private val nodeTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE)
private val artifactTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE)
- private val capabilityTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
- private val relationshipTypePath = modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
+ private val capabilityTypePath =
+ modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE)
+ private val relationshipTypePath =
+ modelTypePath.plus(BluePrintConstants.PATH_DIVIDER).plus(BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE)
private val extension = ".json"
override fun getDataType(dataTypeName: String): DataType {
val fileName = dataTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(dataTypeName).plus(extension)
+ .plus(dataTypeName).plus(extension)
return getModelType(fileName, DataType::class.java)
}
@@ -47,24 +53,24 @@ open class BluePrintRepoFileService(modelTypePath: String) : BluePrintRepoServic
override fun getArtifactType(artifactTypeName: String): ArtifactType {
val fileName = artifactTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(artifactTypeName).plus(extension)
+ .plus(artifactTypeName).plus(extension)
return getModelType(fileName, ArtifactType::class.java)
}
override fun getRelationshipType(relationshipTypeName: String): RelationshipType {
val fileName = relationshipTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(relationshipTypeName).plus(extension)
+ .plus(relationshipTypeName).plus(extension)
return getModelType(fileName, RelationshipType::class.java)
}
override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition {
val fileName = capabilityTypePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(capabilityDefinitionName).plus(extension)
+ .plus(capabilityDefinitionName).plus(extension)
return getModelType(fileName, CapabilityDefinition::class.java)
}
private fun <T> getModelType(fileName: String, valueType: Class<T>): T {
return JacksonUtils.readValueFromFile(fileName, valueType)
- ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}")
+ ?: throw BluePrintException("couldn't get file($fileName) for type(${valueType.name}")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
index f7b512153..a6d2de476 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -17,15 +17,20 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
+import org.onap.ccsdk.cds.controllerblueprints.core.rootFieldsToMap
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
import java.io.File
@@ -68,11 +73,11 @@ interface BluePrintRuntimeService<T> {
propertyAssignments: MutableMap<String, JsonNode>
): MutableMap<String, JsonNode>
- fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
- : MutableMap<String, JsonNode>
+ fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>):
+ MutableMap<String, JsonNode>
- fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode>
+ fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>):
+ MutableMap<String, JsonNode>
fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
@@ -80,12 +85,14 @@ interface BluePrintRuntimeService<T> {
JsonNode>
fun resolveNodeTemplateInterfaceOperationInputs(
- nodeTemplateName: String, interfaceName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
operationName: String
): MutableMap<String, JsonNode>
fun resolveNodeTemplateInterfaceOperationOutputs(
- nodeTemplateName: String, interfaceName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
operationName: String
): MutableMap<String, JsonNode>
@@ -98,7 +105,9 @@ interface BluePrintRuntimeService<T> {
fun setInputValue(propertyName: String, value: JsonNode)
fun setWorkflowInputValue(
- workflowName: String, propertyName: String, propertyDefinition: PropertyDefinition,
+ workflowName: String,
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
value: JsonNode
)
@@ -107,25 +116,36 @@ interface BluePrintRuntimeService<T> {
fun setNodeTemplateAttributeValue(nodeTemplateName: String, attributeName: String, value: JsonNode)
fun setNodeTemplateOperationPropertyValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
+ value: JsonNode
)
fun setNodeTemplateOperationInputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
+ value: JsonNode
)
fun setNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String, value: JsonNode
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
+ value: JsonNode
)
fun getInputValue(propertyName: String): JsonNode
fun getNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String
): JsonNode
fun getNodeTemplatePropertyValue(nodeTemplateName: String, propertyName: String): JsonNode?
@@ -163,7 +183,6 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val absoluteEnvFilePath = bluePrintContext.rootPath.plus(File.separator)
.plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
loadEnvironments(BluePrintConstants.PROPERTY_BPP, absoluteEnvFilePath)
-
}
override fun id(): String {
@@ -240,8 +259,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
nodeTemplateName: String,
propertyDefinitions: MutableMap<String, PropertyDefinition>,
propertyAssignments: MutableMap<String, JsonNode>
- )
- : MutableMap<String, JsonNode> {
+ ):
+ MutableMap<String, JsonNode> {
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
@@ -254,7 +273,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
// Resolve the Expressing
val propertyAssignmentExpression = PropertyAssignmentService(this)
resolvedValue = propertyAssignmentExpression.resolveAssignmentExpression(
- nodeTemplateName, nodeTypePropertyName, propertyAssignment)
+ nodeTemplateName, nodeTypePropertyName, propertyAssignment
+ )
}
// Set default value if null
@@ -268,8 +288,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return propertyAssignmentValue
}
- override fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
- : MutableMap<String, JsonNode> {
+ override fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>):
+ MutableMap<String, JsonNode> {
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
propertyDefinitions.forEach { propertyName, propertyDefinition ->
@@ -283,8 +303,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return propertyAssignmentValue
}
- override fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
- : MutableMap<String, JsonNode> {
+ override fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>):
+ MutableMap<String, JsonNode> {
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
propertyAssignments.forEach { (propertyName, propertyExpression) ->
@@ -333,8 +353,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
interfaceName: String,
operationName: String
): MutableMap<String, JsonNode> {
- log.info("resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName), " +
- "interface name($interfaceName), operationName($operationName)")
+ log.info(
+ "resolveNodeTemplateInterfaceOperationInputs for node template ($nodeTemplateName), " +
+ "interface name($interfaceName), operationName($operationName)"
+ )
val propertyAssignments: MutableMap<String, JsonNode> =
bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
@@ -352,10 +374,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Resolve the Property Input Assignment Values.
*/
return resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationInputs, propertyAssignments)
-
}
-
override fun resolveNodeTemplateInterfaceOperationOutputs(
nodeTemplateName: String,
interfaceName: String,
@@ -379,7 +399,7 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
* Resolve the Property Output Assignment Values.
*/
val propertyAssignmentValue =
- resolveNodeTemplatePropertyAssignments(nodeTemplateName,nodeTypeInterfaceOperationOutputs, propertyAssignments)
+ resolveNodeTemplatePropertyAssignments(nodeTemplateName, nodeTypeInterfaceOperationOutputs, propertyAssignments)
// Store operation output values into context
propertyAssignmentValue.forEach { (key, value) ->
@@ -403,7 +423,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return nodeTemplate.artifacts?.get(artifactName)
?: throw BluePrintProcessorException(
- "failed to get artifact definition($artifactName) from the node template")
+ "failed to get artifact definition($artifactName) from the node template"
+ )
}
/**
@@ -412,8 +433,9 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
*/
override fun resolveDSLExpression(dslPropertyName: String): JsonNode {
val propertyAssignments = bluePrintContext.dslPropertiesByName(dslPropertyName)
- return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments)
- && propertyAssignments is ObjectNode) {
+ return if (BluePrintExpressionService.checkContainsExpression(propertyAssignments) &&
+ propertyAssignments is ObjectNode
+ ) {
val rootKeyMap = propertyAssignments.rootFieldsToMap()
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
@@ -429,14 +451,16 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setInputValue(propertyName: String, value: JsonNode) {
- val path = """${BluePrintConstants.PATH_INPUTS}${BluePrintConstants.PATH_DIVIDER}${propertyName}"""
+ val path = """${BluePrintConstants.PATH_INPUTS}${BluePrintConstants.PATH_DIVIDER}$propertyName"""
log.trace("setting input path ({}), values ({})", path, value)
put(path, value)
}
override fun setWorkflowInputValue(
- workflowName: String, propertyName: String,
- propertyDefinition: PropertyDefinition, value: JsonNode
+ workflowName: String,
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_WORKFLOWS)
.append(BluePrintConstants.PATH_DIVIDER).append(workflowName)
@@ -463,8 +487,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setNodeTemplateOperationPropertyValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
@@ -480,8 +506,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setNodeTemplateOperationInputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
@@ -497,8 +525,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun setNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String,
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String,
value: JsonNode
) {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
@@ -513,7 +543,6 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
put(path, value)
}
-
override fun getInputValue(propertyName: String): JsonNode {
val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
.append(BluePrintConstants.PATH_DIVIDER).append(propertyName).toString()
@@ -521,8 +550,10 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun getNodeTemplateOperationOutputValue(
- nodeTemplateName: String, interfaceName: String,
- operationName: String, propertyName: String
+ nodeTemplateName: String,
+ interfaceName: String,
+ operationName: String,
+ propertyName: String
): JsonNode {
val path: String = StringBuilder(BluePrintConstants.PATH_NODE_TEMPLATES)
.append(BluePrintConstants.PATH_DIVIDER).append(nodeTemplateName)
@@ -563,31 +594,31 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
override fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {
- log.info("For workflow ($workflowName) driving input data from (${jsonNode})")
+ log.info("For workflow ($workflowName) driving input data from ($jsonNode)")
val dynamicInputPropertiesName = "$workflowName-properties"
- bluePrintContext.workflowByName(workflowName).inputs?.
- forEach { propertyName, property ->
- if (propertyName != dynamicInputPropertiesName) {
- val valueNode: JsonNode =
- jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
- ?: property.defaultValue
- ?: NullNode.getInstance()
- log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
- setInputValue(propertyName, valueNode)
+ bluePrintContext.workflowByName(workflowName).inputs
+ ?.forEach { propertyName, property ->
+ if (propertyName != dynamicInputPropertiesName) {
+ val valueNode: JsonNode =
+ jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
+ ?: NullNode.getInstance()
+ log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
+ setInputValue(propertyName, valueNode)
+ }
}
- }
// Load Dynamic data Types
jsonNode.get(dynamicInputPropertiesName)?.let {
- bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties?.
- forEach { propertyName, property ->
- val valueNode: JsonNode =
- it.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
- ?: property.defaultValue
- ?: NullNode.getInstance()
- log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
- setInputValue(propertyName, valueNode)
- }
+ bluePrintContext.dataTypeByName("dt-$dynamicInputPropertiesName")?.properties
+ ?.forEach { propertyName, property ->
+ val valueNode: JsonNode =
+ it.at(BluePrintConstants.PATH_DIVIDER + propertyName).returnNullIfMissing()
+ ?: property.defaultValue
+ ?: NullNode.getInstance()
+ log.trace("Setting input data - attribute:($propertyName) value:($valueNode)")
+ setInputValue(propertyName, valueNode)
+ }
}
}
@@ -615,6 +646,4 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
return jsonNode
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
index 2c928e288..db733bda1 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintTemplateService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateService.kt
@@ -25,9 +25,14 @@ import org.springframework.stereotype.Service
class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration) :
BlueprintTemplateService {
- override suspend fun generateContent(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- nodeTemplateName: String, artifactName: String, jsonData: String,
- ignoreJsonNull: Boolean, additionalContext: MutableMap<String, Any>): String {
+ override suspend fun generateContent(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ artifactName: String,
+ jsonData: String,
+ ignoreJsonNull: Boolean,
+ additionalContext: MutableMap<String, Any>
+ ): String {
val artifactDefinition =
bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
@@ -36,21 +41,25 @@ class BluePrintTemplateService(private val bluePrintLoadConfiguration: BluePrint
return when (templateType) {
BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME -> {
- BluePrintJinjaTemplateService.generateContent(template,
+ BluePrintJinjaTemplateService.generateContent(
+ template,
jsonData,
ignoreJsonNull,
additionalContext,
bluePrintLoadConfiguration,
bluePrintRuntimeService.bluePrintContext().name(),
- bluePrintRuntimeService.bluePrintContext().version())
+ bluePrintRuntimeService.bluePrintContext().version()
+ )
}
BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME -> {
BluePrintVelocityTemplateService.generateContent(template, jsonData, ignoreJsonNull, additionalContext)
}
else -> {
- throw BluePrintProcessorException("Unknown Artifact type, expecting ${BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME}" +
- "or ${BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME}")
+ throw BluePrintProcessorException(
+ "Unknown Artifact type, expecting ${BluePrintConstants.ARTIFACT_JINJA_TYPE_NAME}" +
+ "or ${BluePrintConstants.ARTIFACT_VELOCITY_TYPE_NAME}"
+ )
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
index d3dd30224..f492c2bc6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintValidatorService.kt
@@ -17,13 +17,33 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.google.common.base.Preconditions
import org.apache.commons.lang3.StringUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
+import org.onap.ccsdk.cds.controllerblueprints.core.format
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
import java.io.Serializable
/**
@@ -43,7 +63,7 @@ interface BluePrintValidatorService : Serializable {
@Deprecated("Decomposed implementation moved to blueprint-validation module")
open class BluePrintValidatorDefaultService : BluePrintValidatorService {
- val log= LoggerFactory.getLogger(BluePrintValidatorDefaultService::class.toString())
+ val log = LoggerFactory.getLogger(BluePrintValidatorDefaultService::class.toString())
lateinit var bluePrintContext: BluePrintContext
lateinit var serviceTemplate: ServiceTemplate
@@ -72,9 +92,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
} catch (e: Exception) {
log.error("validation failed in the path : {}", paths.joinToString(separator), e)
log.error("validation trace message :{} ", message)
- throw BluePrintException(e,
- format("failed to validate blueprint on path ({}) with message {}"
- , paths.joinToString(separator), e.message))
+ throw BluePrintException(
+ e,
+ format("failed to validate blueprint on path ({}) with message {}", paths.joinToString(separator), e.message)
+ )
}
}
@@ -133,13 +154,17 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add(nodeTypeName)
message.appendln("--> Node Type :" + paths.joinToString(separator))
val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
+ // Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException(format("Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
- derivedFrom, nodeTypeName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
+ derivedFrom, nodeTypeName
+ )
+ )
}
nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
@@ -190,7 +215,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
val type: String = nodeTemplate.type
val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
+ ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
@@ -207,12 +232,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add(artifactDefinitionName)
message.appendln("Validating artifact " + paths.joinToString(separator))
val type: String = artifactDefinition.type
- ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
+ ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
// Check Artifact Type
checkValidArtifactType(artifactDefinitionName, type)
val file: String = artifactDefinition.file
- ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
+ ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
paths.removeAt(paths.lastIndex)
}
@@ -258,7 +283,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
checkPrimitiveOrComplex(entrySchemaType, propertyName)
}
else -> checkPropertyDataType(dataType, propertyName)
@@ -270,20 +295,24 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validatePropertyAssignments(nodeTypeProperties: MutableMap<String, PropertyDefinition>,
- properties: MutableMap<String, JsonNode>) {
+ open fun validatePropertyAssignments(
+ nodeTypeProperties: MutableMap<String, PropertyDefinition>,
+ properties: MutableMap<String, JsonNode>
+ ) {
properties.forEach { propertyName, propertyAssignment ->
val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
- ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName))
+ ?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName))
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
}
}
@Throws(BluePrintException::class)
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
+ open fun validatePropertyAssignment(
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ propertyAssignment: JsonNode
+ ) {
// Check and Validate if Expression Node
val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
if (!expressionData.isExpression) {
@@ -299,8 +328,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add(capabilityName)
val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) capability definition ({}) " +
- "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) capability definition ({}) " +
+ "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type
+ )
+ )
validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
@@ -310,11 +343,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+ open fun validateCapabilityAssignment(
+ nodeTemplateName: String,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition,
+ capabilityAssignment: CapabilityAssignment
+ ) {
capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) }
-
}
@Throws(BluePrintException::class)
@@ -324,38 +360,55 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
requirements?.forEach { requirementName, requirementAssignment ->
paths.add(requirementName)
val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) requirement definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) requirement definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type
+ )
+ )
// Validate Requirement Assignment
validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
}
@Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
+ open fun validateRequirementAssignment(
+ nodeTemplateName: String,
+ requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition,
+ requirementAssignment: RequirementAssignment
+ ) {
log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName)
val requirementNodeTemplateName = requirementAssignment.node!!
val capabilityName = requirementAssignment.capability
val relationship = requirementAssignment.relationship!!
check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException(format("Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
- relationship, nodeTemplateName, requirementAssignmentName))
+ throw BluePrintException(
+ format(
+ "Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
+ relationship, nodeTemplateName, requirementAssignmentName
+ )
+ )
}
val relationShipNodeTemplate = serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
- requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
+ requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName
+ )
+ )
relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
- requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName))
-
-
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
+ requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName
+ )
+ )
}
@Throws(BluePrintException::class)
@@ -366,70 +419,93 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) interface definition ({}) from" +
- " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) interface definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type
+ )
+ )
+
+ validateInterfaceAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ validateInterfaceOperationsAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
}
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceOperationsAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) ",
- nodeTemplateName, operationAssignmentName))
-
- log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
- interfaceAssignmentName, operationAssignmentName)
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) operation definition ({}) ",
+ nodeTemplateName, operationAssignmentName
+ )
+ )
+
+ log.info(
+ "Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
+ interfaceAssignmentName, operationAssignmentName
+ )
val inputs = operationAssignments.inputs
val outputs = operationAssignments.outputs
inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
- "property definition({})", nodeTemplateName, operationAssignmentName, propertyName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) operation definition ({}) " +
+ "property definition({})", nodeTemplateName, operationAssignmentName, propertyName
+ )
+ )
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
outputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
- "output property definition({})", nodeTemplateName, operationAssignmentName,
- propertyName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get NodeTemplate({}) operation definition ({}) " +
+ "output property definition({})", nodeTemplateName, operationAssignmentName,
+ propertyName
+ )
+ )
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
-
}
}
-
}
@Throws(BluePrintException::class)
@@ -447,12 +523,20 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
+ open fun validateCapabilityDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition
+ ) {
val capabilityType = capabilityDefinition.type
check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
- throw BluePrintException(format("Failed to get CapabilityType({}) for NodeType({})",
- capabilityType, nodeTypeName))
+ throw BluePrintException(
+ format(
+ "Failed to get CapabilityType({}) for NodeType({})",
+ capabilityType, nodeTypeName
+ )
+ )
}
}
@@ -471,8 +555,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
+ open fun validateRequirementDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition
+ ) {
log.info("Validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
val requirementNodeTypeName = requirementDefinition.node!!
@@ -480,21 +568,31 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
val relationship = requirementDefinition.relationship!!
check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
- throw BluePrintException(format("Failed to get relationship({}) for NodeType({})'s requirement({}) ",
- relationship, nodeTypeName, requirementDefinitionName))
+ throw BluePrintException(
+ format(
+ "Failed to get relationship({}) for NodeType({})'s requirement({}) ",
+ relationship, nodeTypeName, requirementDefinitionName
+ )
+ )
}
val relationShipNodeType = serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s for requirement({}) ",
- requirementNodeTypeName, requirementDefinitionName))
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeType({})'s for requirement({}) ",
+ requirementNodeTypeName, requirementDefinitionName
+ )
+ )
relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
- requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName))
-
+ ?: throw BluePrintException(
+ format(
+ "Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
+ requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName
+ )
+ )
}
-
@Throws(BluePrintException::class)
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
paths.add("interfaces")
@@ -530,7 +628,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
+ ?: throw BluePrintException("failed to artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -562,11 +660,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -578,18 +675,21 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
check(isValid) {
- throw BluePrintException(format("property({}) defined of type({}) is not comptable with the value ({})",
- propertyName, propertyType, propertyAssignment))
+ throw BluePrintException(
+ format(
+ "property({}) defined of type({}) is not comptable with the value ({})",
+ propertyName, propertyType, propertyAssignment
+ )
+ )
}
}
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
}
private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
@@ -603,5 +703,4 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
private fun checkDataType(key: String): Boolean {
return serviceTemplate.dataTypes?.containsKey(key) ?: false
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
index 2d3c35de7..43e27d047 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
@@ -34,8 +34,12 @@ object BluePrintVelocityTemplateService {
/**
* Generate Content from Velocity Template and JSON Content with injected API
*/
- fun generateContent(template: String, json: String, ignoreJsonNull: Boolean = false,
- additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
+ fun generateContent(
+ template: String,
+ json: String,
+ ignoreJsonNull: Boolean = false,
+ additionalContext: MutableMap<String, Any> = mutableMapOf()
+ ): String {
// Customized Object Mapper to remove String double quotes
val mapper = ObjectMapper()
@@ -44,7 +48,7 @@ object BluePrintVelocityTemplateService {
val jsonNode: JsonNode? = if (json.isNotEmpty()) {
mapper.readValue(json, JsonNode::class.java)
- ?: throw BluePrintProcessorException("couldn't get json node from json")
+ ?: throw BluePrintProcessorException("couldn't get json node from json")
} else {
null
}
@@ -54,8 +58,12 @@ object BluePrintVelocityTemplateService {
/**
* Generate Content from Velocity Template and JSON Node with injected API
*/
- fun generateContent(template: String, jsonNode: JsonNode?, ignoreJsonNull: Boolean = false,
- additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
+ fun generateContent(
+ template: String,
+ jsonNode: JsonNode?,
+ ignoreJsonNull: Boolean = false,
+ additionalContext: MutableMap<String, Any> = mutableMapOf()
+ ): String {
/*
* create a new instance of the velocity engine
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
index 5cec3c947..98e5e5aec 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowService.kt
@@ -16,15 +16,27 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-import kotlinx.coroutines.*
+import kotlinx.coroutines.CancellationException
+import kotlinx.coroutines.CompletableDeferred
+import kotlinx.coroutines.CoroutineName
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.actor
import kotlinx.coroutines.channels.consumeEach
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import kotlinx.coroutines.launch
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel
import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeStatus
import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeStatus
+import org.onap.ccsdk.cds.controllerblueprints.core.incomingEdges
+import org.onap.ccsdk.cds.controllerblueprints.core.isEndNode
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.outgoingEdges
+import org.onap.ccsdk.cds.controllerblueprints.core.outgoingEdgesNotInLabels
+import org.onap.ccsdk.cds.controllerblueprints.core.startNodes
import kotlin.coroutines.CoroutineContext
interface BluePrintWorkFlowService<In, Out> {
@@ -49,7 +61,6 @@ interface BluePrintWorkFlowService<In, Out> {
suspend fun cancelNode(node: Graph.Node, nodeInput: In, nodeOutput: Out): EdgeLabel
suspend fun restartNode(node: Graph.Node, nodeInput: In, nodeOutput: Out): EdgeLabel
-
}
/** Workflow Message Types */
@@ -155,7 +166,6 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
}
-
private suspend fun nodeActor() = actor<NodeMessage<In, Out>>(coroutineContext, Channel.UNLIMITED) {
/** Send message to process from one state to other state */
@@ -225,8 +235,9 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
suspend fun executeNodeWorker(message: NodeExecuteMessage<In, Out>) {
val node = message.node
node.status = NodeStatus.EXECUTING
- val nodeState = if (node.id == BluePrintConstants.GRAPH_START_NODE_NAME
- || node.id == BluePrintConstants.GRAPH_END_NODE_NAME) {
+ val nodeState = if (node.id == BluePrintConstants.GRAPH_START_NODE_NAME ||
+ node.id == BluePrintConstants.GRAPH_END_NODE_NAME
+ ) {
EdgeLabel.SUCCESS
} else {
log.debug("##### Processing workflow($workflowId) node($node) #####")
@@ -339,4 +350,4 @@ abstract class AbstractBluePrintWorkFlowService<In, Out> : CoroutineScope, BlueP
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
index e5788a936..2dc8b5cf7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -17,14 +17,25 @@
package org.onap.ccsdk.cds.controllerblueprints.core.service
-
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.AttributeExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ExpressionData
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationOutputExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyExpression
+import org.onap.ccsdk.cds.controllerblueprints.core.format
+import org.onap.ccsdk.cds.controllerblueprints.core.isComplexType
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonPathParse
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.ResourceResolverUtils
+import org.slf4j.LoggerFactory
/**
*
@@ -32,19 +43,23 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.ResourceResolverUtils
* @author Brinda Santh
*/
class PropertyAssignmentService(var bluePrintRuntimeService: BluePrintRuntimeService<MutableMap<String, JsonNode>>) {
- private val log= LoggerFactory.getLogger(this::class.toString())
+
+ private val log = LoggerFactory.getLogger(this::class.toString())
private var bluePrintContext: BluePrintContext = bluePrintRuntimeService.bluePrintContext()
-/*
+ /*
-If Property Assignment is Expression.
- Get the Expression
- Recursively resolve the expression
- */
+ If Property Assignment is Expression.
+ Get the Expression
+ Recursively resolve the expression
+ */
- fun resolveAssignmentExpression(nodeTemplateName: String, assignmentName: String,
- assignment: JsonNode): JsonNode {
+ fun resolveAssignmentExpression(
+ nodeTemplateName: String,
+ assignmentName: String,
+ assignment: JsonNode
+ ): JsonNode {
val valueNode: JsonNode
log.trace("Assignment ({})", assignment)
val expressionData = BluePrintExpressionService.getExpressionData(assignment)
@@ -84,7 +99,6 @@ If Property Assignment is Expression.
valueNode = bluePrintRuntimeService.resolveDSLExpression(expressionData.dslExpression!!.propertyName)
}
BluePrintConstants.EXPRESSION_GET_NODE_OF_TYPE -> {
-
}
else -> {
throw BluePrintException(format("for property ({}), command ({}) is not supported ", propName, command))
@@ -122,7 +136,7 @@ If Property Assignment is Expression.
}
BluePrintConstants.PROPERTY_BPP -> {
valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(BluePrintConstants.PROPERTY_BPP, attributeName)
- ?: throw BluePrintException("failed to get env attribute name ($attributeName) ")
+ ?: throw BluePrintException("failed to get env attribute name ($attributeName) ")
}
else -> {
if (!attributeExpression.modelableEntityName.equals(BluePrintConstants.PROPERTY_SELF, true)) {
@@ -130,13 +144,12 @@ If Property Assignment is Expression.
}
var attributeDefinition: AttributeDefinition = bluePrintContext
- .nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)
- ?: throw BluePrintException("failed to get attribute definitions for node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
+ .nodeTemplateNodeType(attributeNodeTemplateName).attributes?.get(attributeName)
+ ?: throw BluePrintException("failed to get attribute definitions for node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
valueNode = bluePrintRuntimeService.getNodeTemplateAttributeValue(attributeNodeTemplateName, attributeName)
- ?: throw BluePrintException("failed to get node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
+ ?: throw BluePrintException("failed to get node template ($attributeNodeTemplateName)'s attribute name ($attributeName) ")
}
-
}
if (subAttributeName != null) {
if (valueNode.isComplexType())
@@ -162,11 +175,22 @@ If Property Assignment is Expression.
}
val nodeTemplatePropertyExpression = bluePrintContext.nodeTemplateByName(propertyNodeTemplateName).properties?.get(propertyName)
- ?: throw BluePrintException(format("failed to get property definitions for node template ({})'s property name ({}) ", nodeTemplateName, propertyName))
+ ?: throw BluePrintException(
+ format(
+ "failed to get property definitions for node template ({})'s property name ({}) ",
+ nodeTemplateName,
+ propertyName
+ )
+ )
var propertyDefinition: PropertyDefinition = bluePrintContext.nodeTemplateNodeType(propertyNodeTemplateName).properties?.get(propertyName)!!
- log.info("node template name ({}), property Name ({}) resolved value ({})", propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
+ log.info(
+ "node template name ({}), property Name ({}) resolved value ({})",
+ propertyNodeTemplateName,
+ propertyName,
+ nodeTemplatePropertyExpression
+ )
// Check it it is a nested expression
valueNode = resolveAssignmentExpression(propertyNodeTemplateName, propertyName, nodeTemplatePropertyExpression)
@@ -187,9 +211,11 @@ If Property Assignment is Expression.
outputNodeTemplateName = operationOutputExpression.modelableEntityName
}
- var valueNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(outputNodeTemplateName,
- operationOutputExpression.interfaceName, operationOutputExpression.operationName,
- operationOutputExpression.propertyName)
+ var valueNode = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(
+ outputNodeTemplateName,
+ operationOutputExpression.interfaceName, operationOutputExpression.operationName,
+ operationOutputExpression.propertyName
+ )
val subPropertyName: String? = operationOutputExpression.subPropertyName
if (subPropertyName != null) {
@@ -209,9 +235,13 @@ If Property Assignment is Expression.
artifactNodeTemplateName = artifactExpression.modelableEntityName
}
val artifactDefinition: ArtifactDefinition = bluePrintContext.nodeTemplateByName(artifactNodeTemplateName)
- .artifacts?.get(artifactExpression.artifactName)
- ?: throw BluePrintException(format("failed to get artifact definitions for node template ({})'s " +
- "artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName))
+ .artifacts?.get(artifactExpression.artifactName)
+ ?: throw BluePrintException(
+ format(
+ "failed to get artifact definitions for node template ({})'s " +
+ "artifact name ({}) ", nodeTemplateName, artifactExpression.artifactName
+ )
+ )
return JacksonUtils.jsonNodeFromObject(artifactContent(artifactDefinition))
}
@@ -227,4 +257,3 @@ If Property Assignment is Expression.
return ""
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
index 097967313..9ccf856b5 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
@@ -21,12 +21,23 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
import com.google.common.base.Predicates
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
-import java.io.*
-import java.nio.charset.*
-import java.nio.file.*
-import java.nio.file.attribute.*
-import java.util.function.*
-import java.util.zip.*
+import java.io.BufferedInputStream
+import java.io.ByteArrayOutputStream
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+import java.io.OutputStream
+import java.nio.charset.Charset
+import java.nio.file.FileVisitResult
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.SimpleFileVisitor
+import java.nio.file.attribute.BasicFileAttributes
+import java.util.function.Predicate
+import java.util.zip.Deflater
+import java.util.zip.ZipEntry
+import java.util.zip.ZipFile
+import java.util.zip.ZipOutputStream
class BluePrintArchiveUtils {
@@ -42,7 +53,7 @@ class BluePrintArchiveUtils {
*/
fun compress(source: File, destination: File): Boolean {
try {
- if(!destination.parentFile.exists()) {
+ if (!destination.parentFile.exists()) {
destination.parentFile.mkdirs()
}
destination.createNewFile()
@@ -62,7 +73,7 @@ class BluePrintArchiveUtils {
*/
fun compressToBytes(baseDir: Path, compressionLevel: Int = Deflater.NO_COMPRESSION): ByteArray {
return compressFolder(baseDir, ByteArrayOutputStream(), compressionLevel = compressionLevel)
- .toByteArray()
+ .toByteArray()
}
/**
@@ -75,42 +86,45 @@ class BluePrintArchiveUtils {
* @param fixedModificationTime to force every entry to have this modification time.
* Useful for reproducible operations, like tests, for example.
*/
- private fun <T> compressFolder(baseDir: Path, output: T,
- pathFilter: Predicate<Path> = Predicates.alwaysTrue(),
- compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
- fixedModificationTime: Long? = null): T
+ private fun <T> compressFolder(
+ baseDir: Path,
+ output: T,
+ pathFilter: Predicate<Path> = Predicates.alwaysTrue(),
+ compressionLevel: Int = Deflater.DEFAULT_COMPRESSION,
+ fixedModificationTime: Long? = null
+ ): T
where T : OutputStream {
ZipOutputStream(output)
- .apply { setLevel(compressionLevel) }
- .use { zos ->
- Files.walkFileTree(baseDir, object : SimpleFileVisitor<Path>() {
- @Throws(IOException::class)
- override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
- if (pathFilter.test(file)) {
- val zipEntry = ZipEntry(baseDir.relativize(file).toString())
- fixedModificationTime?.let {
- zipEntry.time = it
- }
- zipEntry.time = 0;
- zos.putNextEntry(zipEntry)
- Files.copy(file, zos)
- zos.closeEntry()
- }
- return FileVisitResult.CONTINUE
- }
-
- @Throws(IOException::class)
- override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
- val zipEntry = ZipEntry(baseDir.relativize(dir).toString() + "/")
+ .apply { setLevel(compressionLevel) }
+ .use { zos ->
+ Files.walkFileTree(baseDir, object : SimpleFileVisitor<Path>() {
+ @Throws(IOException::class)
+ override fun visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult {
+ if (pathFilter.test(file)) {
+ val zipEntry = ZipEntry(baseDir.relativize(file).toString())
fixedModificationTime?.let {
zipEntry.time = it
}
+ zipEntry.time = 0
zos.putNextEntry(zipEntry)
+ Files.copy(file, zos)
zos.closeEntry()
- return FileVisitResult.CONTINUE
}
- })
- }
+ return FileVisitResult.CONTINUE
+ }
+
+ @Throws(IOException::class)
+ override fun preVisitDirectory(dir: Path, attrs: BasicFileAttributes): FileVisitResult {
+ val zipEntry = ZipEntry(baseDir.relativize(dir).toString() + "/")
+ fixedModificationTime?.let {
+ zipEntry.time = it
+ }
+ zos.putNextEntry(zipEntry)
+ zos.closeEntry()
+ return FileVisitResult.CONTINUE
+ }
+ })
+ }
return output
}
@@ -141,5 +155,4 @@ class BluePrintArchiveUtils {
return destinationDir
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
index 06f6f1d17..6605e8eca 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtils.kt
@@ -32,8 +32,10 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.slf4j.LoggerFactory
import java.io.File
import java.io.FileFilter
-import java.nio.file.*
-
+import java.nio.file.Files
+import java.nio.file.Path
+import java.nio.file.Paths
+import java.nio.file.StandardOpenOption
class BluePrintFileUtils {
companion object {
@@ -50,8 +52,12 @@ class BluePrintFileUtils {
val metaDataDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_METADATA_DIR))
Files.createDirectories(metaDataDir.toPath())
- val metaFile = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants
- .TOSCA_METADATA_ENTRY_DEFINITION_FILE))
+ val metaFile = File(
+ blueprintDir.absolutePath.plus(File.separator).plus(
+ BluePrintConstants
+ .TOSCA_METADATA_ENTRY_DEFINITION_FILE
+ )
+ )
Files.write(metaFile.toPath(), getMetaDataContent().toByteArray(), StandardOpenOption.CREATE_NEW)
val definitionsDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR))
@@ -65,7 +71,6 @@ class BluePrintFileUtils {
val templatesDir = File(blueprintDir.absolutePath.plus(File.separator).plus(BluePrintConstants.TOSCA_TEMPLATES_DIR))
Files.createDirectories(templatesDir.toPath())
-
}
fun copyBluePrint(sourcePath: String, targetPath: String) {
@@ -95,7 +100,6 @@ class BluePrintFileUtils {
populateDefaultImports(blueprintContext)
// Rewrite the Entry Definition Files
writeEntryDefinitionFile(blueprintContext)
-
}
fun writeBluePrintTypes(blueprintContext: BluePrintContext) {
@@ -105,8 +109,10 @@ class BluePrintFileUtils {
val definitionDir = File(definitionPath)
check(definitionDir.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${definitionDir.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
+ "path(${definitionDir.absolutePath})"
+ )
}
blueprintContext.serviceTemplate.dataTypes?.let {
@@ -137,9 +143,11 @@ class BluePrintFileUtils {
private fun populateDefaultImports(blueprintContext: BluePrintContext) {
// Get the Default Types
- val types = arrayListOf(BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES,
- BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES,
- BluePrintConstants.PATH_POLICY_TYPES)
+ val types = arrayListOf(
+ BluePrintConstants.PATH_DATA_TYPES, BluePrintConstants.PATH_RELATIONSHIP_TYPES,
+ BluePrintConstants.PATH_ARTIFACT_TYPES, BluePrintConstants.PATH_NODE_TYPES,
+ BluePrintConstants.PATH_POLICY_TYPES
+ )
// Clean Type Imports
cleanImportTypes(blueprintContext.serviceTemplate)
@@ -193,8 +201,10 @@ class BluePrintFileUtils {
Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
check(definitionFile.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " +
- "path(${definitionFile.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write definition file under " +
+ "path(${definitionFile.absolutePath})"
+ )
}
}
@@ -203,8 +213,10 @@ class BluePrintFileUtils {
Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
check(typeFile.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " +
- "path(${typeFile.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_WRITING_FAIL.value, "couldn't write $type.json file under " +
+ "path(${typeFile.absolutePath})"
+ )
}
}
@@ -213,26 +225,29 @@ class BluePrintFileUtils {
"\nCSAR-Version: <VERSION>" +
"\nCreated-By: <AUTHOR NAME>" +
"\nEntry-Definitions: Definitions/<BLUEPRINT_NAME>.json" +
- "\nTemplate-Name: <BLUEPRINT_NAME>"+
- "\nTemplate-Tags: <BLUEPRINT_VERSION>"+
+ "\nTemplate-Name: <BLUEPRINT_NAME>" +
+ "\nTemplate-Tags: <BLUEPRINT_VERSION>" +
"\nTemplate-Tags: <TAGS>"
}
-
fun getBluePrintFile(fileName: String, targetPath: Path): File {
val filePath = targetPath.resolve(fileName).toString()
val file = File(filePath)
check(file.exists()) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
- "path(${file.absolutePath})")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get definition file under " +
+ "path(${file.absolutePath})"
+ )
}
return file
}
fun getCbaStorageDirectory(path: String): Path {
check(StringUtils.isNotBlank(path)) {
- throw BluePrintException(ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " +
- "Blueprint folder under path($path)")
+ throw BluePrintException(
+ ErrorCode.BLUEPRINT_PATH_MISSING.value, "couldn't get " +
+ "Blueprint folder under path($path)"
+ )
}
val fileStorageLocation = Paths.get(path).toAbsolutePath().normalize()
@@ -252,13 +267,19 @@ class BluePrintFileUtils {
}
fun compileJarFilePathName(basePath: String, artifactName: String, artifactVersion: String): String {
- return normalizedPathName(basePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR,
- compileJarFileName(artifactName, artifactVersion))
+ return normalizedPathName(
+ basePath, BluePrintConstants.TOSCA_SCRIPTS_KOTLIN_DIR,
+ compileJarFileName(artifactName, artifactVersion)
+ )
}
fun compileJarFile(basePath: String, artifactName: String, artifactVersion: String): File {
- return normalizedFile(compileJarFilePathName(basePath,
- artifactName, artifactVersion))
+ return normalizedFile(
+ compileJarFilePathName(
+ basePath,
+ artifactName, artifactVersion
+ )
+ )
}
fun stripFileExtension(fileName: String): String {
@@ -267,6 +288,5 @@ class BluePrintFileUtils {
// In case dot is in first position, we are dealing with a hidden file rather than an extension
return if (dotIndexe > 0) fileName.substring(0, dotIndexe) else fileName
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt
index 226c62d48..d29fed0d9 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtils.kt
@@ -18,8 +18,13 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
object BluePrintIOUtils {
- suspend fun <T> retry(times: Int = 1, initialDelay: Long = 0, delay: Long = 1000,
- block: suspend (Int) -> T, exceptionBlock: (e: Exception) -> Unit): T {
+ suspend fun <T> retry(
+ times: Int = 1,
+ initialDelay: Long = 0,
+ delay: Long = 1000,
+ block: suspend (Int) -> T,
+ exceptionBlock: (e: Exception) -> Unit
+ ): T {
var currentDelay = initialDelay
val currentTimes = times - 1
repeat(currentTimes) { count ->
@@ -33,4 +38,4 @@ object BluePrintIOUtils {
}
return block(currentTimes)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
index 55424ada8..4d7647f47 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtils.kt
@@ -17,12 +17,16 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-
import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.runBlocking
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.data.ToscaMetaData
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDefinitions
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintImportService
@@ -30,28 +34,27 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService
import org.slf4j.LoggerFactory
import java.io.File
-import java.util.*
+import java.util.Properties
class BluePrintMetadataUtils {
companion object {
private val log = LoggerFactory.getLogger(this::class.toString())
-
suspend fun toscaMetaData(basePath: String): ToscaMetaData {
val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
+ .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
return toscaMetaDataFromMetaFile(toscaMetaPath)
}
suspend fun entryDefinitionFile(basePath: String): String {
val toscaMetaPath = basePath.plus(BluePrintConstants.PATH_DIVIDER)
- .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
+ .plus(BluePrintConstants.TOSCA_METADATA_ENTRY_DEFINITION_FILE)
return toscaMetaDataFromMetaFile(toscaMetaPath).entityDefinitions
}
fun bluePrintEnvProperties(basePath: String): Properties {
val blueprintsEnvFilePath = basePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
+ .plus(BluePrintConstants.TOSCA_ENVIRONMENTS_DIR)
return environmentFileProperties(blueprintsEnvFilePath)
}
@@ -60,14 +63,14 @@ class BluePrintMetadataUtils {
val envDir = normalizedFile(pathName)
// Verify if the environment directory exists
if (envDir.exists() && envDir.isDirectory) {
- //Find all available environment files
+ // Find all available environment files
envDir.listFiles()!!
- .filter { it.name.endsWith(".properties") }
- .forEach {
- val istream = it.inputStream()
- properties.load(istream)
- istream.close()
- }
+ .filter { it.name.endsWith(".properties") }
+ .forEach {
+ val istream = it.inputStream()
+ properties.load(istream)
+ istream.close()
+ }
}
return properties
}
@@ -91,19 +94,18 @@ class BluePrintMetadataUtils {
}
}
}
-
}
return toscaMetaData
}
- fun getBluePrintRuntime(id: String, blueprintBasePath: String)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ fun getBluePrintRuntime(id: String, blueprintBasePath: String):
+ BluePrintRuntimeService<MutableMap<String, JsonNode>> {
val bluePrintContext: BluePrintContext = getBluePrintContext(blueprintBasePath)
return getBluePrintRuntime(id, bluePrintContext)
}
- fun getBluePrintRuntime(id: String, bluePrintContext: BluePrintContext)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ fun getBluePrintRuntime(id: String, bluePrintContext: BluePrintContext):
+ BluePrintRuntimeService<MutableMap<String, JsonNode>> {
checkNotEmpty(bluePrintContext.rootPath) { "blueprint context root path is missing." }
checkNotEmpty(bluePrintContext.entryDefinition) { "blueprint context entry definition is missing." }
val blueprintBasePath = bluePrintContext.rootPath
@@ -113,8 +115,8 @@ class BluePrintMetadataUtils {
return bluePrintRuntimeService
}
- suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String)
- : BluePrintRuntimeService<MutableMap<String, JsonNode>> {
+ suspend fun getBaseEnhancementBluePrintRuntime(id: String, blueprintBasePath: String):
+ BluePrintRuntimeService<MutableMap<String, JsonNode>> {
val bluePrintContext: BluePrintContext = getBaseEnhancementBluePrintContext(blueprintBasePath)
@@ -191,8 +193,10 @@ class BluePrintMetadataUtils {
val bluePrintScriptsService = BluePrintScriptsServiceImpl()
val bluePrintDefinitions = bluePrintScriptsService
- .scriptInstance<BluePrintDefinitions>(normalizedBasePath, toscaMetaData.templateName!!,
- toscaMetaData.templateVersion!!, definitionClassName, false)
+ .scriptInstance<BluePrintDefinitions>(
+ normalizedBasePath, toscaMetaData.templateName!!,
+ toscaMetaData.templateVersion!!, definitionClassName, false
+ )
// Get the Service Template
val serviceTemplate = bluePrintDefinitions.serviceTemplate()
@@ -206,4 +210,4 @@ class BluePrintMetadataUtils {
return blueprintContext
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
index 3dd756763..c44355070 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintRuntimeUtils.kt
@@ -16,11 +16,11 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
+import org.slf4j.LoggerFactory
/**
*
@@ -28,15 +28,20 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
* @author Brinda Santh
*/
object BluePrintRuntimeUtils {
- private val log= LoggerFactory.getLogger(this::class.toString())
+
+ private val log = LoggerFactory.getLogger(this::class.toString())
fun assignInputsFromFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String, JsonNode>) {
val jsonNode: JsonNode = JacksonUtils.jsonNodeFromFile(fileName)
return assignInputs(bluePrintContext, jsonNode, context)
}
- fun assignInputsFromClassPathFile(bluePrintContext: BluePrintContext, fileName: String, context: MutableMap<String,
- JsonNode>) {
+ fun assignInputsFromClassPathFile(
+ bluePrintContext: BluePrintContext,
+ fileName: String,
+ context: MutableMap<String,
+ JsonNode>
+ ) {
val jsonNode = JacksonUtils.jsonNodeFromClassPathFile(fileName)
return assignInputs(bluePrintContext, jsonNode, context)
}
@@ -56,5 +61,4 @@ object BluePrintRuntimeUtils {
context[path] = valueNode
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt
new file mode 100644
index 000000000..4fd907a5a
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt
@@ -0,0 +1,47 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * 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.controllerblueprints.core.utils
+
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import java.text.SimpleDateFormat
+import java.time.LocalDateTime
+import java.time.ZoneId
+import java.time.format.DateTimeFormatter
+import java.util.Date
+
+fun controllerDate(): Date {
+ val localDateTime = LocalDateTime.now(ZoneId.systemDefault())
+ return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant())
+}
+
+fun currentTimestamp(): String {
+ val localDateTime = LocalDateTime.now(ZoneId.systemDefault())
+ val formatter = DateTimeFormatter.ofPattern(BluePrintConstants.DATE_TIME_PATTERN)
+ return formatter.format(localDateTime)
+}
+
+/** Parse string date in CDS string format */
+fun String.toControllerDate(): Date {
+ val formatter = SimpleDateFormat(BluePrintConstants.DATE_TIME_PATTERN)
+ return formatter.parse(this)
+}
+
+/** Return date to CDS string format */
+fun Date.currentTimestamp(): String {
+ val formatter = SimpleDateFormat(BluePrintConstants.DATE_TIME_PATTERN)
+ return formatter.format(this)
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
index 9fbc38507..6645ff7b4 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtils.kt
@@ -17,34 +17,36 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.slf4j.LoggerFactory
import java.io.File
import java.nio.charset.Charset
class JacksonReactorUtils {
companion object {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
suspend fun getContent(fileName: String): String {
- //log.info("Reading File($fileName)")
+ // log.info("Reading File($fileName)")
return getContent(normalizedFile(fileName))
}
- suspend fun getContent(file: File): String = withContext(Dispatchers.IO) {
+ suspend fun getContent(file: File): String = withContext(Dispatchers.IO) {
// log.info("Reading File(${file.absolutePath})")
file.readText(Charsets.UTF_8)
}
suspend fun getClassPathFileContent(fileName: String): String = withContext(Dispatchers.IO) {
- //log.trace("Reading Classpath File($fileName)")
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
+ // log.trace("Reading Classpath File($fileName)")
+ IOUtils.toString(
+ JacksonUtils::class.java.classLoader
+ .getResourceAsStream(fileName), Charset.defaultCharset()
+ )
}
suspend fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {
@@ -86,6 +88,5 @@ class JacksonReactorUtils {
val content: String = getClassPathFileContent(fileName)
return JacksonUtils.getMapFromJson(content, valueType)
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
index 1f1345327..945f300af 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtils.kt
@@ -19,13 +19,26 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.SerializationFeature
-import com.fasterxml.jackson.databind.node.*
+import com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.BooleanNode
+import com.fasterxml.jackson.databind.node.DoubleNode
+import com.fasterxml.jackson.databind.node.FloatNode
+import com.fasterxml.jackson.databind.node.IntNode
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.databind.node.TextNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBText
import java.io.File
import java.io.InputStream
import java.nio.charset.Charset
@@ -36,15 +49,16 @@ import java.nio.charset.Charset
* @author Brinda Santh
*/
class JacksonUtils {
+
companion object {
val objectMapper = jacksonObjectMapper()
inline fun <reified T : Any> readValue(content: String): T =
- objectMapper.readValue(content, T::class.java)
+ objectMapper.readValue(content, T::class.java)
inline fun <reified T : Any> readValue(stream: InputStream): T =
- objectMapper.readValue(stream, T::class.java)
+ objectMapper.readValue(stream, T::class.java)
fun <T> readValue(content: String, valueType: Class<T>): T? {
return objectMapper.readValue(content, valueType)
@@ -69,8 +83,10 @@ class JacksonUtils {
fun getClassPathFileContent(fileName: String): String {
return runBlocking {
withContext(Dispatchers.Default) {
- IOUtils.toString(JacksonUtils::class.java.classLoader
- .getResourceAsStream(fileName), Charset.defaultCharset())
+ IOUtils.toString(
+ JacksonUtils::class.java.classLoader
+ .getResourceAsStream(fileName), Charset.defaultCharset()
+ )
}
}
}
@@ -170,7 +186,7 @@ class JacksonUtils {
fun <T> getInstanceFromMap(properties: MutableMap<String, JsonNode>, classType: Class<T>): T {
return readValue(getJson(properties), classType)
- ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)")
+ ?: throw BluePrintProcessorException("failed to transform content ($properties) to type ($classType)")
}
fun checkJsonNodeValueOfType(type: String, jsonNode: JsonNode): Boolean {
@@ -265,14 +281,14 @@ class JacksonUtils {
}
fun populatePrimitiveDefaultValues(key: String, primitiveType: String, objectNode: ObjectNode) {
- val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType) ?:
- throw BluePrintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)")
+ val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType)
+ ?: throw BluePrintException("populatePrimitiveDefaultValues expected only primitive values! Received type ($primitiveType)")
objectNode.set(key, defaultValue)
}
fun populatePrimitiveDefaultValuesForArrayNode(primitiveType: String, arrayNode: ArrayNode) {
- val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType) ?:
- throw BluePrintException("populatePrimitiveDefaultValuesForArrayNode expected only primitive values! Received type ($primitiveType)")
+ val defaultValue = getDefaultValueOfPrimitiveAsJsonNode(primitiveType)
+ ?: throw BluePrintException("populatePrimitiveDefaultValuesForArrayNode expected only primitive values! Received type ($primitiveType)")
arrayNode.add(defaultValue)
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
index 19686b5df..0e3d4f93d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtils.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-
import com.fasterxml.jackson.databind.JsonNode
import com.jayway.jsonpath.Configuration
import com.jayway.jsonpath.JsonPath
@@ -29,9 +28,9 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
class JsonParserUtils {
companion object {
- //TODO("Optimise this")
+ // TODO("Optimise this")
val JACKSON_JSON_NODE_CONFIGURATION = Configuration.builder()
- .mappingProvider(JacksonMappingProvider()).jsonProvider(JacksonJsonNodeJsonProvider()).build()
+ .mappingProvider(JacksonMappingProvider()).jsonProvider(JacksonJsonNodeJsonProvider()).build()
val PATH_CONFIGURATION = Configuration.builder().options(Option.AS_PATH_LIST).build()
@@ -60,4 +59,4 @@ class JsonParserUtils {
return parseNSet(jsonNode.asJsonString(), expression, valueNode)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt
index f06cc107d..c0204af8d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ResourceResolverUtils.kt
@@ -29,19 +29,20 @@ import java.net.URL
* @author Brinda Santh
*/
object ResourceResolverUtils {
- private val log= LoggerFactory.getLogger(this::class.toString())
+
+ private val log = LoggerFactory.getLogger(this::class.toString())
fun getFileContent(filename: String, basePath: String?): String {
log.trace("file ({}), basePath ({}) ", filename, basePath)
try {
var resolvedFileName: String = filename
- if (filename.startsWith("http", true)
- || filename.startsWith("https", true)) {
+ if (filename.startsWith("http", true) ||
+ filename.startsWith("https", true)
+ ) {
val givenUrl: String = URL(filename).toString()
val systemUrl: String = File(".").toURI().toURL().toString()
log.trace("givenUrl ({}), systemUrl ({}) ", givenUrl, systemUrl)
if (givenUrl.startsWith(systemUrl)) {
-
}
} else {
if (!filename.startsWith("/")) {
@@ -52,10 +53,10 @@ object ResourceResolverUtils {
}
}
}
- //FIXME("Convert into reactive")
+ // FIXME("Convert into reactive")
return JacksonUtils.getContent(resolvedFileName)
} catch (e: Exception) {
throw BluePrintException(e, "failed to file (%s), basePath (%s) ", filename, basePath)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
index 091e85659..a74722f31 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/ServiceTemplateUtils.kt
@@ -76,33 +76,33 @@ object ServiceTemplateUtils {
toMerge.topologyTemplate?.inputs?.let {
parentServiceTemplate.topologyTemplate?.inputs = parentServiceTemplate.topologyTemplate?.inputs
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.inputs?.putAll(parentServiceTemplate.topologyTemplate?.inputs as MutableMap)
}
toMerge.topologyTemplate?.nodeTemplates?.let {
parentServiceTemplate.topologyTemplate?.nodeTemplates = parentServiceTemplate.topologyTemplate?.nodeTemplates
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.nodeTemplates?.putAll(parentServiceTemplate.topologyTemplate?.nodeTemplates as MutableMap)
}
toMerge.topologyTemplate?.relationshipTemplates?.let {
parentServiceTemplate.topologyTemplate?.relationshipTemplates = parentServiceTemplate.topologyTemplate?.relationshipTemplates
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.relationshipTemplates?.putAll(parentServiceTemplate.topologyTemplate?.relationshipTemplates as MutableMap)
}
toMerge.topologyTemplate?.policies?.let {
parentServiceTemplate.topologyTemplate?.policies = parentServiceTemplate.topologyTemplate?.policies
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.policies?.putAll(parentServiceTemplate.topologyTemplate?.policies as MutableMap)
}
toMerge.topologyTemplate?.workflows?.let {
parentServiceTemplate.topologyTemplate?.workflows = parentServiceTemplate.topologyTemplate?.workflows
- ?: hashMapOf()
+ ?: hashMapOf()
parentServiceTemplate.topologyTemplate?.workflows?.putAll(parentServiceTemplate.topologyTemplate?.workflows as MutableMap)
}
return parentServiceTemplate
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt
index 0b76130a3..fb990c486 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtils.kt
@@ -16,7 +16,10 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import java.util.*
+import java.util.ArrayList
+import java.util.HashMap
+import java.util.LinkedList
+import java.util.Stack
/**
*
@@ -70,14 +73,13 @@ class TopologicalSortingUtils<V> {
return result
}
-
fun inDegree(): MutableMap<V, Int> {
val result = HashMap<V, Int>()
for (v in neighbors.keys)
- result[v] = 0 // All in-degrees are 0
+ result[v] = 0 // All in-degrees are 0
for (from in neighbors.keys) {
for (to in neighbors[from]!!) {
- result[to] = result[to]!! + 1 // Increment in-degree
+ result[to] = result[to]!! + 1 // Increment in-degree
}
}
return result
@@ -86,15 +88,15 @@ class TopologicalSortingUtils<V> {
fun topSort(): List<V>? {
val degree = inDegree()
// Determine all vertices with zero in-degree
- val zeroVerts = Stack<V>() // Stack as good as any here
+ val zeroVerts = Stack<V>() // Stack as good as any here
for (v in degree.keys) {
if (degree[v] == 0) zeroVerts.push(v)
}
// Determine the topological order
val result = ArrayList<V>()
while (!zeroVerts.isEmpty()) {
- val v = zeroVerts.pop() // Choose a vertex with zero in-degree
- result.add(v) // Vertex v is next in topol order
+ val v = zeroVerts.pop() // Choose a vertex with zero in-degree
+ result.add(v) // Vertex v is next in topol order
// "Remove" vertex v by updating its neighbors
for (neighbor in neighbors[v]!!) {
degree[neighbor] = degree[neighbor]!! - 1
@@ -106,7 +108,6 @@ class TopologicalSortingUtils<V> {
return if (result.size != neighbors.size) null else result
}
-
fun bfsDistance(start: V): Map<*, *> {
val distance: MutableMap<V, Int> = hashMapOf()
// Initially, all distance are infinity, except start node
@@ -115,17 +116,17 @@ class TopologicalSortingUtils<V> {
distance[start] = 0
// Process nodes in queue order
val queue = LinkedList<V>()
- queue.offer(start) // Place start node in queue
+ queue.offer(start) // Place start node in queue
while (!queue.isEmpty()) {
val v = queue.remove()
val vDist = distance[v]!!
// Update neighbors
for (neighbor in neighbors[v]!!) {
- if (distance[neighbor] != null) continue // Ignore if already done
+ if (distance[neighbor] != null) continue // Ignore if already done
distance[neighbor] = vDist + 1
queue.offer(neighbor)
}
}
return distance
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt
index ef765ab86..fea637f61 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtils.kt
@@ -43,4 +43,4 @@ object WorkflowGraphUtils {
}
return graph
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/kotlin/script/templates/org.onap.ccsdk.apps.controllerblueprints.scripts.BluePrintKotlinScript
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
index 89838f44f..89838f44f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
index e3e5c26a3..6a028d36f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintErrorTest.kt
@@ -30,4 +30,4 @@ class BluePrintErrorTest {
assertEquals("error", bluePrintError.errors[0])
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
index 76be647f1..3ae87b32d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/CustomFunctionsTest.kt
@@ -18,9 +18,20 @@ 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 com.fasterxml.jackson.databind.node.ArrayNode
+import com.fasterxml.jackson.databind.node.BooleanNode
+import com.fasterxml.jackson.databind.node.IntNode
+import com.fasterxml.jackson.databind.node.JsonNodeType
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
+import com.fasterxml.jackson.databind.node.ObjectNode
+import com.fasterxml.jackson.databind.node.TextNode
import org.junit.Test
-import kotlin.test.*
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertNotNull
+import kotlin.test.assertNull
+import kotlin.test.assertTrue
/**
*
@@ -28,12 +39,13 @@ import kotlin.test.*
* @author Brinda Santh
*/
class CustomFunctionsTest {
+
@Test
fun testFormat() {
- val returnValue : String = format("This is {} for times {}", "test", 2)
+ 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")
+ val returnValue1: String = format("This is test for times 2")
assertEquals("This is test for times 2", returnValue1, "Failed to format empty args")
}
@@ -198,23 +210,23 @@ class CustomFunctionsTest {
@Test(expected = BluePrintException::class)
fun testCheckEquals() {
- assertTrue(checkEquals("hello", "hello", { -> "error"}))
+ assertTrue(checkEquals("hello", "hello", { -> "error" }))
- checkEquals("hello", "test", { -> "error"})
+ checkEquals("hello", "test", { -> "error" })
}
@Test(expected = IllegalStateException::class)
fun testCheckNotEmpty() {
- assertEquals("hello", checkNotEmpty("hello", { -> "error"}))
+ assertEquals("hello", checkNotEmpty("hello", { -> "error" }))
- checkNotEmpty("", { -> "error"})
+ checkNotEmpty("", { -> "error" })
}
@Test(expected = IllegalStateException::class)
fun testCheckNotBlank() {
- assertEquals("hello", checkNotBlank("hello", { -> "error"}))
+ assertEquals("hello", checkNotBlank("hello", { -> "error" }))
- checkNotBlank(" ", { -> "error"})
+ checkNotBlank(" ", { -> "error" })
}
@Test
@@ -223,4 +235,4 @@ class CustomFunctionsTest {
assertEquals("hello", nullToEmpty("hello"))
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
index 9a0da6905..6383fb4a8 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/FileExtensionFunctionTest.kt
@@ -20,7 +20,7 @@ import org.junit.Test
import kotlin.test.assertTrue
class FileExtensionFunctionTest {
- val blueprintBasePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ val blueprintBasePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
@Test
fun testCompress() {
@@ -30,5 +30,4 @@ class FileExtensionFunctionTest {
blueprintFile.compress(targetZip)
assertTrue(blueprintFile.exists(), "failed to create compressed file(${targetZip.absolutePath} ")
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt
index 86cb473ae..86cb473ae 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/GraphExtensionFunctionsTest.kt
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
index 6c92d1815..498a85239 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/MDCContextTest.kt
@@ -45,12 +45,14 @@ class MDCContextTest {
assertEquals(null, MDC.get(BluePrintConstants.ONAP_REQUEST_ID))
}
launch(MDCContext()) {
- assertEquals("12345", MDC.get(BluePrintConstants.ONAP_REQUEST_ID),
- "couldn't get request id")
+ assertEquals(
+ "12345", MDC.get(BluePrintConstants.ONAP_REQUEST_ID),
+ "couldn't get request id"
+ )
MDC.put("client_id", "client-1")
assertEquals("client-1", MDC.get("client_id"), "couldn't get client id")
}
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt
new file mode 100644
index 000000000..4182a3fcd
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/TestConstants.kt
@@ -0,0 +1,24 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.controllerblueprints.core
+
+object TestConstants {
+ const val PATH_TEST_BLUEPRINTS = "./../../../../../components/model-catalog/blueprint-model/test-blueprint"
+ const val PATH_TEST_BLUEPRINTS_BASECONFIG = "$PATH_TEST_BLUEPRINTS/baseconfiguration"
+
+ const val PATH_TEST_DEFINITION_TYPE_STARTER = "./../../../../../components/model-catalog/definition-type/starter-type"
+}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
new file mode 100644
index 000000000..a75262f96
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
@@ -0,0 +1,119 @@
+/*
+ * Copyright © 2019 IBM.
+ *
+ * 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.controllerblueprints.core.annotations
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.asBluePrintsDataTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap
+import kotlin.test.Test
+import kotlin.test.assertNotNull
+
+class BluePrintsAnnotationsTest {
+
+ @Test
+ fun testBluePrintWorkflowData() {
+ val wfInput = TestBluePrintsWorkflowInput::class.asPropertyDefinitionMap()
+ // println(wfInput.asJsonString(true))
+ assertNotNull(wfInput, "failed to generate wfInput property map")
+
+ val wfOutput = TestBluePrintsWorkflowOutput::class.asPropertyDefinitionMap()
+ // println(wfOutput.asJsonString(true))
+ assertNotNull(wfInput, "failed to generate wfOutput property map")
+ }
+
+ @Test
+ fun testBluePrintDataType() {
+ val dataTypes = TestBluePrintsDataType::class.asBluePrintsDataTypes()
+ // println(dataTypes.asJsonString(true))
+ assertNotNull(dataTypes, "failed to generate dataTypes definition")
+ }
+}
+
+@BluePrintsDataType(
+ name = "dt-test-datatype", description = "I am test",
+ version = "1.0.0", derivedFrom = "tosca.datatypes.root"
+)
+data class TestBluePrintsDataType(
+ @BluePrintsProperty(description = "this stringData")
+ var stringData: String,
+ @BluePrintsProperty(description = "this stringDataWithValue")
+ @PropertyDefaultValue(value = "USA")
+ val stringDataWithValue: String,
+ @BluePrintsProperty(description = "this intDataWithValue")
+ @PropertyDefaultValue(value = "30")
+ val intDataWithValue: Int,
+ @BluePrintsProperty(description = "this booleanDataWithValue")
+ @PropertyDefaultValue(value = "true")
+ val booleanDataWithValue: Boolean,
+ @BluePrintsProperty(description = "this anyData")
+ val anyData: Any,
+ @BluePrintsProperty(description = "this jsonDataWithValue")
+ @PropertyDefaultValue(value = """{"data" : "1234"}""")
+ val jsonDataWithValue: JsonNode?,
+ @BluePrintsProperty(description = "listData")
+ val listData: MutableList<String>,
+ @BluePrintsProperty(description = "this mapData")
+ val mapData: MutableMap<String, String> = hashMapOf(),
+ @BluePrintsProperty(description = "this complexData")
+ val complexData: TestBluePrintsChildDataType?,
+ @BluePrintsProperty(description = "this complexDataList")
+ val complexDataList: MutableList<TestBluePrintsChildDataType>
+)
+
+data class TestBluePrintsChildDataType(val name: String)
+
+@BluePrintsWorkflowInput
+data class TestBluePrintsWorkflowInput(
+ @BluePrintsProperty(description = "this sample name")
+ @PropertyDefaultValue(value = "Brinda")
+ var name: String,
+ @BluePrintsProperty(description = "this sample name")
+ val place: String
+)
+
+@BluePrintsWorkflowOutput
+data class TestBluePrintsWorkflowOutput(
+ @BluePrintsProperty(description = "this is dslExpression")
+ @DSLExpression("field1")
+ var dslExpression: String,
+
+ @BluePrintsProperty(description = "this is withNodeAttributeExpression")
+ @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data")
+ var withNodeAttributeExpression: String,
+
+ @BluePrintsProperty(description = "this is withNodeAttributeExpressionSubAttribute")
+ @AttributeExpression(
+ modelableEntityName = "sample-node", attributeName = "response-data",
+ subAttributeName = ".\$field1"
+ )
+ var withNodeAttributeExpressionSubAttribute: String,
+
+ @BluePrintsProperty(description = "this is withAttributeExpressionSubAttribute")
+ @AttributeExpression(attributeName = "response-data", subAttributeName = ".\$field1")
+ var withAttributeExpressionSubAttribute: String,
+
+ @BluePrintsProperty(description = "this is withAttributeExpression")
+ @AttributeExpression(attributeName = "response-data")
+ var withAttributeExpression: String,
+
+ @BluePrintsProperty(description = "this is withAArtifactExpression")
+ @ArtifactExpression(modelableEntityName = "test-node", artifactName = "content-template")
+ var withAArtifactExpression: String,
+
+ @BluePrintsProperty(description = "this status")
+ val status: String = "success"
+)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
index ec8f24d85..c2d764bd6 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
@@ -29,14 +29,18 @@ class BluePrintDSLTest {
@Test
fun testOperationDSLWorkflow() {
- val blueprint = blueprint("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ val blueprint = blueprint(
+ "sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
artifactType(BluePrintTypes.artifactTypeTemplateVelocity())
// For New Component Definition
- component("resource-resolution", "component-script-executor", "1.0.0",
- "Resource Resolution component.") {
+ component(
+ "resource-resolution", "component-script-executor", "1.0.0",
+ "Resource Resolution component."
+ ) {
implementation(180)
// Attributes ( Properties which will be set during execution)
attribute("template1-data", "string", true, "")
@@ -54,8 +58,10 @@ class BluePrintDSLTest {
}
// Already definitions Registered Components
- registryComponent("activate-restconf", "component-resource-resolution", "1.0.0",
- "RestconfExecutor", "Resource Resolution component.") {
+ registryComponent(
+ "activate-restconf", "component-resource-resolution", "1.0.0",
+ "RestconfExecutor", "Resource Resolution component."
+ ) {
implementation(180)
// Properties
property("string-value1", "data")
@@ -65,7 +71,6 @@ class BluePrintDSLTest {
output("self-attribute-expression", getAttribute("template1-data"))
// Artifacts
artifact("template2", "artifact-template-velocity", "Templates/template1.vtl")
-
}
workflow("resource-resolution-process", "Resource Resolution wf") {
@@ -77,25 +82,29 @@ class BluePrintDSLTest {
}
assertNotNull(blueprint.components, "failed to get components")
assertNotNull(blueprint.workflows, "failed to get workflows")
- //println(blueprint.asJsonString(true))
+ // println(blueprint.asJsonString(true))
val serviceTemplateGenerator = BluePrintServiceTemplateGenerator(blueprint)
val serviceTemplate = serviceTemplateGenerator.serviceTemplate()
assertNotNull(serviceTemplate.topologyTemplate, "failed to get service topology template")
- //println(serviceTemplate.asJsonString(true))
+ // println(serviceTemplate.asJsonString(true))
}
@Test
fun testServiceTemplate() {
- val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ val serviceTemplate = serviceTemplate(
+ "sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
metadata("release", "1806")
import("Definition/data_types.json")
dsl("rest-endpoint", """{ "selector" : "odl-selector"}""")
dsl("db-endpoint", """{ "selector" : "db-selector"}""")
topologyTemplate {
- nodeTemplateOperation(nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
- description = "sample activation") {
+ nodeTemplateOperation(
+ nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
+ description = "sample activation"
+ ) {
implementation(360, "SELF") {
primary("Scripts/sample.py")
dependencies("one", "two")
@@ -156,7 +165,7 @@ class BluePrintDSLTest {
assertNotNull(serviceTemplate.topologyTemplate, "failed to get topology template")
assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates, "failed to get nodeTypes")
assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates!!["activate"], "failed to get nodeTypes(activate)")
- //println(serviceTemplate.asJsonString(true))
+ // println(serviceTemplate.asJsonString(true))
}
@Test
@@ -170,7 +179,6 @@ class BluePrintDSLTest {
maxLength(20)
minLength(10)
}
-
}
property("disk-space", "string", true, "") {
defaultValue(10)
@@ -196,8 +204,10 @@ class BluePrintDSLTest {
@Test
fun testServiceTemplateWorkflow() {
- val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ val serviceTemplate = serviceTemplate(
+ "sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
topologyTemplate {
workflowNodeTemplate("activate", "component-resource-resolution", "") {
operation("ResourceResolutionExecutor", "") {
@@ -210,14 +220,16 @@ class BluePrintDSLTest {
}
assertNotNull(serviceTemplate.topologyTemplate, "failed to get topology template")
assertNotNull(serviceTemplate.topologyTemplate?.workflows?.get("activate"), "failed to get workflow(activate)")
- //println(serviceTemplate.asJsonString(true))
+ // println(serviceTemplate.asJsonString(true))
}
@Test
fun testNodeTemplateOperationTypes() {
- val testNodeTemplateInstance = BluePrintTypes.nodeTemplateComponentTestExecutor(id = "test-node-template",
- description = "") {
+ val testNodeTemplateInstance = BluePrintTypes.nodeTemplateComponentTestExecutor(
+ id = "test-node-template",
+ description = ""
+ ) {
definedProperties {
prop1("i am property1")
prop2("i am property2")
@@ -233,21 +245,25 @@ class BluePrintDSLTest {
}
}
assertNotNull(testNodeTemplateInstance, "failed to get test node template")
- //println(testNodeTemplateInstance.asJsonString(true))
+ // println(testNodeTemplateInstance.asJsonString(true))
}
}
-fun BluePrintTypes.nodeTemplateComponentTestExecutor(id: String,
- description: String,
- block: TestNodeTemplateOperationImplBuilder.() -> Unit)
- : NodeTemplate {
+fun BluePrintTypes.nodeTemplateComponentTestExecutor(
+ id: String,
+ description: String,
+ block: TestNodeTemplateOperationImplBuilder.() -> Unit
+):
+ NodeTemplate {
return TestNodeTemplateOperationImplBuilder(id, description).apply(block).build()
}
class TestNodeTemplateOperationImplBuilder(id: String, description: String) :
- AbstractNodeTemplateOperationImplBuilder<TestProperty, TestInput, TestOutput>(id, "component-test-executor",
- "ComponentTestExecutor",
- description)
+ AbstractNodeTemplateOperationImplBuilder<TestProperty, TestInput, TestOutput>(
+ id, "component-test-executor",
+ "ComponentTestExecutor",
+ description
+ )
class TestProperty : PropertiesAssignmentBuilder() {
fun prop1(prop1: String) {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
index 66fec7553..60bef8a8d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/scripts/BluePrintScriptsServiceImplTest.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.core.scripts
-
import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
@@ -34,17 +33,19 @@ class BluePrintScriptsServiceImplTest {
private fun viewClassPathInfo() {
println(" *********** classpathFromClass *********** ")
- classpathFromClass(BluePrintScriptsServiceImplTest::class.java.classLoader,
- BluePrintScriptsServiceImplTest::class)!!
- .forEach(::println)
+ classpathFromClass(
+ BluePrintScriptsServiceImplTest::class.java.classLoader,
+ BluePrintScriptsServiceImplTest::class
+ )!!
+ .forEach(::println)
println(" *********** classpathFromClassloader *********** ")
classpathFromClassloader(BluePrintScriptsServiceImplTest::class.java.classLoader)!!
- .forEach(::println)
+ .forEach(::println)
println(" *********** classpathFromClasspathProperty *********** ")
classpathFromClasspathProperty()!!
- .forEach(::println)
+ .forEach(::println)
}
@Test
@@ -56,8 +57,10 @@ class BluePrintScriptsServiceImplTest {
val basePath = normalizedPathName("src/test/resources/compile")
/** Load the Definitions */
val bluePrintDefinitions = bluePrintScriptsService
- .scriptInstance<BluePrintDefinitions>(basePath,
- "cba.scripts.ActivateBlueprintDefinitions", true)
+ .scriptInstance<BluePrintDefinitions>(
+ basePath,
+ "cba.scripts.ActivateBlueprintDefinitions", true
+ )
assertNotNull(bluePrintDefinitions, "failed to get blueprint definitions")
val serviceTemplate = bluePrintDefinitions.serviceTemplate()
@@ -67,15 +70,18 @@ class BluePrintScriptsServiceImplTest {
assertNotNull(customDataType, "failed to get custom definitions")
val instance = bluePrintScriptsService
- .scriptInstance<BlueprintFunctionNode<String, String>>(basePath,
- "cba.scripts.SampleBlueprintFunctionNode", false)
+ .scriptInstance<BlueprintFunctionNode<String, String>>(
+ basePath,
+ "cba.scripts.SampleBlueprintFunctionNode", false
+ )
assertNotNull(instance, "failed to get compiled instance")
val cachedInstance = bluePrintScriptsService
- .scriptInstance<BlueprintFunctionNode<String, String>>(basePath,
- "cba.scripts.SampleBlueprintFunctionNode", false)
+ .scriptInstance<BlueprintFunctionNode<String, String>>(
+ basePath,
+ "cba.scripts.SampleBlueprintFunctionNode", false
+ )
assertNotNull(cachedInstance, "failed to get cached compile instance")
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
index 33890277f..597194c29 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintContextTest.kt
@@ -17,15 +17,29 @@
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.TestConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Activity
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.PolicyType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Step
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.slf4j.LoggerFactory
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
@@ -38,9 +52,9 @@ import kotlin.test.assertTrue
*/
class BluePrintContextTest {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
- val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val blueprintBasePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
@Test
fun testBluePrintContextCreation() {
@@ -387,7 +401,8 @@ class BluePrintContextTest {
val nodeTemplate2 = NodeTemplate()
nodeTemplate2.type = "hi"
serviceTemplate.topologyTemplate = TopologyTemplate()
- serviceTemplate.topologyTemplate!!.nodeTemplates = mutableMapOf("node" to nodeTemplate, "node2" to nodeTemplate2)
+ serviceTemplate.topologyTemplate!!.nodeTemplates =
+ mutableMapOf("node" to nodeTemplate, "node2" to nodeTemplate2)
val bluePrintContext = BluePrintContext(serviceTemplate)
assertEquals(1, bluePrintContext.nodeTemplateForNodeType("hello")!!.size)
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
index d2363ab9d..f8cad990d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintExpressionServiceTest.kt
@@ -31,6 +31,7 @@ import kotlin.test.assertNotNull
* @author Brinda Santh
*/
class BluePrintExpressionServiceTest {
+
@Test
fun testInputExpression() {
val node: JsonNode = jacksonObjectMapper().readTree("{ \"get_input\" : \"input-name\" }")
@@ -58,7 +59,11 @@ class BluePrintExpressionServiceTest {
assertNotNull(expressionData1.propertyExpression, " Failed to populate nested property expression data")
assertEquals("SELF", expressionData1.propertyExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
assertEquals("property-name", expressionData1.propertyExpression?.propertyName, " Failed to get expected propertyName")
- assertEquals("resource/name", expressionData1.propertyExpression?.subPropertyName, " Failed to populate nested subPropertyName expression data")
+ assertEquals(
+ "resource/name",
+ expressionData1.propertyExpression?.subPropertyName,
+ " Failed to populate nested subPropertyName expression data"
+ )
}
@Test
@@ -78,13 +83,17 @@ class BluePrintExpressionServiceTest {
assertNotNull(expressionData1.attributeExpression, " Failed to populate attribute expression data")
assertEquals("SELF", expressionData1.attributeExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
assertEquals("attribute-name", expressionData1.attributeExpression?.attributeName, " Failed to get expected attributeName")
- assertEquals("resource/name", expressionData1.attributeExpression?.subAttributeName, " Failed to populate nested subAttributeName expression data")
+ assertEquals(
+ "resource/name",
+ expressionData1.attributeExpression?.subAttributeName,
+ " Failed to populate nested subAttributeName expression data"
+ )
}
-
@Test
fun testOutputOperationExpression() {
- val node: JsonNode = jacksonObjectMapper().readTree("{ \"get_operation_output\": [\"SELF\", \"interface-name\", \"operation-name\", \"output-property-name\"] }")
+ val node: JsonNode =
+ jacksonObjectMapper().readTree("{ \"get_operation_output\": [\"SELF\", \"interface-name\", \"operation-name\", \"output-property-name\"] }")
val expressionData: ExpressionData = BluePrintExpressionService.getExpressionData(node)
assertNotNull(expressionData, " Failed to populate expression data")
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
@@ -95,7 +104,6 @@ class BluePrintExpressionServiceTest {
assertEquals("output-property-name", expressionData.operationOutputExpression?.propertyName, " Failed to get expected propertyName")
}
-
@Test
fun testArtifactExpression() {
val node: JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\"] }")
@@ -106,7 +114,6 @@ class BluePrintExpressionServiceTest {
assertEquals("SELF", expressionData.artifactExpression?.modelableEntityName, " Failed to get expected modelableEntityName")
assertEquals("artifact-template", expressionData.artifactExpression?.artifactName, " Failed to get expected artifactName")
-
val node1: JsonNode = jacksonObjectMapper().readTree("{ \"get_artifact\" : [\"SELF\", \"artifact-template\", \"location\", true] }")
val expressionData1: ExpressionData = BluePrintExpressionService.getExpressionData(node1)
assertNotNull(expressionData1, " Failed to populate expression data")
@@ -125,7 +132,9 @@ class BluePrintExpressionServiceTest {
assertNotNull(expressionData, " Failed to populate expression data")
assertEquals(expressionData.isExpression, true, "Failed to identify as expression")
assertNotNull(expressionData.dslExpression, " Failed to populate dsl expression data")
- assertEquals("dynamic-rest-source", expressionData.dslExpression!!.propertyName,
- " Failed to populate dsl property name")
+ assertEquals(
+ "dynamic-rest-source", expressionData.dslExpression!!.propertyName,
+ " Failed to populate dsl property name"
+ )
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
index 47b4f2179..265175165 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRepoFileServiceTest.kt
@@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.TestConstants
import kotlin.test.assertNotNull
/**
@@ -28,7 +29,7 @@ import kotlin.test.assertNotNull
*/
class BluePrintRepoFileServiceTest {
- private val basePath = "./../../../../components/model-catalog/definition-type/starter-type"
+ private val basePath = TestConstants.PATH_TEST_DEFINITION_TYPE_STARTER
private val bluePrintRepoFileService = BluePrintRepoFileService(basePath)
@Test
@@ -54,4 +55,4 @@ class BluePrintRepoFileServiceTest {
val dataType = bluePrintRepoFileService.getDataType("dt-not-found")
assertNotNull(dataType, "Failed to get DataType from repo")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index bef1c4570..dea46224d 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -21,8 +21,8 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.TestConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintRuntimeUtils
@@ -37,6 +37,7 @@ import kotlin.test.assertNotNull
* @author Brinda Santh
*/
class BluePrintRuntimeServiceTest {
+
private val log = LoggerFactory.getLogger(this::class.toString())
@Test
@@ -51,7 +52,7 @@ class BluePrintRuntimeServiceTest {
bluePrintRuntimeService.assignInputs(inputNode)
val propContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
- .resolveNodeTemplateProperties("activate-process")
+ .resolveNodeTemplateProperties("activate-process")
assertNotNull(propContext, "Failed to populate interface property values")
}
@@ -63,19 +64,25 @@ class BluePrintRuntimeServiceTest {
val executionContext = bluePrintRuntimeService.getExecutionContext()
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
- "data/default-context.json", executionContext)
+ BluePrintRuntimeUtils.assignInputsFromClassPathFile(
+ bluePrintRuntimeService.bluePrintContext(),
+ "data/default-context.json", executionContext
+ )
val assignmentParams = "{\n" +
" \"ipAddress\": \"127.0.0.1\",\n" +
" \"hostName\": \"vnf-host\"\n" +
" }"
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams)
+ )
- val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties("sample-netconf-device",
- "netconf")
+ val capProperties = bluePrintRuntimeService.resolveNodeTemplateCapabilityProperties(
+ "sample-netconf-device",
+ "netconf"
+ )
assertNotNull(capProperties, "Failed to populate capability property values")
assertEquals(capProperties["target-ip-address"], "127.0.0.1".asJsonPrimitive(), "Failed to populate parameter target-ip-address")
assertEquals(capProperties["port-number"], JacksonUtils.jsonNodeFromObject(830), "Failed to populate parameter port-number")
@@ -89,12 +96,16 @@ class BluePrintRuntimeServiceTest {
val executionContext = bluePrintRuntimeService.getExecutionContext()
- BluePrintRuntimeUtils.assignInputsFromClassPathFile(bluePrintRuntimeService.bluePrintContext(),
- "data/default-context.json", executionContext)
+ BluePrintRuntimeUtils.assignInputsFromClassPathFile(
+ bluePrintRuntimeService.bluePrintContext(),
+ "data/default-context.json", executionContext
+ )
val inContext: MutableMap<String, JsonNode> = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "ResourceResolutionComponent", "process")
+ .resolveNodeTemplateInterfaceOperationInputs(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process"
+ )
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext["action-name"], JacksonUtils.jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
@@ -109,17 +120,22 @@ class BluePrintRuntimeServiceTest {
bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params", NullNode.getInstance())
- bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",
- "ResourceResolutionComponent", "process")
+ bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process"
+ )
- val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",
- "ResourceResolutionComponent", "process", "status")
+ val outputStatus = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process", "status"
+ )
assertEquals("success".asJsonPrimitive(), outputStatus, "Failed to get operation property status")
- val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue("resource-assignment",
- "ResourceResolutionComponent", "process", "resource-assignment-params")
+ val outputParams = bluePrintRuntimeService.getNodeTemplateOperationOutputValue(
+ "resource-assignment",
+ "ResourceResolutionComponent", "process", "resource-assignment-params"
+ )
assertEquals(NullNode.getInstance(), outputParams, "Failed to get operation property resource-assignment-params")
-
}
@Test
@@ -127,17 +143,20 @@ class BluePrintRuntimeServiceTest {
log.info("************************ testNodeTemplateContextProperty **********************")
val bluePrintRuntimeService = getBluePrintRuntimeService()
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context1",
- JacksonUtils.jsonNodeFromObject("context1-value"))
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment-ra-component", "context2",
- JacksonUtils.jsonNodeFromObject("context2-value"))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment-ra-component", "context1",
+ JacksonUtils.jsonNodeFromObject("context1-value")
+ )
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment-ra-component", "context2",
+ JacksonUtils.jsonNodeFromObject("context2-value")
+ )
val keys = listOf("context1", "context2")
val jsonValueNode = bluePrintRuntimeService.getJsonForNodeTemplateAttributeProperties("resource-assignment-ra-component", keys)
assertNotNull(jsonValueNode, "Failed to get Json for Node Template Context Properties")
log.info("JSON Prepared Value Context {}", jsonValueNode)
-
}
@Test
@@ -159,25 +178,30 @@ class BluePrintRuntimeServiceTest {
val assignmentParams = "{\"ipAddress\": \"127.0.0.1\", \"hostName\": \"vnf-host\"}"
- bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
- JacksonUtils.jsonNode(assignmentParams))
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ "resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams)
+ )
val resolvedJsonNode = bluePrintRuntimeService.resolveWorkflowOutputs("resource-assignment")
assertNotNull(resolvedJsonNode, "Failed to populate workflow output property values")
}
private fun getBluePrintRuntimeService(): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
- val blueprintBasePath = normalizedPathName("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val blueprintBasePath = normalizedPathName(TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG)
val blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
val checkProcessId = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID)
val checkBasePath = blueprintRuntime.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
- assertEquals("1234".asJsonPrimitive(),
- checkProcessId, "Failed to get process id after runtime creation")
- assertEquals(blueprintBasePath.asJsonPrimitive(),
- checkBasePath, "Failed to get base path after runtime creation")
+ assertEquals(
+ "1234".asJsonPrimitive(),
+ checkProcessId, "Failed to get process id after runtime creation"
+ )
+ assertEquals(
+ blueprintBasePath.asJsonPrimitive(),
+ checkBasePath, "Failed to get base path after runtime creation"
+ )
return blueprintRuntime
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
index ce41cfa1f..e525bfc27 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintTemplateServiceTest.kt
@@ -20,6 +20,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import kotlinx.coroutines.runBlocking
import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.TestConstants
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import kotlin.test.BeforeTest
@@ -32,8 +33,7 @@ class BluePrintTemplateServiceTest {
@BeforeTest
fun setup() {
- val blueprintBasePath: String =
- ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val blueprintBasePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
}
@@ -46,7 +46,6 @@ class BluePrintTemplateServiceTest {
val content = BluePrintVelocityTemplateService.generateContent(template, json)
assertNotNull(content, "failed to generate content for velocity template")
}
-
}
@Test
@@ -56,16 +55,16 @@ class BluePrintTemplateServiceTest {
val json = JacksonUtils.getClassPathFileContent("templates/base-config-data-jinja.json")
val element: MutableMap<String, Any> = mutableMapOf()
- element["additional_array"] = arrayListOf(hashMapOf("name" to "Element1", "location" to "Region0"),
- hashMapOf("name" to "Element2", "location" to "Region1"))
+ element["additional_array"] = arrayListOf(
+ hashMapOf("name" to "Element1", "location" to "Region0"),
+ hashMapOf("name" to "Element2", "location" to "Region1")
+ )
val content = BluePrintJinjaTemplateService.generateContent(template, json, false, element)
assertNotNull(content, "failed to generate content for velocity template")
}
-
}
-
@Test
fun `no value variable should evaluate to default value - standalone template mesh test`() {
runBlocking {
@@ -74,12 +73,10 @@ class BluePrintTemplateServiceTest {
val json = JacksonUtils.getClassPathFileContent("templates/default-variable-value-data.json")
val content = BluePrintVelocityTemplateService.generateContent(template, json)
- //first line represents a variable whose value was successfully retrieved, second line contains a variable
+ // first line represents a variable whose value was successfully retrieved, second line contains a variable
// whose value could not be evaluated
val expected = "sample-hostname\n\${node0_backup_router_address}"
assertEquals(expected, content, "No value variable should use default value")
}
}
-
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
index 4d97f8bc3..72fa3e1eb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintWorkflowServiceTest.kt
@@ -18,7 +18,12 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import io.mockk.every
import io.mockk.mockk
-import kotlinx.coroutines.*
+import kotlinx.coroutines.CompletableDeferred
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
+import kotlinx.coroutines.coroutineScope
+import kotlinx.coroutines.runBlocking
+import kotlinx.coroutines.withTimeout
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
@@ -33,7 +38,7 @@ class BluePrintWorkflowServiceTest {
fun testSimpleFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>E/SUCCESS, E>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
val input = "123456"
@@ -49,7 +54,7 @@ class BluePrintWorkflowServiceTest {
val wfs = listOf("12345", "12346").map {
async {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
val response = simpleWorkflow.executeWorkflow(graph, mockBluePrintRuntimeService(it), it)
@@ -65,7 +70,7 @@ class BluePrintWorkflowServiceTest {
fun testMissingEdgeForBFailureState() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), arrayListOf("B"))
val input = "123456"
@@ -78,7 +83,7 @@ class BluePrintWorkflowServiceTest {
fun testBExceptionFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, B>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "C", "D", "E"), null)
val input = "123456"
@@ -91,7 +96,7 @@ class BluePrintWorkflowServiceTest {
fun testTimeoutExceptionFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>TO/SUCCESS, TO>C/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "TO", "C", "D", "E"), null)
val input = "123456"
@@ -104,7 +109,7 @@ class BluePrintWorkflowServiceTest {
fun testConditionalFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
val input = "123456"
@@ -118,10 +123,12 @@ class BluePrintWorkflowServiceTest {
runBlocking {
// Failure Flow
val failurePatGraph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val failurePathWorkflow = TestBluePrintWorkFlowService()
- failurePathWorkflow.simulatedState = prepareSimulation(arrayListOf("B", "C", "D", "E"),
- arrayListOf("A"))
+ failurePathWorkflow.simulatedState = prepareSimulation(
+ arrayListOf("B", "C", "D", "E"),
+ arrayListOf("A")
+ )
val failurePathWorkflowInput = "123456"
val failurePathResponse = failurePathWorkflow.executeWorkflow(failurePatGraph, mockBluePrintRuntimeService(), failurePathWorkflowInput)
assertNotNull(failurePathResponse, "failed to get response")
@@ -132,7 +139,7 @@ class BluePrintWorkflowServiceTest {
fun testMultipleSkipFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/FAILURE, C>D/SUCCESS, D>E/SUCCESS, B>E/SUCCESS, E>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D", "E"), null)
val input = "123456"
@@ -145,7 +152,7 @@ class BluePrintWorkflowServiceTest {
fun testParallelFlow() {
runBlocking {
val graph = "[START>A/SUCCESS, A>B/SUCCESS, A>C/SUCCESS, B>D/SUCCESS, C>D/SUCCESS, D>END/SUCCESS]"
- .toGraph()
+ .toGraph()
val simpleWorkflow = TestBluePrintWorkFlowService()
simpleWorkflow.simulatedState = prepareSimulation(arrayListOf("A", "B", "C", "D"), null)
val input = "123456"
@@ -176,8 +183,9 @@ class BluePrintWorkflowServiceTest {
}
}
-class TestBluePrintWorkFlowService
- : AbstractBluePrintWorkFlowService<String, String>() {
+class TestBluePrintWorkFlowService :
+ AbstractBluePrintWorkFlowService<String, String>() {
+
val log = logger(TestBluePrintWorkFlowService::class)
lateinit var simulatedState: MutableMap<String, EdgeLabel>
@@ -201,17 +209,20 @@ class TestBluePrintWorkFlowService
return startMessage.output.await()
}
- override suspend fun prepareNodeExecutionMessage(node: Graph.Node)
- : NodeExecuteMessage<String, String> {
+ override suspend fun prepareNodeExecutionMessage(node: Graph.Node):
+ NodeExecuteMessage<String, String> {
return NodeExecuteMessage(node, "$node Input", "")
}
- override suspend fun executeNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
-// val random = (1..10).random() * 100
-// log.info("workflow($workflowId) node(${node.id}) will reply in $random ms")
-// kotlinx.coroutines.delay(random.toLong())
-// //Simulation for timeout
+ override suspend fun executeNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
+ // val random = (1..10).random() * 100
+ // log.info("workflow($workflowId) node(${node.id}) will reply in $random ms")
+ // kotlinx.coroutines.delay(random.toLong())
+ // //Simulation for timeout
if (node.id == "TO") {
withTimeout(1) {
kotlinx.coroutines.delay(2)
@@ -225,19 +236,28 @@ class TestBluePrintWorkFlowService
return NodeSkipMessage(node, "$node Skip Input", nodeOutput)
}
- override suspend fun skipNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
+ override suspend fun skipNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
return simulatedState[node.id] ?: throw BluePrintException("failed to get status for the node($node)")
}
- override suspend fun cancelNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ override suspend fun cancelNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
- override suspend fun restartNode(node: Graph.Node, nodeInput: String,
- nodeOutput: String): EdgeLabel {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ override suspend fun restartNode(
+ node: Graph.Node,
+ nodeInput: String,
+ nodeOutput: String
+ ): EdgeLabel {
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun prepareWorkflowOutput(): String {
@@ -248,4 +268,4 @@ class TestBluePrintWorkFlowService
}
return "Final Response"
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
index 8517e7536..6e19656ec 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintFileUtilsTest.kt
@@ -19,23 +19,22 @@ package org.onap.ccsdk.cds.controllerblueprints.core.utils
import kotlinx.coroutines.runBlocking
import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.TestConstants
import java.io.File
import java.nio.file.Paths
import kotlin.test.assertTrue
-
class BluePrintFileUtilsTest {
@Test
fun testNewBlueprint() = runBlocking {
val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-new-test")
BluePrintFileUtils.createEmptyBluePrint(targetPath)
-
}
@Test
fun testBlueprintCopy() = runBlocking {
- val sourcePath: String = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ val sourcePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
val targetPath: String = Paths.get("target").toUri().toURL().path.plus("/bp-copy-test")
@@ -54,7 +53,5 @@ class BluePrintFileUtilsTest {
bluePrintContext.rootPath = targetDir.absolutePath
BluePrintFileUtils.writeBluePrintTypes(bluePrintContext)
-
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt
index 2aea4bc2d..62bb0afcb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintIOUtilsTest.kt
@@ -20,7 +20,6 @@ import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintRetryException
-
class BluePrintIOUtilsTest {
@Test
@@ -39,4 +38,4 @@ class BluePrintIOUtilsTest {
BluePrintIOUtils.retry<String>(4, 0, 500, executionBlock, exceptionBlock)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
index 6c0c30e3d..302daf67e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/BluePrintMetadataUtilsTest.kt
@@ -17,9 +17,9 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-
import kotlinx.coroutines.runBlocking
import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.TestConstants
import org.onap.ccsdk.cds.controllerblueprints.core.data.ToscaMetaData
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
@@ -34,7 +34,7 @@ class BluePrintMetadataUtilsTest {
fun testToscaMetaData() {
runBlocking {
- val basePath = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ val basePath = TestConstants.PATH_TEST_BLUEPRINTS_BASECONFIG
val toscaMetaData: ToscaMetaData = BluePrintMetadataUtils.toscaMetaData(basePath)
assertNotNull(toscaMetaData, "Missing Tosca Definition Object")
@@ -44,7 +44,6 @@ class BluePrintMetadataUtilsTest {
assertNotNull(toscaMetaData.entityDefinitions, "Missing Tosca Entity Definition")
assertNotNull(toscaMetaData.templateTags, "Missing Template Tags")
}
-
}
@Test
@@ -78,4 +77,4 @@ class BluePrintMetadataUtilsTest {
assertEquals(properties.getProperty("blueprintsprocessor.database.alt2.password"), "password2", "failed 4")
assertNull(properties.getProperty("blueprintsprocessor.database.alt3.password"), "failed 5")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
index d0e971ad7..aa4008759 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonReactorUtilsTest.kt
@@ -16,13 +16,13 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import kotlinx.coroutines.runBlocking
import org.junit.Test
+import org.slf4j.LoggerFactory
class JacksonReactorUtilsTest {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
@Test
fun testJsonNodeFromClassPathFile() {
@@ -39,4 +39,4 @@ class JacksonReactorUtilsTest {
JacksonReactorUtils.jsonNodeFromFile(filePath)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt
index faa198faf..5facad7ef 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JacksonUtilsTest.kt
@@ -17,9 +17,9 @@
package org.onap.ccsdk.cds.controllerblueprints.core.utils
-import org.slf4j.LoggerFactory
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.slf4j.LoggerFactory
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@@ -30,7 +30,7 @@ import kotlin.test.assertTrue
*/
class JacksonUtilsTest {
- private val log= LoggerFactory.getLogger(this::class.toString())
+ private val log = LoggerFactory.getLogger(this::class.toString())
@Test
fun testJsonNodeFromClassPathFile() {
@@ -51,7 +51,6 @@ class JacksonUtilsTest {
assertNotNull(nodeType, "Failed to get String array from content")
}
-
@Test
fun testJsonValue() {
val filePath = "data/alltype-data.json"
@@ -71,7 +70,5 @@ class JacksonUtilsTest {
assertTrue(JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_MAP, mapValue), "Failed to get as Map value")
assertTrue(!JacksonUtils.checkJsonNodeValueOfType(BluePrintConstants.DATA_TYPE_LIST, stringValue), "Negative type failed")
-
-
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt
index 8a37a4b19..336e47604 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/JsonParserUtilsTest.kt
@@ -55,4 +55,4 @@ class JsonParserUtilsTest {
val parsedPath = jsonNode.jsonPaths("$..prop1")
assertNotNull(parsedPath, "failed to get parsed path")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
index 5da43484c..fc11947de 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/TopologicalSortingUtilsTest.kt
@@ -35,4 +35,4 @@ class TopologicalSortingUtilsTest {
log.debug("Out-degrees: " + graph.outDegree())
log.debug("A topological sort of the vertices: " + graph.topSort())
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt
index fb0a1a63d..66272d61a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/WorkflowGraphUtilsTest.kt
@@ -39,4 +39,4 @@ class WorkflowGraphUtilsTest {
val graph = WorkflowGraphUtils.workFlowToGraph(workflow)
assertNotNull(graph, "failed to create graph")
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt
index 4f4d210ca..5dd1937f8 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/Scripts/kotlin/ActivateBlueprintDefinitions.kt
@@ -26,8 +26,10 @@ class ActivateBlueprintDefinitions : AbstractBluePrintDefinitions() {
override fun serviceTemplate(): ServiceTemplate {
- return serviceTemplate("sample-blue-print", "1.0.0",
- "brindasanth@onap.com", "sample, blueprints") {
+ return serviceTemplate(
+ "sample-blue-print", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints"
+ ) {
topologyTemplate {
workflowNodeTemplate("activate", "component-resource-resolution", "") {
operation("ResourceResolutionExecutor", "") {
@@ -42,12 +44,14 @@ class ActivateBlueprintDefinitions : AbstractBluePrintDefinitions() {
override fun loadOtherDefinitions() {
/** Sample Definitions */
- val customDataType = dataType("custom-datatype", "1.0.0",
- BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT, "") {
+ val customDataType = dataType(
+ "custom-datatype", "1.0.0",
+ BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT, ""
+ ) {
property("name", BluePrintConstants.DATA_TYPE_STRING, true, "")
property("value", BluePrintConstants.DATA_TYPE_STRING, true, "")
}
/** Loading to definitions */
addOtherDefinition("datatype-custom-datatype", customDataType)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt
index aa77bc30b..8bd060e17 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/Scripts/kotlin/SampleBlueprintFunctionNode.kt
@@ -25,19 +25,19 @@ open class SampleBlueprintFunctionNode : BlueprintFunctionNode<String, String> {
}
override fun prepareRequest(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun process(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun recover(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun prepareResponse(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun apply(t: String): String {
@@ -45,22 +45,22 @@ open class SampleBlueprintFunctionNode : BlueprintFunctionNode<String, String> {
}
override suspend fun prepareRequestNB(executionRequest: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun processNB(executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: String) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun prepareResponseNB(): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override suspend fun applyNB(t: String): String {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/TOSCA-Metadata/TOSCA.meta b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/TOSCA-Metadata/TOSCA.meta
index b1ffabd13..b1ffabd13 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/compile/TOSCA-Metadata/TOSCA.meta
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/compile/TOSCA-Metadata/TOSCA.meta
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/componentnode/default.json
index a1982631b..a1982631b 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/componentnode/default.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/componentnode/default.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/alltype-data.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/data/alltype-data.json
index 055b09658..055b09658 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/alltype-data.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/data/alltype-data.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/data/default-context.json
index 9f733f0fd..9f733f0fd 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/data/default-context.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/data/default-context.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
index b7340f336..b7340f336 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/dictionary/dictionary_schema.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment1.properties b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/environments/Environments/environment1.properties
index d735087bb..d735087bb 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment1.properties
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/environments/Environments/environment1.properties
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/environments/Environments/environment2.properties
index 5530a8f8a..5530a8f8a 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/environments/Environments/environment2.properties
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/environments/Environments/environment2.properties
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/logback-test.xml
index 83e0bc674..83e0bc674 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/logback-test.xml
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/logback-test.xml
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/properties/convert.json
index f7893ce53..f7893ce53 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/convert.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/properties/convert.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/default.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/properties/default.json
index 9f17574e7..9f17574e7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/properties/default.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/properties/default.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-data-jinja.json
index ab7abf3d4..ab7abf3d4 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-data-jinja.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-velocity.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-data-velocity.json
index 2acc6fcdd..2acc6fcdd 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-velocity.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-data-velocity.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-velocity-template.vtl b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-velocity-template.vtl
index f7b1269b3..f7b1269b3 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-velocity-template.vtl
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/base-config-velocity-template.vtl
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-data.json b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/default-variable-value-data.json
index 940ca8d73..940ca8d73 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-data.json
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/default-variable-value-data.json
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl
index ce2458e2e..ce2458e2e 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/default-variable-value-velocity-template.vtl
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/interface.jinja
index 93114d90a..93114d90a 100755
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/interface.jinja
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/isis.jinja
index f46d91330..f46d91330 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/isis.jinja
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/master.jinja
index 1137b2595..1137b2595 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/resources/templates/master.jinja
diff --git a/ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb b/ms/blueprintsprocessor/modules/blueprints/blueprint-proto/krotoPlusConfig.asciipb
index 30255b96d..30255b96d 100644
--- a/ms/controllerblueprints/modules/blueprint-proto/krotoPlusConfig.asciipb
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-proto/krotoPlusConfig.asciipb
diff --git a/ms/controllerblueprints/modules/blueprint-proto/pom.xml b/ms/blueprintsprocessor/modules/blueprints/blueprint-proto/pom.xml
index fef6cb7ac..b208cbda5 100644
--- a/ms/controllerblueprints/modules/blueprint-proto/pom.xml
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-proto/pom.xml
@@ -18,9 +18,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprints</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-proto</artifactId>
@@ -43,9 +43,9 @@
<version>0.6.1</version>
<configuration>
<protocArtifact>
- com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}
+ com.google.protobuf:protoc:3.10.0:exe:${os.detected.classifier}
</protocArtifact>
- <protoSourceRoot>${project.basedir}/../../../../components/model-catalog/proto-definition/proto
+ <protoSourceRoot>${project.basedir}/../../../../../components/model-catalog/proto-definition/proto
</protoSourceRoot>
</configuration>
<executions>
diff --git a/ms/controllerblueprints/modules/blueprint-validation/pom.xml b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/pom.xml
index 5bc2e2a6b..d0072b810 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/pom.xml
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/pom.xml
@@ -20,9 +20,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprints</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>blueprint-validation</artifactId>
@@ -39,12 +39,12 @@
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>resource-dict</artifactId>
</dependency>
<!--Testing dependencies-->
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
index 182c22ce9..73504314b 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactDefinitionValidatorImpl.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
@@ -24,6 +23,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifact
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -32,16 +32,20 @@ import java.io.File
@Service("default-artifact-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintArtifactDefinitionValidatorImpl(
- private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactDefinitionValidator {
+ private val bluePrintTypeValidatorService: BluePrintTypeValidatorService
+) : BluePrintArtifactDefinitionValidator {
- private val log= LoggerFactory.getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintArtifactDefinitionValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
var paths: MutableList<String> = arrayListOf()
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
this.bluePrintRuntimeService = bluePrintRuntimeService
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
@@ -69,7 +73,7 @@ open class BluePrintArtifactDefinitionValidatorImpl(
open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
+ ?: throw BluePrintException("failed to get artifactType($artifactTypeName) for ArtifactDefinition($artifactDefinitionName)")
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -84,13 +88,12 @@ open class BluePrintArtifactDefinitionValidatorImpl(
private fun validateExtension(referencePrefix: String, name: String, artifactDefinition: ArtifactDefinition) {
val customValidators = bluePrintTypeValidatorService
- .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
+ .bluePrintValidators(referencePrefix, BluePrintArtifactDefinitionValidator::class.java)
customValidators?.let {
it.forEach { validator ->
validator.validate(bluePrintRuntimeService, name, artifactDefinition)
}
-
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
index aa2cdb1df..b31211e2d 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintArtifactTypeValidatorImpl.kt
@@ -24,7 +24,8 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.springframework.stereotype.Service
@Service("default-artifact-type-validator")
-open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintArtifactTypeValidator {
+open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintArtifactTypeValidator {
override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactType: ArtifactType) {
@@ -32,4 +33,4 @@ open class BluePrintArtifactTypeValidatorImpl(private val bluePrintTypeValidator
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, artifactType.properties!!)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
index 5a9736bc8..9a4650104 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintAttributeDefinitionValidatorImpl.kt
@@ -31,16 +31,18 @@ import org.springframework.stereotype.Service
@Service("default-attribute-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintAttributeDefinitionValidator {
+open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintAttributeDefinitionValidator {
-
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- attributeDefinition: AttributeDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ attributeDefinition: AttributeDefinition
+ ) {
log.trace("Validating AttributeDefinition($name)")
this.bluePrintRuntimeService = bluePrintRuntimeService
@@ -55,7 +57,7 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = attributeDefinition.entrySchema?.type
- ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
+ ?: throw BluePrintException("Entry schema for DataType ($dataType) for the property ($name) not found")
checkPrimitiveOrComplex(entrySchemaType, name)
}
else -> checkPropertyDataType(dataType, name)
@@ -73,7 +75,7 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
@@ -87,4 +89,4 @@ open class BluePrintAttributeDefinitionValidatorImpl(private val bluePrintTypeVa
throw BluePrintException("Failed to get DataType($dataTypeName)'s derivedFrom($derivedFrom) definition ")
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
index e62de4a22..dab6a78bc 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDataTypeValidatorImpl.kt
@@ -32,4 +32,4 @@ open class BluePrintDataTypeValidatorImpl(private val bluePrintTypeValidatorServ
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, dataType.properties!!)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
index 9ffd78f9e..5df2decdb 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorService.kt
@@ -30,15 +30,16 @@ import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefi
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
-import java.util.*
-
+import java.util.UUID
@Service("bluePrintDesignTimeValidatorService")
-open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
- private val resourceDefinitionValidator: ResourceDefinitionValidator)
- : BluePrintValidatorService {
+open class BluePrintDesignTimeValidatorService(
+ private val bluePrintTypeValidatorService: BluePrintTypeValidatorService,
+ private val resourceDefinitionValidator: ResourceDefinitionValidator
+) :
+ BluePrintValidatorService {
- private val log= LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintDesignTimeValidatorService::class.toString())
override fun validateBluePrints(basePath: String): Boolean {
@@ -48,8 +49,10 @@ open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidato
override fun validateBluePrints(bluePrintRuntimeService: BluePrintRuntimeService<*>): Boolean {
- bluePrintTypeValidatorService.validateServiceTemplate(bluePrintRuntimeService, "service_template",
- bluePrintRuntimeService.bluePrintContext().serviceTemplate)
+ bluePrintTypeValidatorService.validateServiceTemplate(
+ bluePrintRuntimeService, "service_template",
+ bluePrintRuntimeService.bluePrintContext().serviceTemplate
+ )
// Validate Resource Definitions
validateResourceDefinitions(bluePrintRuntimeService)
@@ -65,8 +68,8 @@ open class BluePrintDesignTimeValidatorService(private val bluePrintTypeValidato
val blueprintBasePath = bluePrintRuntimeService.bluePrintContext().rootPath
val resourceDefinitionsPath = blueprintBasePath.plus(File.separator)
- .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
- .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
+ .plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR).plus(File.separator)
+ .plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
val resourceDefinitionFile = File(resourceDefinitionsPath)
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
index 48f1b2155..2dfc09be6 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTemplateValidatorImpl.kt
@@ -17,25 +17,33 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementAssignment
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
@Service("default-node-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTemplateValidator {
+open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintNodeTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintNodeTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
@@ -55,11 +63,11 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
val type: String = nodeTemplate.type
val nodeType: NodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
+ ?: throw BluePrintException("Failed to get NodeType($type) definition for NodeTemplate($name)")
nodeTemplate.properties?.let {
propertyAssignmentValidationUtils
- .validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!)
+ .validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!)
}
nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, name, nodeTemplate) }
nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, name, nodeTemplate) }
@@ -76,8 +84,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
paths.add("artifacts")
artifacts.forEach { artifactDefinitionName, artifactDefinition ->
- bluePrintTypeValidatorService.validateArtifactDefinition(bluePrintRuntimeService,
- artifactDefinitionName, artifactDefinition)
+ bluePrintTypeValidatorService.validateArtifactDefinition(
+ bluePrintRuntimeService,
+ artifactDefinitionName, artifactDefinition
+ )
}
paths.removeAt(paths.lastIndex)
}
@@ -90,8 +100,10 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
paths.add(capabilityName)
val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
- "from NodeType(${nodeTemplate.type})")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) capability definition ($capabilityName) " +
+ "from NodeType(${nodeTemplate.type})"
+ )
validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
@@ -101,14 +113,17 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
}
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
- capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+ open fun validateCapabilityAssignment(
+ nodeTemplateName: String,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition,
+ capabilityAssignment: CapabilityAssignment
+ ) {
capabilityAssignment.properties?.let {
propertyAssignmentValidationUtils
- .validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!)
+ .validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!)
}
-
}
@Throws(BluePrintException::class)
@@ -118,21 +133,28 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
requirements?.forEach { requirementName, requirementAssignment ->
paths.add(requirementName)
val requirementDefinition = nodeType.requirements?.get(requirementName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
- " NodeType(${nodeTemplate.type})")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) requirement definition ($requirementName) from" +
+ " NodeType(${nodeTemplate.type})"
+ )
// Validate Requirement Assignment
validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
}
@Throws(BluePrintException::class)
- open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
- requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
- log.debug("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName,
- requirementAssignmentName)
+ open fun validateRequirementAssignment(
+ nodeTemplateName: String,
+ requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition,
+ requirementAssignment: RequirementAssignment
+ ) {
+ log.debug(
+ "Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName,
+ requirementAssignmentName
+ )
val requirementNodeTemplateName = requirementAssignment.node!!
val capabilityName = requirementAssignment.capability
val relationship = requirementAssignment.relationship!!
@@ -142,14 +164,16 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
}
val relationShipNodeTemplate = bluePrintContext.serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)")
+ ?: throw BluePrintException(
+ "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
+ "for NodeTemplate($nodeTemplateName) requirement($requirementAssignmentName)"
+ )
relationShipNodeTemplate.capabilities?.get(capabilityName)
- ?: throw BluePrintException("Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
- "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)")
-
-
+ ?: throw BluePrintException(
+ "Failed to get requirement NodeTemplate($requirementNodeTemplateName)'s " +
+ "capability($capabilityName) for NodeTemplate ($nodeTemplateName)'s requirement($requirementAssignmentName)"
+ )
}
@Throws(BluePrintException::class)
@@ -160,80 +184,91 @@ open class BluePrintNodeTemplateValidatorImpl(private val bluePrintTypeValidator
interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
- " NodeType(${nodeTemplate.type})")
-
- validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) interface definition ($interfaceAssignmentName) from" +
+ " NodeType(${nodeTemplate.type})"
+ )
+
+ validateInterfaceAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
paths.removeAt(paths.lastIndex)
}
paths.removeAt(paths.lastIndex)
-
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
- validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
- interfaceAssignment)
+ validateInterfaceOperationsAssignment(
+ nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment
+ )
}
-
}
@Throws(BluePrintException::class)
- open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
- interfaceDefinition: InterfaceDefinition,
- interfaceAssignment: InterfaceAssignment) {
+ open fun validateInterfaceOperationsAssignment(
+ nodeTemplateName: String,
+ interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment
+ ) {
val operations = interfaceAssignment.operations
operations?.let {
it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
+ ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName)")
- log.debug("Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
- "($operationAssignmentName)")
+ log.debug(
+ "Validation NodeTemplate($nodeTemplateName) Interface($interfaceAssignmentName) Operation " +
+ "($operationAssignmentName)"
+ )
val inputs = operationAssignments.inputs
val outputs = operationAssignments.outputs
inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation " +
- "definition ($operationAssignmentName) property definition($propertyName)")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) operation " +
+ "definition ($operationAssignmentName) property definition($propertyName)"
+ )
// Check the property values with property definition
propertyAssignmentValidationUtils
- .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
outputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.outputs?.get(propertyName)
- ?: throw BluePrintException("Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
- "output property definition($propertyName)")
+ ?: throw BluePrintException(
+ "Failed to get NodeTemplate($nodeTemplateName) operation definition ($operationAssignmentName) " +
+ "output property definition($propertyName)"
+ )
// Check the property values with property definition
propertyAssignmentValidationUtils
- .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ .validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
-
}
}
-
}
-
private fun validateExtension(referencePrefix: String, name: String, nodeTemplate: NodeTemplate) {
val customValidator = bluePrintTypeValidatorService
- .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
+ .bluePrintValidator(referencePrefix, BluePrintNodeTemplateValidator::class.java)
customValidator?.let {
it.validate(bluePrintRuntimeService, name, nodeTemplate)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
index 3d3122c61..5384744ee 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintNodeTypeValidatorImpl.kt
@@ -17,20 +17,24 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.data.InterfaceDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RequirementDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
-
@Service("default-node-type-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintNodeTypeValidator {
@@ -49,12 +53,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.add(nodeTypeName)
val derivedFrom: String = nodeType.derivedFrom
- //Check Derived From
+ // Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
bluePrintContext.serviceTemplate.nodeTypes?.get(derivedFrom)
- ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
+ ?: throw BluePrintException("Failed to get derivedFrom NodeType($derivedFrom)'s for NodeType($nodeTypeName)")
}
nodeType.attributes?.let {
@@ -91,8 +95,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.removeAt(paths.lastIndex)
}
- open fun validateCapabilityDefinition(nodeTypeName: String, nodeType: NodeType, capabilityName: String,
- capabilityDefinition: CapabilityDefinition) {
+ open fun validateCapabilityDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ capabilityName: String,
+ capabilityDefinition: CapabilityDefinition
+ ) {
val capabilityType = capabilityDefinition.type
check(BluePrintTypes.validCapabilityTypes.contains(capabilityType)) {
throw BluePrintException("failed to get CapabilityType($capabilityType) for NodeType($nodeTypeName)")
@@ -111,8 +119,12 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
paths.removeAt(paths.lastIndex)
}
- open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
- requirementDefinition: RequirementDefinition) {
+ open fun validateRequirementDefinition(
+ nodeTypeName: String,
+ nodeType: NodeType,
+ requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition
+ ) {
log.info("validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
val requirementNodeTypeName = requirementDefinition.node!!
@@ -124,12 +136,13 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
}
val relationShipNodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
+ ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s for requirement($requirementDefinitionName) ")
relationShipNodeType.capabilities?.get(capabilityName)
- ?: throw BluePrintException("failed to get requirement NodeType($requirementNodeTypeName)'s " +
- "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) ")
-
+ ?: throw BluePrintException(
+ "failed to get requirement NodeType($requirementNodeTypeName)'s " +
+ "capability($nodeTypeName) for NodeType ($capabilityName)'s requirement($requirementDefinitionName) "
+ )
}
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
@@ -163,5 +176,4 @@ open class BluePrintNodeTypeValidatorImpl(private val bluePrintTypeValidatorServ
open fun validateImplementation(implementation: Implementation) {
checkNotEmpty(implementation.primary) { "couldn't get implementation" }
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
index c2c80d7f7..5683c0170 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintPropertyDefinitionValidatorImpl.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
@@ -25,23 +24,23 @@ import org.onap.ccsdk.cds.controllerblueprints.core.format
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-property-definition-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintPropertyDefinitionValidator {
+open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintPropertyDefinitionValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
this.bluePrintRuntimeService = bluePrintRuntimeService
-
log.trace("Validating PropertyDefinition($name)")
val dataType: String = propertyDefinition.type
@@ -55,14 +54,13 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
}
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, name))
checkPrimitiveOrComplex(entrySchemaType, name)
}
else -> checkPropertyDataType(dataType, name)
}
}
-
private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
@@ -74,7 +72,7 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
private fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintRuntimeService.bluePrintContext().serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataTypeName, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
}
@@ -88,4 +86,4 @@ open class BluePrintPropertyDefinitionValidatorImpl(private val bluePrintTypeVal
throw BluePrintException(format("Failed to get DataType({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
index 0e76be49e..d71e78c43 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintServiceTemplateValidatorImpl.kt
@@ -16,24 +16,29 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import com.google.common.base.Preconditions
import org.apache.commons.lang3.StringUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintError
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.TopologyTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-service-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintServiceTemplateValidator {
+open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintServiceTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var error: BluePrintError
@@ -74,7 +79,6 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
paths.removeAt(paths.lastIndex)
}
-
fun validateDataTypes(dataTypes: MutableMap<String, DataType>) {
paths.add(BluePrintConstants.PATH_DATA_TYPES)
@@ -108,4 +112,4 @@ open class BluePrintServiceTemplateValidatorImpl(private val bluePrintTypeValida
bluePrintTypeValidatorService.validateTopologyTemplate(bluePrintRuntimeService, "topologyTemplate", topologyTemplate)
paths.removeAt(paths.lastIndex)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
index 406f8dec0..a7fb3d57e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTopologyTemplateValidatorImpl.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
@@ -26,15 +25,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("default-topology-template-validator")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintTopologyTemplateValidator {
+open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintTopologyTemplateValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
@@ -55,7 +56,6 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, inputs)
}
-
@Throws(BluePrintException::class)
fun validateNodeTemplates(nodeTemplates: MutableMap<String, NodeTemplate>) {
@@ -73,5 +73,4 @@ open class BluePrintTopologyTemplateValidatorImpl(private val bluePrintTypeValid
bluePrintTypeValidatorService.validateWorkflow(bluePrintRuntimeService, workflowName, workflow)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
index d9f19d489..1fb70503f 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintTypeValidatorServiceImpl.kt
@@ -18,7 +18,18 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
@@ -43,8 +54,8 @@ class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
return context.getBeansOfType(classType)
- .filter { it.key.startsWith(referenceNamePrefix) }
- .mapNotNull { it.value }
+ .filter { it.key.startsWith(referenceNamePrefix) }
+ .mapNotNull { it.value }
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
@@ -53,52 +64,51 @@ class BluePrintTypeValidatorServiceImpl : BluePrintTypeValidatorService {
override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintServiceTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default ServiceTemplate validators")
}
override fun getDataTypeValidators(): List<BluePrintDataTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintDataTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default DataType validators")
+ ?: throw BluePrintProcessorException("failed to get default DataType validators")
}
override fun getArtifactTypeValidators(): List<BluePrintArtifactTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
+ ?: throw BluePrintProcessorException("failed to get default ArtifactType validators")
}
override fun getArtifactDefinitionsValidators(): List<BluePrintArtifactDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintArtifactDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default ArtifactDefinition validators")
}
override fun getNodeTypeValidators(): List<BluePrintNodeTypeValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTypeValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeType validators")
+ ?: throw BluePrintProcessorException("failed to get default NodeType validators")
}
override fun getTopologyTemplateValidators(): List<BluePrintTopologyTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintTopologyTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default TopologyTemplate validators")
}
override fun getNodeTemplateValidators(): List<BluePrintNodeTemplateValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintNodeTemplateValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
+ ?: throw BluePrintProcessorException("failed to get default NodeTemplate validators")
}
override fun getWorkflowValidators(): List<BluePrintWorkflowValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintWorkflowValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default Workflow validators")
+ ?: throw BluePrintProcessorException("failed to get default Workflow validators")
}
override fun getPropertyDefinitionValidators(): List<BluePrintPropertyDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintPropertyDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default PropertyDefinition validators")
}
override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
return bluePrintValidators(PREFIX_DEFAULT, BluePrintAttributeDefinitionValidator::class.java)
- ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
+ ?: throw BluePrintProcessorException("failed to get default AttributeDefinition validators")
}
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
index a59bcb2f8..a1a9eb913 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintValidationConfiguration.kt
@@ -21,4 +21,4 @@ import org.springframework.context.annotation.Configuration
@Configuration
@ComponentScan
-open class BluePrintValidationConfiguration \ No newline at end of file
+open class BluePrintValidationConfiguration
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
index e705808c9..a2b598017 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintWorkflowValidatorImpl.kt
@@ -17,13 +17,13 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.slf4j.LoggerFactory
-import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.validation.utils.PropertyAssignmentValidationUtils
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : BluePrintWorkflowValidator {
- private val log= LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
+ private val log = LoggerFactory.getLogger(BluePrintServiceTemplateValidatorImpl::class.toString())
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
var paths: MutableList<String> = arrayListOf()
@@ -42,7 +42,6 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
this.bluePrintRuntimeService = bluePrintRuntimeService
-
paths.add(workflowName)
paths.joinToString(BluePrintConstants.PATH_DIVIDER)
@@ -65,18 +64,21 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
val nodeTypeDerivedFrom = bluePrintRuntimeService.bluePrintContext().nodeTemplateNodeType(it).derivedFrom
- check(nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW
- || nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT) {
+ check(
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW ||
+ nodeTypeDerivedFrom == BluePrintConstants.MODEL_TYPE_NODE_COMPONENT
+ ) {
"NodeType(${nodeTemplate.type}) derived from is '$nodeTypeDerivedFrom', Expected " +
"'${BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW}' or '${BluePrintConstants.MODEL_TYPE_NODE_COMPONENT}'"
}
} catch (e: Exception) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed to validate Workflow($workflowName)'s step($stepName)'s " +
- "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!)
+ .addError(
+ "Failed to validate Workflow($workflowName)'s step($stepName)'s " +
+ "definition", paths.joinToString(BluePrintConstants.PATH_DIVIDER), e.message!!
+ )
}
}
-
}
paths.removeAt(paths.lastIndex)
// Step Validation Ends
@@ -97,12 +99,10 @@ open class BluePrintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
bluePrintTypeValidatorService.validatePropertyDefinitions(bluePrintRuntimeService, workflow.outputs!!)
PropertyAssignmentValidationUtils(bluePrintRuntimeService.bluePrintContext())
- .validatePropertyDefinitionNAssignments(workflow.outputs!!)
+ .validatePropertyDefinitionNAssignments(workflow.outputs!!)
}
// Validate Value or Expression
workflow.outputs?.forEach { propertyName, propertyDefinition ->
-
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
index 03183e624..78a5d379e 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ArtifactMappingResourceValidator.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.validation.extension
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
@@ -24,17 +23,21 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.service.ResourceAssignmentValidationServiceImpl
+import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
@Service("artifact-mapping-resource-artifact-definition-validator")
-open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService)
- : BluePrintArtifactDefinitionValidator {
+open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) :
+ BluePrintArtifactDefinitionValidator {
- private val log= LoggerFactory.getLogger(ArtifactMappingResourceValidator::class.toString())
+ private val log = LoggerFactory.getLogger(ArtifactMappingResourceValidator::class.toString())
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- artifactDefinition: ArtifactDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ artifactDefinition: ArtifactDefinition
+ ) {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val file: String = artifactDefinition.file
@@ -44,4 +47,4 @@ open class ArtifactMappingResourceValidator(private val bluePrintTypeValidatorSe
val resourceAssignmentValidationService = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidationService.validate(resourceAssignment)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
index 608de4f0c..dc5da2669 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/extension/ResourceDefinitionValidation.kt
@@ -16,11 +16,11 @@
package org.onap.ccsdk.cds.controllerblueprints.validation.extension
-import org.slf4j.LoggerFactory
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
+import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -31,13 +31,16 @@ interface ResourceDefinitionValidator : BluePrintValidator<ResourceDefinition>
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
open class ResourceDefinitionValidatorImpl(private val bluePrintTypeValidatorService: BluePrintTypeValidatorService) : ResourceDefinitionValidator {
- private val log= LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java)
+ private val log = LoggerFactory.getLogger(ResourceDefinitionValidatorImpl::class.java)
- override fun validate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String,
- resourceDefinition: ResourceDefinition) {
+ override fun validate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ name: String,
+ resourceDefinition: ResourceDefinition
+ ) {
log.trace("validating resource definition($name)")
resourceDefinition.sources.forEach { name, nodeTemplate ->
bluePrintTypeValidatorService.validateNodeTemplate(bluePrintRuntimeService, name, nodeTemplate)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
index d49348152..63aa7e537 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/utils/PropertyAssignmentValidationUtils.kt
@@ -48,19 +48,23 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
}
}
- open fun validatePropertyAssignments(nodeTypeProperties: MutableMap<String, PropertyDefinition>,
- properties: MutableMap<String, JsonNode>) {
+ open fun validatePropertyAssignments(
+ nodeTypeProperties: MutableMap<String, PropertyDefinition>,
+ properties: MutableMap<String, JsonNode>
+ ) {
properties.forEach { propertyName, propertyAssignment ->
val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
- ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
+ ?: throw BluePrintException("validatePropertyAssignments failed to get definition for the property ($propertyName)")
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
-
}
}
- open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
- propertyAssignment: JsonNode) {
+ open fun validatePropertyAssignment(
+ propertyName: String,
+ propertyDefinition: PropertyDefinition,
+ propertyAssignment: JsonNode
+ ) {
// Check and Validate if Expression Node
val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
if (!expressionData.isExpression) {
@@ -74,13 +78,12 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
-
} else if (BluePrintTypes.validComplexTypes().contains(propertyType)) {
isValid = true
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -99,10 +102,9 @@ open class PropertyAssignmentValidationUtils(private val bluePrintContext: BlueP
open fun checkPropertyDataType(dataTypeName: String, propertyName: String) {
val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
- ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
+ ?: throw BluePrintException("DataType ($dataTypeName) for the property ($propertyName) not found")
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
-
}
open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
index 9dbd19e22..19d1ef0a4 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BluePrintDesignTimeValidatorServiceTest.kt
@@ -34,7 +34,7 @@ import kotlin.test.assertTrue
class BluePrintDesignTimeValidatorServiceTest {
- private val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ private val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
private val bluePrintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
private val mockBluePrintTypeValidatorService = MockBluePrintTypeValidatorService()
private val resourceDefinitionValidator = mockk<ResourceDefinitionValidator>()
@@ -60,7 +60,10 @@ class BluePrintDesignTimeValidatorServiceTest {
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)", bluePrintRuntime.getBluePrintError().errors[0])
+ assertEquals(
+ "Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)",
+ bluePrintRuntime.getBluePrintError().errors[0]
+ )
}
@Test
@@ -90,9 +93,11 @@ class BluePrintDesignTimeValidatorServiceTest {
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
assertEquals(1, bluePrintRuntime.getBluePrintError().errors.size)
- assertEquals("Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
- "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
- "Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0])
+ assertEquals(
+ "Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
+ "resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
+ "Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'", bluePrintRuntime.getBluePrintError().errors[0]
+ )
}
@Test
@@ -100,6 +105,4 @@ class BluePrintDesignTimeValidatorServiceTest {
val workflowName = "resource-assignment"
workflowValidator.validate(bluePrintRuntime, workflowName, bluePrintRuntime.bluePrintContext().workflowByName(workflowName))
}
-
}
-
diff --git a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
index 169715295..11c6c037c 100644
--- a/ms/controllerblueprints/modules/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/MockBluePrintTypeValidatorService.kt
@@ -17,7 +17,18 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintDataTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidator
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowValidator
class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
@@ -26,11 +37,11 @@ class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(referenceNamePrefix: String, classType: Class<T>): List<T>? {
- return null
+ return null
}
override fun <T : BluePrintValidator<*>> bluePrintValidators(classType: Class<T>): List<T>? {
- return null
+ return null
}
override fun getServiceTemplateValidators(): List<BluePrintServiceTemplateValidator> {
@@ -72,4 +83,4 @@ class MockBluePrintTypeValidatorService : BluePrintTypeValidatorService {
override fun getAttributeDefinitionValidators(): List<BluePrintAttributeDefinitionValidator> {
return listOf(BluePrintAttributeDefinitionValidatorImpl(this))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/blueprints/pom.xml b/ms/blueprintsprocessor/modules/blueprints/pom.xml
new file mode 100644
index 000000000..cd6a17e88
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/blueprints/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2018-2019 AT&T Intellectual Property.
+ ~
+ ~ 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.blueprintsprocessor</groupId>
+ <artifactId>modules</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>blueprints</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Blueprints POM</name>
+ <description>Blueprints POM</description>
+
+ <modules>
+ <module>blueprint-core</module>
+ <module>resource-dict</module>
+ <module>blueprint-validation</module>
+ <module>blueprint-proto</module>
+ </modules>
+</project>
diff --git a/ms/controllerblueprints/modules/resource-dict/pom.xml b/ms/blueprintsprocessor/modules/blueprints/resource-dict/pom.xml
index b6803d4be..2e2fab150 100644
--- a/ms/controllerblueprints/modules/resource-dict/pom.xml
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/pom.xml
@@ -20,9 +20,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>modules</artifactId>
- <version>0.7.0-SNAPSHOT</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprints</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>resource-dict</artifactId>
@@ -31,8 +31,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
index f1e0d2c86..10930ffab 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import java.io.Serializable
-import java.util.*
+import java.util.Date
open class ResourceDefinition {
@@ -103,7 +103,6 @@ open class ResourceAssignment {
*/
interface ResourceSource : Serializable
-
open class ResourceSourceMapping {
lateinit var resourceSourceMappings: MutableMap<String, String>
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
index 25b161e47..366a4dcd4 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDictionaryConstants.kt
@@ -22,6 +22,7 @@ package org.onap.ccsdk.cds.controllerblueprints.resource.dict
* @author Brinda Santh
*/
object ResourceDictionaryConstants {
+
const val SOURCE_INPUT = "input"
const val SOURCE_DEFAULT = "default"
const val PROCESSOR_DB = "processor-db"
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
index 6f2b9bae7..f8dea9871 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactory.kt
@@ -35,7 +35,7 @@ object ResourceSourceMappingFactory {
fun getRegisterSourceMapping(sourceInstance: String): String {
return resourceSourceMappings[sourceInstance]
- ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance))
+ ?: throw BluePrintException(format("failed to get source({}) mapping", sourceInstance))
}
fun getRegisterSourceMapping(): ResourceSourceMapping {
@@ -44,4 +44,3 @@ object ResourceSourceMappingFactory {
return resourceSourceMapping
}
}
-
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
index 08b9d0560..a5171d25c 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
@@ -17,13 +17,13 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.service
-import org.slf4j.LoggerFactory
import org.apache.commons.collections.CollectionUtils
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.text.StrBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
+import org.slf4j.LoggerFactory
import java.io.Serializable
/**
@@ -43,7 +43,8 @@ interface ResourceAssignmentValidationService : Serializable {
* @author Brinda Santh
*/
open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidationService {
- private val log= LoggerFactory.getLogger(ResourceAssignmentValidationServiceImpl::class.java)
+
+ private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceImpl::class.java)
open var resourceAssignmentMap: Map<String, ResourceAssignment> = hashMapOf()
open val validationMessage = StrBuilder()
@@ -61,15 +62,14 @@ open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidatio
return true
}
-
open fun validateTemplateNDictionaryKeys(resourceAssignments: List<ResourceAssignment>) {
resourceAssignmentMap = resourceAssignments.map { it.name to it }.toMap()
// Check the Resource Assignment has Duplicate Key Names
val duplicateKeyNames = resourceAssignments.groupBy { it.name }
- .filter { it.value.size > 1 }
- .map { it.key }
+ .filter { it.value.size > 1 }
+ .map { it.key }
if (duplicateKeyNames.isNotEmpty()) {
validationMessage.appendln(String.format("Duplicate Assignment Template Keys (%s) is Present", duplicateKeyNames))
@@ -120,21 +120,23 @@ open class ResourceAssignmentValidationServiceImpl : ResourceAssignmentValidatio
if (v.name == "*") {
s.append("\n * -> [")
for (resourceAssignment in vs) {
- s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name
- + "),")
+ s.append(
+ "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name +
+ "),"
+ )
}
s.append("]")
} else {
s.append("\n (" + v.dictionaryName + ":" + v.name + ") -> [")
for (resourceAssignment in vs) {
- s.append("(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name
- + "),")
+ s.append(
+ "(" + resourceAssignment.dictionaryName + ":" + resourceAssignment.name +
+ "),"
+ )
}
s.append("]")
}
}
return s.toString()
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
index cd887bf54..9a5523113 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
@@ -21,7 +21,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString
import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.slf4j.LoggerFactory
-import java.util.*
+import java.util.ArrayList
/**
* BulkResourceSequencingUtils.
@@ -29,6 +29,7 @@ import java.util.*
* @author Brinda Santh
*/
object BulkResourceSequencingUtils {
+
private val log = LoggerFactory.getLogger(BulkResourceSequencingUtils::class.java)
@JvmStatic
@@ -83,12 +84,15 @@ object BulkResourceSequencingUtils {
dependencyPresence = CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.dependencies)
}
- log.trace("({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name,
- batchAssignmentName, resourceAssignment.dependencies, dependencyPresence)
+ log.trace(
+ "({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.name,
+ batchAssignmentName, resourceAssignment.dependencies, dependencyPresence
+ )
- if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null
- && resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true)
- && !dependencyPresence) {
+ if (previousResourceAssignment != null && resourceAssignment.dictionarySource != null &&
+ resourceAssignment.dictionarySource!!.equals(previousResourceAssignment.dictionarySource, true) &&
+ !dependencyPresence
+ ) {
batchResourceAssignment!!.add(resourceAssignment)
batchAssignmentName!!.add(resourceAssignment.name)
} else {
@@ -112,5 +116,4 @@ object BulkResourceSequencingUtils {
return sequenceBatchResourceAssignment
}
-
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
index cd5470953..f26c5098f 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils
-import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
import org.apache.commons.collections.MapUtils
@@ -29,15 +28,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants
+import org.slf4j.LoggerFactory
import java.io.File
-
object ResourceDictionaryUtils {
- private val log= LoggerFactory.getLogger(ResourceDictionaryUtils::class.java)
+ private val log = LoggerFactory.getLogger(ResourceDictionaryUtils::class.java)
@JvmStatic
- fun populateSourceMapping(resourceAssignment: ResourceAssignment,
- resourceDefinition: ResourceDefinition) {
+ fun populateSourceMapping(
+ resourceAssignment: ResourceAssignment,
+ resourceDefinition: ResourceDefinition
+ ) {
if (StringUtils.isBlank(resourceAssignment.dictionarySource)) {
@@ -81,19 +82,18 @@ object ResourceDictionaryUtils {
fun getResourceAssignmentFromFile(filePath: String): List<ResourceAssignment> {
return JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
+ ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
}
fun writeResourceDefinitionTypes(basePath: String, resourceDefinitions: List<ResourceDefinition>) {
val resourceDefinitionMap = resourceDefinitions.map { it.name to it }.toMap()
writeResourceDefinitionTypes(basePath, resourceDefinitionMap)
-
}
fun writeResourceDefinitionTypes(basePath: String, resourceDefinitionMap: Map<String, ResourceDefinition>) {
val typePath = basePath.plus(File.separator).plus(BluePrintConstants.TOSCA_DEFINITIONS_DIR)
- .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
+ .plus(File.separator).plus("${ResourceDictionaryConstants.PATH_RESOURCE_DEFINITION_TYPE}.json")
val resourceDefinitionContent = JacksonUtils.getJson(resourceDefinitionMap.toSortedMap(), true)
BluePrintFileUtils.writeDefinitionFile(typePath, resourceDefinitionContent)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
index fd38db0bf..b8e1d519b 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinitionTest.java
@@ -25,10 +25,10 @@ import org.slf4j.LoggerFactory;
public class ResourceDefinitionTest {
private Logger log = LoggerFactory.getLogger(ResourceDefinitionTest.class);
- private String basePath = "./../../../../components/model-catalog/resource-dictionary/starter-dictionary";
+ private String basePath = "./../../../../../components/model-catalog/resource-dictionary/starter-dictionary";
@Test
- public void testDictionaryDefinitionInputSource(){
+ public void testDictionaryDefinitionInputSource() {
String fileName = basePath + "/input-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
@@ -36,7 +36,7 @@ public class ResourceDefinitionTest {
}
@Test
- public void testDictionaryDefinitionDefaultSource(){
+ public void testDictionaryDefinitionDefaultSource() {
String fileName = basePath + "/default-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
@@ -44,7 +44,7 @@ public class ResourceDefinitionTest {
}
@Test
- public void testDictionaryDefinitionDBSource(){
+ public void testDictionaryDefinitionDBSource() {
String fileName = basePath + "/db-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
@@ -52,9 +52,10 @@ public class ResourceDefinitionTest {
}
@Test
- public void testDictionaryDefinitionMDSALSource(){
+ public void testDictionaryDefinitionMDSALSource() {
String fileName = basePath + "/mdsal-source.json";
ResourceDefinition resourceDefinition = JacksonUtils.Companion.readValueFromFile(fileName, ResourceDefinition.class);
Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", resourceDefinition);
}
+
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
index eae944ad9..eae944ad9 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/factory/ResourceSourceMappingFactoryTest.java
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
index b891f9ec6..77af5dbe0 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/service/ResourceAssignmentValidationServiceTest.kt
@@ -17,11 +17,11 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.service
import org.junit.Assert
+import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
-import org.junit.Before
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryTestUtils
import org.slf4j.LoggerFactory
@@ -31,6 +31,7 @@ import org.slf4j.LoggerFactory
* @author Brinda Santh
*/
class ResourceAssignmentValidationServiceTest {
+
private val log = LoggerFactory.getLogger(ResourceAssignmentValidationServiceTest::class.java)
@Before
fun setUp() {
@@ -62,4 +63,4 @@ class ResourceAssignmentValidationServiceTest {
val resourceAssignmentValidator = ResourceAssignmentValidationServiceImpl()
resourceAssignmentValidator.validate(assignments!!)
}
-} \ No newline at end of file
+}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
index 3413868ee..30b4d4544 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtilsTest.java
@@ -20,7 +20,9 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils;
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment;
+
import java.util.List;
+
/**
* BulkResourceSequencingUtils.
*
@@ -29,9 +31,10 @@ import java.util.List;
public class BulkResourceSequencingUtilsTest {
@Test
- public void testProcess(){
+ public void testProcess() {
List<ResourceAssignment> assignments = JacksonUtils.Companion.getListFromClassPathFile("validation/success.json", ResourceAssignment.class);
Assert.assertNotNull("failed to get ResourceAssignment from validation/success.json ", assignments);
BulkResourceSequencingUtils.process(assignments);
}
+
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
index 16b02d86c..8004d2ca2 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/java/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryUtilsTest.java
@@ -56,7 +56,9 @@ public class ResourceDictionaryUtilsTest {
resourceAssignment.setDictionarySource(null);
sources.put(ResourceDictionaryConstants.SOURCE_DEFAULT, new NodeTemplate());
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, resourceDefinition);
- Assert.assertEquals("Expected First source Default, but.", ResourceDictionaryConstants.SOURCE_DEFAULT, resourceAssignment.getDictionarySource());
+ Assert.assertEquals("Expected First source Default, but.",
+ ResourceDictionaryConstants.SOURCE_DEFAULT,
+ resourceAssignment.getDictionarySource());
// To Check Assigned Source
resourceAssignment.setDictionarySource(ResourceDictionaryConstants.PROCESSOR_DB);
@@ -91,9 +93,8 @@ public class ResourceDictionaryUtilsTest {
ResourceDictionaryUtils.assignInputs(data, context);
String path = BluePrintConstants.PATH_INPUTS.concat(BluePrintConstants.PATH_DIVIDER).concat("mapValue");
log.info("populated context {}", context);
- Assert.assertTrue(String.format("failed to get variable : %s",path),context.containsKey(path));
+ Assert.assertTrue(String.format("failed to get variable : %s", path), context.containsKey(path));
}
-
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
index 639ed05d3..639ed05d3 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/ResourceDictionaryTestUtils.kt
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/data/resource-assignment-input.json
index d79c90682..d79c90682 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/data/resource-assignment-input.json
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/data/resource-assignment-input.json
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/cyclic.json
index f58c7a705..f58c7a705 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/cyclic.json
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/cyclic.json
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/duplicate.json
index 13a4c9f3e..13a4c9f3e 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/duplicate.json
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/duplicate.json
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/success.json
index 79925bfac..79925bfac 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/test/resources/validation/success.json
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/test/resources/validation/success.json
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
index f444fde66..f11deb44c 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/pom.xml
@@ -32,12 +32,12 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-validation</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
index a7ad921de..0d737f4ca 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibConfiguration.kt
@@ -16,47 +16,62 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertySevice
-import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.BluePrintDBLibPropertyService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
+import javax.sql.DataSource
@Configuration
+@Import(
+ BluePrintPropertyConfiguration::class,
+ BluePrintPropertiesService::class,
+ BluePrintCoreConfiguration::class
+)
@EnableConfigurationProperties
open class BluePrintDBLibConfiguration(private var bluePrintPropertiesService: BluePrintPropertiesService) {
@Bean("primary-database-properties")
open fun getPrimaryProperties(): PrimaryDataSourceProperties {
- return bluePrintPropertiesService.propertyBeanType(DBLibConstants.PREFIX_DB,
- PrimaryDataSourceProperties::class.java)
+ return bluePrintPropertiesService.propertyBeanType(
+ DBLibConstants.PREFIX_DB,
+ PrimaryDataSourceProperties::class.java
+ )
+ }
+
+ @Bean("primaryNamedParameterJdbcTemplate")
+ open fun primaryNamedParameterJdbcTemplate(primaryDataSource: DataSource): NamedParameterJdbcTemplate {
+ return NamedParameterJdbcTemplate(primaryDataSource)
}
}
/**
* Exposed Dependency Service by this SSH Lib Module
*/
-fun BluePrintDependencyService.dbLibPropertyService(): BluePrintDBLibPropertySevice =
- instance(BluePrintDBLibPropertySevice::class)
+fun BluePrintDependencyService.dbLibPropertyService(): BluePrintDBLibPropertyService =
+ instance(BluePrintDBLibPropertyService::class)
fun BluePrintDependencyService.primaryDBLibGenericService(): BluePrintDBLibGenericService =
- instance(PrimaryDBLibGenericService::class)
-
+ instance(PrimaryDBLibGenericService::class)
class DBLibConstants {
companion object {
const val PREFIX_DB: String = "blueprintsprocessor.db"
- //list of database
+ // list of database
const val MARIA_DB: String = "maria-db"
const val PRIMARY_DB: String = "processor-db"
const val MYSQL_DB: String = "mysql-db"
const val ORACLE_DB: String = "oracle-db"
const val POSTGRES_DB: String = "postgres-db"
- //List of database drivers
+ // List of database drivers
const val DRIVER_MARIA_DB = "org.mariadb.jdbc.Driver"
const val DRIVER_MYSQL_DB = "com.mysql.jdbc.Driver"
const val DRIVER_ORACLE_DB = "oracle.jdbc.driver.OracleDriver"
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
index fc43ce34d..d4d804857 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibData.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db
-
open class DBDataSourceProperties {
lateinit var url: String
lateinit var username: String
@@ -24,14 +23,14 @@ open class DBDataSourceProperties {
open lateinit var driverClassName: String
}
-open class PrimaryDataSourceProperties: DBDataSourceProperties() {
+open class PrimaryDataSourceProperties : DBDataSourceProperties() {
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
lateinit var hibernateDialect: String
}
-open class MariaDataSourceProperties: DBDataSourceProperties() {
+open class MariaDataSourceProperties : DBDataSourceProperties() {
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
@@ -40,7 +39,7 @@ open class MariaDataSourceProperties: DBDataSourceProperties() {
override var driverClassName = DBLibConstants.DRIVER_MARIA_DB
}
-open class MySqlDataSourceProperties: DBDataSourceProperties() {
+open class MySqlDataSourceProperties : DBDataSourceProperties() {
lateinit var hibernateHbm2ddlAuto: String
lateinit var hibernateDDLAuto: String
lateinit var hibernateNamingStrategy: String
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibGenericService.kt
index 0f6314685..aeb87fd66 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibGenericService.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BluePrintDBLibGenericService.kt
@@ -27,8 +27,8 @@ interface BluePrintDBLibGenericService {
fun update(sql: String, params: Map<String, Any>): Int
}
-abstract class AbstractDBLibGenericService(private val namedParameterJdbcTemplate: NamedParameterJdbcTemplate)
- : BluePrintDBLibGenericService {
+abstract class AbstractDBLibGenericService(private val namedParameterJdbcTemplate: NamedParameterJdbcTemplate) :
+ BluePrintDBLibGenericService {
override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
return namedParameterJdbcTemplate
@@ -41,4 +41,4 @@ abstract class AbstractDBLibGenericService(private val namedParameterJdbcTemplat
override fun update(sql: String, params: Map<String, Any>): Int {
return namedParameterJdbcTemplate.update(sql, params)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/PrimaryDBLibGenericService.kt
index 896929fbb..006b7ca45 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDBLibGenericService.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/PrimaryDBLibGenericService.kt
@@ -1,5 +1,5 @@
/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Copyright © 2018-2019 AT&T Intellectual Property.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,14 +14,11 @@
* limitations under the License.
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
+package org.onap.ccsdk.cds.blueprintsprocessor.db
-import org.onap.ccsdk.cds.blueprintsprocessor.db.AbstractDBLibGenericService
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
import org.springframework.stereotype.Service
@Service
-open class PrimaryDBLibGenericService(primaryNamedParameterJdbcTemplate: NamedParameterJdbcTemplate)
- : AbstractDBLibGenericService(primaryNamedParameterJdbcTemplate) {
-
-} \ No newline at end of file
+open class PrimaryDBLibGenericService(primaryNamedParameterJdbcTemplate: NamedParameterJdbcTemplate) :
+ AbstractDBLibGenericService(primaryNamedParameterJdbcTemplate)
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
index ff53de89f..35baf9314 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/BluePrintDBLibPropertyService.kt
@@ -18,13 +18,18 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.db.*
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibGenericService
+import org.onap.ccsdk.cds.blueprintsprocessor.db.DBDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.DBLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.db.MariaDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.MySqlDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.stereotype.Service
@Service
-class BluePrintDBLibPropertySevice(private var bluePrintPropertiesService: BluePrintPropertiesService) {
+class BluePrintDBLibPropertyService(private var bluePrintPropertiesService: BluePrintPropertiesService) {
fun JdbcTemplate(jsonNode: JsonNode): BluePrintDBLibGenericService {
val dBConnetionProperties = dBDataSourceProperties(jsonNode)
@@ -101,5 +106,4 @@ class BluePrintDBLibPropertySevice(private var bluePrintPropertiesService: BlueP
private fun primaryDBConnectionProperties(prefix: String): PrimaryDataSourceProperties {
return bluePrintPropertiesService.propertyBeanType(prefix, PrimaryDataSourceProperties::class.java)
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt
index 6a0d4a0c5..82895257a 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MariaDatabaseConfiguration.kt
@@ -25,6 +25,8 @@ import javax.sql.DataSource
class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDataSourceProperties) : BluePrintDBLibGenericService {
+ val log = LoggerFactory.getLogger(MariaDatabaseConfiguration::class.java)!!
+
override fun namedParameterJdbcTemplate(): NamedParameterJdbcTemplate {
return mariaNamedParameterJdbcTemplate(mariaDataSource())
}
@@ -37,8 +39,6 @@ class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDat
return mariaNamedParameterJdbcTemplate(mariaDataSource()).update(sql, params)
}
- val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
-
fun mariaDataSource(): DataSource {
val dataSource = DriverManagerDataSource()
dataSource.setDriverClassName(mariaDataSourceProperties.driverClassName)
@@ -51,4 +51,4 @@ class MariaDatabaseConfiguration(private val mariaDataSourceProperties: MariaDat
fun mariaNamedParameterJdbcTemplate(mariaDataSource: DataSource): NamedParameterJdbcTemplate {
return NamedParameterJdbcTemplate(mariaDataSource)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
index 3091674f0..49b7ec9eb 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/MySqlDatabaseConfiguration.kt
@@ -50,6 +50,4 @@ class MySqlDatabaseConfiguration(private val mySqlDataSourceProperties: MySqlDat
fun mySqlNamedParameterJdbcTemplate(mySqlDataSource: DataSource): NamedParameterJdbcTemplate {
return NamedParameterJdbcTemplate(mySqlDataSource)
}
-
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
index 82b77da47..0913a0a58 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfiguration.kt
@@ -18,41 +18,23 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
import org.slf4j.LoggerFactory
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
-import org.springframework.data.jpa.repository.config.EnableJpaAuditing
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
import org.springframework.jdbc.datasource.DriverManagerDataSource
import org.springframework.orm.jpa.JpaTransactionManager
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
import org.springframework.transaction.PlatformTransactionManager
-import java.util.*
+import java.util.HashMap
import javax.sql.DataSource
-@Configuration
-@ConditionalOnProperty(name = ["blueprintsprocessor.db.primary.defaultConfig"], havingValue = "true",
- matchIfMissing = true)
-@ComponentScan
-@EnableJpaRepositories(
- basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.*",
- "org.onap.ccsdk.cds.controllerblueprints.*"],
- entityManagerFactoryRef = "primaryEntityManager",
- transactionManagerRef = "primaryTransactionManager"
-)
-@EnableJpaAuditing
open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties: PrimaryDataSourceProperties) {
+
private val log = LoggerFactory.getLogger(PrimaryDatabaseConfiguration::class.java)!!
- @Bean("primaryEntityManager")
- open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ /** Child class will override with spring bean annotation 'primaryEntityManager' and passing entity [packagesToScan]*/
+ open fun primaryEntityManager(vararg packagesToScan: String): LocalContainerEntityManagerFactoryBean {
val em = LocalContainerEntityManagerFactoryBean()
em.dataSource = primaryDataSource()
- em.setPackagesToScan("org.onap.ccsdk.cds.blueprintsprocessor.*",
- "org.onap.ccsdk.cds.controllerblueprints.*")
+ em.setPackagesToScan(*packagesToScan)
em.jpaVendorAdapter = HibernateJpaVendorAdapter()
val properties = HashMap<String, Any>()
properties["hibernate.hbm2ddl.auto"] = primaryDataSourceProperties.hibernateHbm2ddlAuto
@@ -61,7 +43,7 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties:
return em
}
- @Bean("primaryDataSource")
+ /** Child class will override with spring bean annotation 'primaryDataSource' */
open fun primaryDataSource(): DataSource {
val dataSource = DriverManagerDataSource()
dataSource.setDriverClassName(primaryDataSourceProperties.driverClassName)
@@ -71,17 +53,11 @@ open class PrimaryDatabaseConfiguration(private val primaryDataSourceProperties:
return dataSource
}
- @Bean("primaryTransactionManager")
+ /** Child class will override with spring bean annotation 'primaryTransactionManager' */
open fun primaryTransactionManager(): PlatformTransactionManager {
val transactionManager = JpaTransactionManager()
transactionManager.entityManagerFactory = primaryEntityManager().getObject()
log.info("Initialised Primary Transaction Manager for url ${primaryDataSourceProperties.url}")
return transactionManager
}
-
- @Bean("primaryNamedParameterJdbcTemplate")
- open fun primaryNamedParameterJdbcTemplate(primaryDataSource: DataSource): NamedParameterJdbcTemplate {
- return NamedParameterJdbcTemplate(primaryDataSource)
- }
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
index 74a611fbb..43bcb6741 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModel.kt
@@ -22,8 +22,19 @@ import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.CascadeType
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.FetchType
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.OneToOne
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
+import javax.persistence.UniqueConstraint
/**
* Provide BlueprintModel Entity
@@ -37,6 +48,7 @@ import javax.persistence.*
@Table(name = "BLUEPRINT_MODEL", uniqueConstraints = [UniqueConstraint(columnNames = ["artifact_name", "artifact_version"])])
@Proxy(lazy = false)
class BlueprintModel : Serializable {
+
@Id
@Column(name = "blueprint_model_id")
var id: String? = null
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
index bed6e4e38..a18ae8b1d 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelContent.kt
@@ -21,8 +21,18 @@ import io.swagger.annotations.ApiModelProperty
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import java.util.Objects
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.JoinColumn
+import javax.persistence.Lob
+import javax.persistence.OneToOne
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
/**
* Provide Blueprint Model Content Entity
@@ -82,8 +92,8 @@ class BlueprintModelContent : Serializable {
return false
}
val blueprintModelContent = o as BlueprintModelContent?
- return (id == blueprintModelContent!!.id && name == blueprintModelContent.name
- && contentType == blueprintModelContent.contentType)
+ return (id == blueprintModelContent!!.id && name == blueprintModelContent.name &&
+ contentType == blueprintModelContent.contentType)
}
override fun hashCode(): Int {
@@ -94,5 +104,4 @@ class BlueprintModelContent : Serializable {
private const val serialVersionUID = 1L
}
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
index f47124dd0..b1c006793 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/domain/BlueprintModelSearch.kt
@@ -21,8 +21,14 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.annotation.JsonTypeName
import org.springframework.data.annotation.LastModifiedDate
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
/**
* Provide Blueprint Model Search Entity
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
index 7bbfbce79..59ace723a 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelContentRepository.kt
@@ -22,7 +22,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
-import java.util.*
+import java.util.Optional
/**
* @param <T> Model
@@ -47,8 +47,8 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @param contentType contentType
* @return B?
*/
- fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String)
- : BlueprintModelContent?
+ fun findTopByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
+ BlueprintModelContent?
/**
* This is a findByBlueprintModelAndContentType method
@@ -57,8 +57,8 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @param contentType contentType
* @return List<B>
*/
- fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String)
- : List<BlueprintModelContent>
+ fun findByBlueprintModelAndContentType(blueprintModel: BlueprintModel, contentType: String):
+ List<BlueprintModelContent>
/**
* This is a findByBlueprintModel method
@@ -76,8 +76,11 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @param name name
* @return B?
*/
- fun findByBlueprintModelAndContentTypeAndName(blueprintModel: BlueprintModel,
- contentType: String, name: String): BlueprintModelContent?
+ fun findByBlueprintModelAndContentTypeAndName(
+ blueprintModel: BlueprintModel,
+ contentType: String,
+ name: String
+ ): BlueprintModelContent?
/**
* This is a deleteByMdeleteByBlueprintModelodelName method
@@ -92,5 +95,4 @@ interface BlueprintModelContentRepository : JpaRepository<BlueprintModelContent,
* @param id id
*/
override fun deleteById(@NotNull id: String)
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt
index 8ef352852..a7891f6a7 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelRepository.kt
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.NotNull
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
-import java.util.*
+import java.util.Optional
import javax.transaction.Transactional
/**
@@ -86,5 +86,4 @@ interface BlueprintModelRepository : JpaRepository<BlueprintModel, String> {
* @param id id
*/
override fun deleteById(@NotNull id: String)
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
index 5c7a94034..4451283cb 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/repository/BlueprintModelSearchRepository.kt
@@ -19,7 +19,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
import org.springframework.data.domain.Page
-import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
@@ -77,9 +76,13 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @return Optional<BlueprintModelSearch>
</BlueprintModelSearch>
*/
- fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(updatedBy: String, tags: String, artifactName: String, artifactVersion: String,
- artifactType: String): List<BlueprintModelSearch>
-
+ fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
+ updatedBy: String,
+ tags: String,
+ artifactName: String,
+ artifactVersion: String,
+ artifactType: String
+ ): List<BlueprintModelSearch>
/**
* This is a findby some attributes method
@@ -94,10 +97,12 @@ interface BlueprintModelSearchRepository : JpaRepository<BlueprintModelSearch, L
* @param pageRequest
* @return Page<BlueprintModelSearch>
*/
- fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(updatedBy: String, tags: String, artifactName: String, artifactVersion: String,
- artifactType: String,pageRequest: Pageable): Page<BlueprintModelSearch>
-
-
-
-
+ fun findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
+ updatedBy: String,
+ tags: String,
+ artifactName: String,
+ artifactVersion: String,
+ artifactType: String,
+ pageRequest: Pageable
+ ): Page<BlueprintModelSearch>
}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintCatalogServiceImpl.kt
index 5700c2a46..9d1826395 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintCatalogServiceImpl.kt
@@ -18,10 +18,14 @@
package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.deCompress
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
@@ -31,8 +35,9 @@ import javax.persistence.MappedSuperclass
@MappedSuperclass
abstract class BlueprintCatalogServiceImpl(
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintValidator: BluePrintValidatorService) : BluePrintCatalogService {
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val blueprintValidator: BluePrintValidatorService
+) : BluePrintCatalogService {
private val log = LoggerFactory.getLogger(BlueprintCatalogServiceImpl::class.java)!!
@@ -74,14 +79,15 @@ abstract class BlueprintCatalogServiceImpl(
return processingId
}
- override suspend fun getFromDatabase(name: String, version: String, extract: Boolean): Path = get(name, version,
- extract)
- ?: throw BluePrintException("Could not find blueprint $name:$version from database")
+ override suspend fun getFromDatabase(name: String, version: String, extract: Boolean): Path = get(
+ name, version,
+ extract
+ )
+ ?: throw BluePrintException("Could not find blueprint $name:$version from database")
override suspend fun deleteFromDatabase(name: String, version: String) = delete(name, version)
abstract suspend fun save(metadata: MutableMap<String, String>, archiveFile: File)
abstract suspend fun get(name: String, version: String, extract: Boolean): Path?
abstract suspend fun delete(name: String, version: String)
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
index 3ba25d8de..0c407ecdf 100755
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/service/BlueprintProcessorCatalogServiceImpl.kt
@@ -21,11 +21,18 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary.service
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModel
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelContent
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintModelRepository
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.common.ApplicationConstants
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
+import org.onap.ccsdk.cds.controllerblueprints.core.deCompress
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.reCreateNBDirs
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.slf4j.LoggerFactory
@@ -33,24 +40,26 @@ import org.springframework.dao.DataIntegrityViolationException
import org.springframework.stereotype.Service
import java.io.File
import java.nio.file.Path
-import java.util.*
+import java.util.UUID
// TODO("Duplicate : Merge BlueprintProcessorCatalogServiceImpl and ControllerBlueprintCatalogServiceImpl")
/**
* Similar/Duplicate implementation in [org.onap.ccsdk.cds.controllerblueprints.service.load.ControllerBlueprintCatalogServiceImpl]
*/
@Service("blueprintsProcessorCatalogService")
-class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: BluePrintValidatorService,
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintModelRepository: BlueprintModelRepository)
- : BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintRuntimeValidatorService) {
+class BlueprintProcessorCatalogServiceImpl(
+ bluePrintRuntimeValidatorService: BluePrintValidatorService,
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val blueprintModelRepository: BlueprintModelRepository
+) :
+ BlueprintCatalogServiceImpl(bluePrintLoadConfiguration, bluePrintRuntimeValidatorService) {
private val log = LoggerFactory.getLogger(BlueprintProcessorCatalogServiceImpl::class.toString())
override suspend fun delete(name: String, version: String) {
// Clean blueprint script cache
val cacheKey = BluePrintFileUtils
- .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, name, version))
+ .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, name, version))
BluePrintCompileCache.cleanClassLoader(cacheKey)
log.info("removed cba file name($name), version($version) from cache")
// Cleaning Deployed Blueprint
@@ -58,16 +67,17 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
log.info("removed cba file name($name), version($version) from deploy location")
// Cleaning Data Base
blueprintModelRepository
- .deleteByArtifactNameAndArtifactVersion(name, version)
+ .deleteByArtifactNameAndArtifactVersion(name, version)
log.info("removed cba file name($name), version($version) from database")
}
-
override suspend fun get(name: String, version: String, extract: Boolean): Path? {
val deployFile = normalizedFile(bluePrintLoadConfiguration.blueprintDeployPath, name, version)
- val cbaFile = normalizedFile(bluePrintLoadConfiguration.blueprintArchivePath,
- UUID.randomUUID().toString(), "cba.zip")
+ val cbaFile = normalizedFile(
+ bluePrintLoadConfiguration.blueprintArchivePath,
+ UUID.randomUUID().toString(), "cba.zip"
+ )
if (extract && deployFile.exists()) {
log.info("cba file name($name), version($version) already present(${deployFile.absolutePath})")
@@ -91,8 +101,10 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
}
} catch (e: Exception) {
deleteNBDir(deployFile.absolutePath)
- throw BluePrintProcessorException("failed to get get cba file name($name), version($version) from db" +
- " : ${e.message}")
+ throw BluePrintProcessorException(
+ "failed to get get cba file name($name), version($version) from db" +
+ " : ${e.message}"
+ )
} finally {
deleteNBDir(cbaFile.parentFile.absolutePath)
}
@@ -117,7 +129,7 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
log.info("Overwriting blueprint model :$artifactName::$artifactVersion")
blueprintModelRepository.deleteByArtifactNameAndArtifactVersion(artifactName, artifactVersion)
val deployFile =
- normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, artifactName, artifactVersion)
+ normalizedPathName(bluePrintLoadConfiguration.blueprintDeployPath, artifactName, artifactVersion)
val cacheKey = BluePrintFileUtils.compileCacheKey(deployFile)
BluePrintCompileCache.cleanClassLoader(cacheKey)
@@ -132,7 +144,7 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
blueprintModel.id = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_PROCESS_ID]
blueprintModel.artifactType = ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL
blueprintModel.published = metadata[BluePrintConstants.PROPERTY_BLUEPRINT_VALID]
- ?: BluePrintConstants.FLAG_N
+ ?: BluePrintConstants.FLAG_N
blueprintModel.artifactName = artifactName
blueprintModel.artifactVersion = artifactVersion
blueprintModel.updatedBy = metadata[BluePrintConstants.METADATA_TEMPLATE_AUTHOR]!!
@@ -152,8 +164,10 @@ class BlueprintProcessorCatalogServiceImpl(bluePrintRuntimeValidatorService: Blu
try {
blueprintModelRepository.saveAndFlush(blueprintModel)
} catch (ex: DataIntegrityViolationException) {
- throw BluePrintException(ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " +
- "is already exist in database: ${ex.message}", ex)
+ throw BluePrintException(
+ ErrorCode.CONFLICT_ADDING_RESOURCE.value, "The blueprint entry " +
+ "is already exist in database: ${ex.message}", ex
+ )
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
index d912d8eae..e86dfab72 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/BlueprintProcessorCatalogServiceImplTest.kt
@@ -43,8 +43,10 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@EnableAutoConfiguration
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor"])
-@ContextConfiguration(classes = [BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
- MockBlueprintProcessorCatalogServiceImpl::class])
+@ContextConfiguration(
+ classes = [BlueprintProcessorCatalogServiceImpl::class, BluePrintCoreConfiguration::class,
+ MockBlueprintProcessorCatalogServiceImpl::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BlueprintProcessorCatalogServiceImplTest {
@@ -61,8 +63,10 @@ class BlueprintProcessorCatalogServiceImplTest {
@BeforeTest
fun setup() {
deleteDir("target", "blueprints")
- bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(blueprintId,
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ blueprintId,
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
}
@AfterTest
@@ -72,9 +76,9 @@ class BlueprintProcessorCatalogServiceImplTest {
@Test
fun `test catalog service`() {
- //TODO: I thing this test function should be remve and replace by the other one.
+ // TODO: I thing this test function should be remve and replace by the other one.
runBlocking {
- //FIXME("Create ZIP from test blueprints")
+ // FIXME("Create ZIP from test blueprints")
val file = normalizedFile("./src/test/resources/test-cba.zip")
assertTrue(file.exists(), "couldn't get file ${file.absolutePath}")
@@ -110,10 +114,14 @@ class BlueprintProcessorCatalogServiceImplTest {
blueprintsProcessorCatalogService.get("baseconfiguration", "1.0.0", true)
}
- assertTrue(File(blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath +
- "/baseconfiguration").deleteRecursively(),"Couldn't get blueprint archive " +
- "${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " +
- "from data base.")
+ assertTrue(
+ File(
+ blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath +
+ "/baseconfiguration"
+ ).deleteRecursively(), "Couldn't get blueprint archive " +
+ "${blueprintCoreConfiguration.bluePrintLoadConfiguration().blueprintArchivePath}/baseconfiguration " +
+ "from data base."
+ )
}
@Test
@@ -122,4 +130,4 @@ class BlueprintProcessorCatalogServiceImplTest {
blueprintsProcessorCatalogService.delete("baseconfiguration", "1.0.0")
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..d8192acfa
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/TestDatabaseConfiguration.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.db
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager("org.onap.ccsdk.cds.blueprintsprocessor.db.primary.*")
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt
index b98fc0c44..8dcf42668 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/mock/MockBlueprintProcessorCatalogServiceImpl.kt
@@ -32,4 +32,4 @@ open class MockBlueprintProcessorCatalogServiceImpl {
every { bluePrintValidatorService.validateBluePrints(any<BluePrintRuntimeService<*>>()) } returns true
return bluePrintValidatorService
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
index 2ab1c5d48..d551fee0d 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/db/primary/PrimaryDatabaseConfigurationTest.kt
@@ -18,13 +18,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.db.primary
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.TestDatabaseConfiguration
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@@ -32,11 +27,10 @@ import javax.sql.DataSource
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class,
- BluePrintDBLibConfiguration::class, BluePrintLoadConfiguration::class])
+@ContextConfiguration(
+ classes = [TestDatabaseConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
-@EnableAutoConfiguration
class PrimaryDatabaseConfigurationTest {
@Autowired
@@ -46,4 +40,4 @@ class PrimaryDatabaseConfigurationTest {
fun testPrimaryDatabaseConfiguration() {
assertNotNull(primaryDataSource, " failed to create primary data source")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
index 124e844cb..4345d6e63 100644
--- a/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
+++ b/ms/blueprintsprocessor/modules/commons/db-lib/src/test/resources/application-test.properties
@@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-blueprintsprocessor.db.primary.defaultConfig=true
blueprintsprocessor.db.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1
blueprintsprocessor.db.username=sa
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
index 2dbea8fc9..8ccd8cd56 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/AafAuthDmaapClientService.kt
@@ -27,16 +27,17 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
/**
* Representation of DMAAP client service for AAF auth type.
*/
-class AafAuthDmaapClientService(private val clientProps:
- AafAuthDmaapClientProperties)
- : BluePrintDmaapClientService {
+class AafAuthDmaapClientService(
+ private val clientProps:
+ AafAuthDmaapClientProperties
+) :
+ BluePrintDmaapClientService {
/**
* The constructed DMAAP client.
*/
var clients: MutableList<MRBatchingPublisher> = mutableListOf()
-
/**
* Returns the DMAAP client after constructing it properly with the data
* that is required for AAF auth connection.
@@ -52,12 +53,12 @@ class AafAuthDmaapClientService(private val clientProps:
val client = MRClientFactory.createBatchingPublisher(
clientProps.host, t, clientProps.username,
clientProps.password, 1, 1, false,
- clientProps.type, "")
+ clientProps.type, ""
+ )
val batchPublisher = client as MRSimplerBatchPublisher
batchPublisher.props = clientProps.props
clients.add(client)
}
return clients
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
index a4cb5a3e6..cbde4d003 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapClientService.kt
@@ -26,7 +26,6 @@ import org.slf4j.LoggerFactory
import java.io.IOException
import java.util.concurrent.TimeUnit
-
/**
* Abstraction of DMAAP client services that could form DMAAP client from the
* properties provided. This abstraction also provides a mechanism to send
@@ -38,14 +37,16 @@ interface BluePrintDmaapClientService {
* Static variable for logging.
*/
companion object {
+
var log = LoggerFactory.getLogger(
- BluePrintDmaapClientService::class.java)!!
+ BluePrintDmaapClientService::class.java
+ )!!
}
/**
* Returns the properly constructed DMAAP client with the type.
*/
- fun getDmaapClient(): MutableList<MRBatchingPublisher>
+ fun getDmaapClient(): MutableList<MRBatchingPublisher>
/**
* Sends messages to the sessions created by the information provided from
@@ -93,8 +94,10 @@ interface BluePrintDmaapClientService {
var ms = client.close(timeout, TimeUnit.SECONDS)
msgs.add(ms)
} catch (e: IOException) {
- log.warn("Unable to cleanly close the connection from the " +
- "client $client", e)
+ log.warn(
+ "Unable to cleanly close the connection from the " +
+ "client $client", e
+ )
}
}
return msgs
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
index 51cd3bf0a..44ed5316b 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibConfiguration.kt
@@ -37,10 +37,11 @@ open class BluePrintDmaapLibConfiguration
* Util constants required for DMAAP library to use.
*/
class DmaapLibConstants {
+
companion object {
const val SERVICE_BLUEPRINT_DMAAP_LIB_PROPERTY = "blueprint" +
"-dmaap-lib-property-service"
const val TYPE_HTTP_NO_AUTH = "HTTPNOAUTH"
const val TYPE_HTTP_AAF_AUTH = "HTTPAAF"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
index cde4987ff..a3eed159f 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/BluePrintDmaapLibPropertyService.kt
@@ -36,7 +36,7 @@ import org.springframework.core.env.ConfigurableEnvironment
import org.springframework.core.env.Environment
import org.springframework.core.io.support.ResourcePropertySource
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.Properties
/**
* Representation of DMAAP lib property service to load the properties
@@ -52,8 +52,10 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
* Static variable for logging.
*/
companion object {
+
var log = LoggerFactory.getLogger(
- BluePrintDmaapLibPropertyService::class.java)!!
+ BluePrintDmaapLibPropertyService::class.java
+ )!!
}
/**
@@ -90,25 +92,30 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
*/
fun dmaapClientProperties(prefix: String): DmaapClientProperties {
val type = bluePrintPropertiesService.propertyBeanType(
- "$prefix.type", String::class.java)
+ "$prefix.type", String::class.java
+ )
val clientProps: DmaapClientProperties
when (type) {
TYPE_HTTP_NO_AUTH -> {
clientProps = bluePrintPropertiesService.propertyBeanType(
- prefix, HttpNoAuthDmaapClientProperties::class.java)
+ prefix, HttpNoAuthDmaapClientProperties::class.java
+ )
clientProps.props = parseEventProps()
}
TYPE_HTTP_AAF_AUTH -> {
clientProps = bluePrintPropertiesService.propertyBeanType(
- prefix, AafAuthDmaapClientProperties::class.java)
+ prefix, AafAuthDmaapClientProperties::class.java
+ )
clientProps.props = parseEventProps()
}
else -> {
- throw BluePrintProcessorException("DMAAP adaptor($type) is " +
- "not supported")
+ throw BluePrintProcessorException(
+ "DMAAP adaptor($type) is " +
+ "not supported"
+ )
}
}
return clientProps
@@ -124,20 +131,26 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
when (type) {
TYPE_HTTP_NO_AUTH -> {
- clientProps = JacksonUtils.readValue(jsonNode,
- HttpNoAuthDmaapClientProperties::class.java)!!
+ clientProps = JacksonUtils.readValue(
+ jsonNode,
+ HttpNoAuthDmaapClientProperties::class.java
+ )!!
clientProps.props = parseEventProps()
}
TYPE_HTTP_AAF_AUTH -> {
- clientProps = JacksonUtils.readValue(jsonNode,
- AafAuthDmaapClientProperties::class.java)!!
+ clientProps = JacksonUtils.readValue(
+ jsonNode,
+ AafAuthDmaapClientProperties::class.java
+ )!!
clientProps.props = parseEventProps()
}
else -> {
- throw BluePrintProcessorException("DMAAP adaptor($type) is " +
- "not supported")
+ throw BluePrintProcessorException(
+ "DMAAP adaptor($type) is " +
+ "not supported"
+ )
}
}
return clientProps
@@ -158,8 +171,10 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
}
else -> {
- throw BluePrintProcessorException("Unable to get the DMAAP " +
- "client")
+ throw BluePrintProcessorException(
+ "Unable to get the DMAAP " +
+ "client"
+ )
}
}
}
@@ -171,7 +186,8 @@ open class BluePrintDmaapLibPropertyService(private var bluePrintPropertiesServi
private fun parseEventProps(): Properties {
val prodProps = Properties()
val proProps = (env as ConfigurableEnvironment).propertySources.get(
- "class path resource [event.properties]")
+ "class path resource [event.properties]"
+ )
if (proProps != null) {
val entries = (proProps as ResourcePropertySource).source.entries
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/DmaapClientProperties.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/DmaapClientProperties.kt
index 9d942943e..aa4c40ae6 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/DmaapClientProperties.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/DmaapClientProperties.kt
@@ -26,6 +26,7 @@ import java.util.Properties
* Representation of data required for all DMAAP client.
*/
open class DmaapClientProperties {
+
lateinit var props: Properties
lateinit var type: String
lateinit var host: String
@@ -41,6 +42,7 @@ open class HttpNoAuthDmaapClientProperties : DmaapClientProperties()
* Representation of data required for AAF auth DMAAP client.
*/
open class AafAuthDmaapClientProperties : DmaapClientProperties() {
+
lateinit var username: String
lateinit var password: String
}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
index 8bf50a944..a3e347adc 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/dmaap/HttpNoAuthDmaapClientService.kt
@@ -27,16 +27,17 @@ import com.att.nsa.mr.client.impl.MRSimplerBatchPublisher
/**
* Representation of DMAAP client service for HTTP no auth type.
*/
-class HttpNoAuthDmaapClientService(private val clientProps:
- HttpNoAuthDmaapClientProperties)
- : BluePrintDmaapClientService {
+class HttpNoAuthDmaapClientService(
+ private val clientProps:
+ HttpNoAuthDmaapClientProperties
+) :
+ BluePrintDmaapClientService {
/**
* The constructed DMAAP client.
*/
var clients: MutableList<MRBatchingPublisher> = mutableListOf()
-
/**
* Returns the DMAAP client after constructing it properly with the data
* that is required for HTTP no auth connection.
@@ -58,5 +59,4 @@ class HttpNoAuthDmaapClientService(private val clientProps:
return clients
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
index 4e91d59f9..3fb7f6802 100644
--- a/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
+++ b/ms/blueprintsprocessor/modules/commons/dmaap-lib/src/test/kotlin/org/ccsdk/cds/blueprintprocessor/dmaap/TestDmaapEventPublisher.kt
@@ -49,19 +49,23 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@ContextConfiguration(classes = [BluePrintDmaapLibConfiguration::class, TestController::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties = ["server.port=9111",
- "blueprintsprocessor.dmaapclient.aai.topic=cds_aai",
- "blueprintsprocessor.dmaapclient.aai.type=HTTPNOAUTH",
- "blueprintsprocessor.dmaapclient.aai.host=127.0.0.1:9111",
- "blueprintsprocessor.dmaapclient.multi.topic=cds_multi1,cds_multi2",
- "blueprintsprocessor.dmaapclient.multi.type=HTTPNOAUTH",
- "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"])
+@ContextConfiguration(
+ classes = [BluePrintDmaapLibConfiguration::class, TestController::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties = ["server.port=9111",
+ "blueprintsprocessor.dmaapclient.aai.topic=cds_aai",
+ "blueprintsprocessor.dmaapclient.aai.type=HTTPNOAUTH",
+ "blueprintsprocessor.dmaapclient.aai.host=127.0.0.1:9111",
+ "blueprintsprocessor.dmaapclient.multi.topic=cds_multi1,cds_multi2",
+ "blueprintsprocessor.dmaapclient.multi.type=HTTPNOAUTH",
+ "blueprintsprocessor.dmaapclient.multi.host=127.0.0.1:9111"]
+)
class TestDmaapEventPublisher {
@Autowired
- lateinit var dmaapService : BluePrintDmaapLibPropertyService
+ lateinit var dmaapService: BluePrintDmaapLibPropertyService
/**
* Tests the event properties being set properly and sent as request.
@@ -71,9 +75,11 @@ class TestDmaapEventPublisher {
val strList = mutableListOf<String>()
val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
+ strList.add(
+ "{\n" +
+ " \"a\" : \"hello\"\n" +
+ "}"
+ )
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
assertEquals(msgs!!.size, 1)
@@ -88,7 +94,7 @@ class TestDmaapEventPublisher {
@Test
fun testEventPropertiesWithSingleMsg() {
val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
- val str : String = "{\n" +
+ val str: String = "{\n" +
" \"a\" : \"hello\"\n" +
"}"
dmaapClient.sendMessage(str)
@@ -106,9 +112,11 @@ class TestDmaapEventPublisher {
val strList = mutableListOf<String>()
val dmaapClient = dmaapService.blueprintDmaapClientService("multi")
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
+ strList.add(
+ "{\n" +
+ " \"a\" : \"hello\"\n" +
+ "}"
+ )
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
assertEquals(msgs!!.size, 2)
@@ -118,7 +126,6 @@ class TestDmaapEventPublisher {
assertEquals(topic2!!.size, 0)
}
-
/**
* Tests the event properties with multiple topics with JSON node as input.
*/
@@ -134,9 +141,11 @@ class TestDmaapEventPublisher {
val strList = mutableListOf<String>()
val dmaapClient = dmaapService.blueprintDmaapClientService(node)
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
+ strList.add(
+ "{\n" +
+ " \"a\" : \"hello\"\n" +
+ "}"
+ )
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
assertEquals(msgs!!.size, 2)
@@ -146,7 +155,6 @@ class TestDmaapEventPublisher {
assertEquals(topic2!!.size, 0)
}
-
/**
* Tests the event properties with multiple messages.
*/
@@ -155,12 +163,16 @@ class TestDmaapEventPublisher {
val strList = mutableListOf<String>()
val dmaapClient = dmaapService.blueprintDmaapClientService("aai")
- strList.add("{\n" +
- " \"a\" : \"hello\"\n" +
- "}")
- strList.add("{\n" +
- " \"a\" : \"second\"\n" +
- "}")
+ strList.add(
+ "{\n" +
+ " \"a\" : \"hello\"\n" +
+ "}"
+ )
+ strList.add(
+ "{\n" +
+ " \"a\" : \"second\"\n" +
+ "}"
+ )
dmaapClient.sendMessage(strList)
val msgs = dmaapClient.close(2)
assertEquals(msgs!!.size, 1)
@@ -174,10 +186,13 @@ class TestDmaapEventPublisher {
@Test
fun testDmaapClientProperties() {
val properties = dmaapService.dmaapClientProperties(
- "blueprintsprocessor.dmaapclient.aai")
+ "blueprintsprocessor.dmaapclient.aai"
+ )
assertNotNull(properties, "failed to create property bean")
- assertNotNull(properties.host, "failed to get url property" +
- " in property bean")
+ assertNotNull(
+ properties.host, "failed to get url property" +
+ " in property bean"
+ )
}
/**
@@ -187,10 +202,11 @@ class TestDmaapEventPublisher {
fun testBlueprintDmaapClientService() {
val blueprintDmaapClientService =
dmaapService.blueprintDmaapClientService("aai")
- assertNotNull(blueprintDmaapClientService,
- "failed to create blueprintDmaapClientService")
+ assertNotNull(
+ blueprintDmaapClientService,
+ "failed to create blueprintDmaapClientService"
+ )
}
-
}
/**
@@ -204,7 +220,7 @@ open class TestController {
* Accepts request for a topic and sends a message as response.
*/
@PostMapping(path = ["/{topic}"])
- fun postTopic(@PathVariable(value = "topic") topic : String):
+ fun postTopic(@PathVariable(value = "topic") topic: String):
ResponseEntity<Any> {
var a = "{\n" +
" \"message\" : \"The message is published into $topic " +
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
index 052b81c29..870e265f6 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/pom.xml
@@ -32,8 +32,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcExtensions.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcExtensions.kt
index 55cf0941d..97b462a3c 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcExtensions.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcExtensions.kt
@@ -24,4 +24,4 @@ fun Metadata.getStringKey(key: String): String? {
fun Metadata.putStringKeyValue(key: String, value: String) {
this.put(Metadata.Key.of(key, Metadata.ASCII_STRING_MARSHALLER), value)
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
index c37c6263a..a3823c6ac 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibConfiguration.kt
@@ -32,7 +32,7 @@ open class BluePrintGrpcLibConfiguration
* Exposed Dependency Service by this GRPC Lib Module
*/
fun BluePrintDependencyService.grpcLibPropertyService(): BluePrintGrpcLibPropertyService =
- instance(GRPCLibConstants.SERVICE_BLUEPRINT_GRPC_LIB_PROPERTY)
+ instance(GRPCLibConstants.SERVICE_BLUEPRINT_GRPC_LIB_PROPERTY)
fun BluePrintDependencyService.grpcClientService(selector: String): BluePrintGrpcClientService {
return grpcLibPropertyService().blueprintGrpcClientService(selector)
@@ -51,4 +51,4 @@ class GRPCLibConstants {
const val TYPE_BASIC_AUTH = "basic-auth"
const val TYPE_TLS_AUTH = "tls-auth"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
index 47d16fbc7..f94d918a2 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/BluePrintGrpcLibData.kt
@@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.grpc
/** GRPC Server Properties */
open class GrpcServerProperties {
+
lateinit var type: String
var port: Int = -1
}
@@ -36,6 +37,7 @@ open class TLSAuthGrpcServerProperties : GrpcServerProperties() {
/** GRPC Client Properties */
open class GrpcClientProperties {
+
lateinit var type: String
lateinit var host: String
var port: Int = -1
@@ -55,4 +57,4 @@ open class TLSAuthGrpcClientProperties : GrpcClientProperties() {
open class BasicAuthGrpcClientProperties : GrpcClientProperties() {
lateinit var username: String
lateinit var password: String
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
index f3b14b59f..43e56606f 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcClientLoggingInterceptor.kt
@@ -16,32 +16,41 @@
package org.onap.ccsdk.cds.blueprintsprocessor.grpc.interceptor
-import io.grpc.*
+import io.grpc.CallOptions
+import io.grpc.Channel
+import io.grpc.ClientCall
+import io.grpc.ClientInterceptor
+import io.grpc.ForwardingClientCall
+import io.grpc.ForwardingClientCallListener
+import io.grpc.Metadata
+import io.grpc.MethodDescriptor
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.GrpcLoggerService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-
class GrpcClientLoggingInterceptor : ClientInterceptor {
val log = logger(GrpcClientLoggingInterceptor::class)
val loggingService = GrpcLoggerService()
- override fun <ReqT, RespT> interceptCall(method: MethodDescriptor<ReqT, RespT>,
- callOptions: CallOptions, channel: Channel): ClientCall<ReqT, RespT> {
+ override fun <ReqT, RespT> interceptCall(
+ method: MethodDescriptor<ReqT, RespT>,
+ callOptions: CallOptions,
+ channel: Channel
+ ): ClientCall<ReqT, RespT> {
return object : ForwardingClientCall
.SimpleForwardingClientCall<ReqT, RespT>(channel.newCall(method, callOptions)) {
override fun start(responseListener: Listener<RespT>, headers: Metadata) {
- val listener = object : ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT>(responseListener) {
- override fun onMessage(message: RespT) {
- loggingService.grpcInvoking(headers)
- super.onMessage(message)
+ val listener =
+ object : ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT>(responseListener) {
+ override fun onMessage(message: RespT) {
+ loggingService.grpcInvoking(headers)
+ super.onMessage(message)
+ }
}
- }
super.start(listener, headers)
}
}
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
index e21d5d3ce..a49b96743 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/interceptor/GrpcServerLoggingInterceptor.kt
@@ -16,7 +16,12 @@
package org.onap.ccsdk.cds.blueprintsprocessor.grpc.interceptor
-import io.grpc.*
+import io.grpc.ForwardingServerCall
+import io.grpc.ForwardingServerCallListener
+import io.grpc.Metadata
+import io.grpc.ServerCall
+import io.grpc.ServerCallHandler
+import io.grpc.ServerInterceptor
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.GrpcLoggerService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.logger
@@ -30,9 +35,12 @@ class GrpcServerLoggingInterceptor : ServerInterceptor {
val log = logger(GrpcServerLoggingInterceptor::class)
val loggingService = GrpcLoggerService()
- override fun <ReqT : Any, RespT : Any> interceptCall(call: ServerCall<ReqT, RespT>,
- requestHeaders: Metadata, next: ServerCallHandler<ReqT, RespT>)
- : ServerCall.Listener<ReqT> {
+ override fun <ReqT : Any, RespT : Any> interceptCall(
+ call: ServerCall<ReqT, RespT>,
+ requestHeaders: Metadata,
+ next: ServerCallHandler<ReqT, RespT>
+ ):
+ ServerCall.Listener<ReqT> {
val forwardingServerCall = object : ForwardingServerCall.SimpleForwardingServerCall<ReqT, RespT>(call) {
override fun sendHeaders(responseHeaders: Metadata) {
@@ -41,9 +49,10 @@ class GrpcServerLoggingInterceptor : ServerInterceptor {
}
}
- return object
- : ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(
- next.startCall(forwardingServerCall, requestHeaders)) {
+ return object :
+ ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>(
+ next.startCall(forwardingServerCall, requestHeaders)
+ ) {
override fun onMessage(message: ReqT) {
/** Get the requestId, SubRequestId and Originator Id and set in MDS context
@@ -52,22 +61,22 @@ class GrpcServerLoggingInterceptor : ServerInterceptor {
when (message) {
is ExecutionServiceInput -> {
val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
+ ?: throw BluePrintProcessorException("missing common header in request")
loggingService.grpcRequesting(call, commonHeader, next)
}
is BluePrintUploadInput -> {
val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
+ ?: throw BluePrintProcessorException("missing common header in request")
loggingService.grpcRequesting(call, commonHeader, next)
}
is BluePrintDownloadInput -> {
val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
+ ?: throw BluePrintProcessorException("missing common header in request")
loggingService.grpcRequesting(call, commonHeader, next)
}
is BluePrintRemoveInput -> {
val commonHeader = message.commonHeader
- ?: throw BluePrintProcessorException("missing common header in request")
+ ?: throw BluePrintProcessorException("missing common header in request")
loggingService.grpcRequesting(call, commonHeader, next)
}
else -> {
@@ -86,7 +95,6 @@ class GrpcServerLoggingInterceptor : ServerInterceptor {
MDC.clear()
super.onCancel()
}
-
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BasicAuthGrpcClientService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BasicAuthGrpcClientService.kt
index a175d8b3a..f7be8c66d 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BasicAuthGrpcClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BasicAuthGrpcClientService.kt
@@ -18,23 +18,18 @@ package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service
import io.grpc.ManagedChannel
import io.grpc.internal.DnsNameResolverProvider
-import io.grpc.internal.PickFirstLoadBalancerProvider
import io.grpc.netty.NettyChannelBuilder
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BasicAuthGrpcClientProperties
-
-open class BasicAuthGrpcClientService(private val basicAuthGrpcClientProperties: BasicAuthGrpcClientProperties)
- : BluePrintGrpcClientService {
+open class BasicAuthGrpcClientService(private val basicAuthGrpcClientProperties: BasicAuthGrpcClientProperties) :
+ BluePrintGrpcClientService {
override suspend fun channel(): ManagedChannel {
val managedChannel = NettyChannelBuilder
- .forAddress(basicAuthGrpcClientProperties.host, basicAuthGrpcClientProperties.port)
- .nameResolverFactory(DnsNameResolverProvider())
- .loadBalancerFactory(PickFirstLoadBalancerProvider())
- // .intercept(BasicAuthClientInterceptor(basicAuthGrpcClientProperties)).usePlaintext()
- .build()
+ .forAddress(basicAuthGrpcClientProperties.host, basicAuthGrpcClientProperties.port)
+ .nameResolverFactory(DnsNameResolverProvider())
+ // .intercept(BasicAuthClientInterceptor(basicAuthGrpcClientProperties)).usePlaintext()
+ .build()
return managedChannel
}
-
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
index 02d5cc695..79da447a1 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyService.kt
@@ -19,7 +19,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.grpc.*
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BasicAuthGrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.GRPCLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.GrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.GrpcServerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TLSAuthGrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TLSAuthGrpcServerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcServerProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -39,7 +46,6 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
return blueprintGrpcServerService(grpcServerProperties)
}
-
/** GRPC Server Lib Property Service */
fun grpcServerProperties(jsonNode: JsonNode): GrpcServerProperties {
return when (val type = jsonNode.get("type").textValue()) {
@@ -57,7 +63,8 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
fun grpcServerProperties(prefix: String): GrpcServerProperties {
val type = bluePrintPropertiesService.propertyBeanType(
- "$prefix.type", String::class.java)
+ "$prefix.type", String::class.java
+ )
return when (type) {
GRPCLibConstants.TYPE_TOKEN_AUTH -> {
tokenAuthGrpcServerProperties(prefix)
@@ -79,8 +86,8 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
return bluePrintPropertiesService.propertyBeanType(prefix, TLSAuthGrpcServerProperties::class.java)
}
- private fun blueprintGrpcServerService(grpcServerProperties: GrpcServerProperties)
- : BluePrintGrpcServerService {
+ private fun blueprintGrpcServerService(grpcServerProperties: GrpcServerProperties):
+ BluePrintGrpcServerService {
when (grpcServerProperties) {
is TLSAuthGrpcServerProperties -> {
return TLSAuthGrpcServerService(grpcServerProperties)
@@ -91,7 +98,6 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
}
}
-
/** GRPC Client Lib Property Service */
fun blueprintGrpcClientService(jsonNode: JsonNode): BluePrintGrpcClientService {
@@ -105,10 +111,9 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
return blueprintGrpcClientService(restClientProperties)
}
-
fun grpcClientProperties(jsonNode: JsonNode): GrpcClientProperties {
val type = jsonNode.get("type").returnNullIfMissing()?.textValue()
- ?: BluePrintProcessorException("missing type property")
+ ?: BluePrintProcessorException("missing type property")
return when (type) {
GRPCLibConstants.TYPE_TOKEN_AUTH -> {
JacksonUtils.readValue(jsonNode, TokenAuthGrpcClientProperties::class.java)!!
@@ -127,7 +132,8 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
fun grpcClientProperties(prefix: String): GrpcClientProperties {
val type = bluePrintPropertiesService.propertyBeanType(
- "$prefix.type", String::class.java)
+ "$prefix.type", String::class.java
+ )
return when (type) {
GRPCLibConstants.TYPE_TOKEN_AUTH -> {
tokenAuthGrpcClientProperties(prefix)
@@ -140,13 +146,12 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
}
else -> {
throw BluePrintProcessorException("Grpc type($type) not supported")
-
}
}
}
fun blueprintGrpcClientService(grpcClientProperties: GrpcClientProperties):
- BluePrintGrpcClientService {
+ BluePrintGrpcClientService {
return when (grpcClientProperties) {
is TokenAuthGrpcClientProperties -> {
TokenAuthGrpcClientService(grpcClientProperties)
@@ -174,4 +179,4 @@ open class BluePrintGrpcLibPropertyService(private var bluePrintPropertiesServic
private fun basicAuthGrpcClientProperties(prefix: String): BasicAuthGrpcClientProperties {
return bluePrintPropertiesService.propertyBeanType(prefix, BasicAuthGrpcClientProperties::class.java)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
index 0d9291615..e71525f0a 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcService.kt
@@ -26,4 +26,4 @@ interface BluePrintGrpcServerService {
interface BluePrintGrpcClientService {
suspend fun channel(): ManagedChannel
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/GrpcLoggerService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/GrpcLoggerService.kt
index 6d2ba43cc..732f4fecf 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/GrpcLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/GrpcLoggerService.kt
@@ -23,6 +23,7 @@ import io.grpc.ServerCallHandler
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.getStringKey
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.putStringKeyValue
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_INVOCATION_ID
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_PARTNER_NAME
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_REQUEST_ID
@@ -36,35 +37,45 @@ import java.net.InetSocketAddress
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
-import java.util.*
+import java.util.UUID
class GrpcLoggerService {
private val log = logger(GrpcLoggerService::class)
/** Used when server receives request */
- fun <ReqT : Any, RespT : Any> grpcRequesting(call: ServerCall<ReqT, RespT>,
- headers: Metadata, next: ServerCallHandler<ReqT, RespT>) {
+ fun <ReqT : Any, RespT : Any> grpcRequesting(
+ call: ServerCall<ReqT, RespT>,
+ headers: Metadata,
+ next: ServerCallHandler<ReqT, RespT>
+ ) {
val requestID = headers.getStringKey(ONAP_REQUEST_ID).defaultToUUID()
val invocationID = headers.getStringKey(ONAP_INVOCATION_ID).defaultToUUID()
val partnerName = headers.getStringKey(ONAP_PARTNER_NAME) ?: "UNKNOWN"
grpcRequesting(requestID, invocationID, partnerName, call)
}
- fun <ReqT : Any, RespT : Any> grpcRequesting(call: ServerCall<ReqT, RespT>,
- headers: CommonHeader, next: ServerCallHandler<ReqT, RespT>) {
+ fun <ReqT : Any, RespT : Any> grpcRequesting(
+ call: ServerCall<ReqT, RespT>,
+ headers: CommonHeader,
+ next: ServerCallHandler<ReqT, RespT>
+ ) {
val requestID = headers.requestId.defaultToUUID()
val invocationID = headers.subRequestId.defaultToUUID()
val partnerName = headers.originatorId ?: "UNKNOWN"
grpcRequesting(requestID, invocationID, partnerName, call)
}
- fun <ReqT : Any, RespT : Any> grpcRequesting(requestID: String, invocationID: String, partnerName: String,
- call: ServerCall<ReqT, RespT>) {
+ fun <ReqT : Any, RespT : Any> grpcRequesting(
+ requestID: String,
+ invocationID: String,
+ partnerName: String,
+ call: ServerCall<ReqT, RespT>
+ ) {
val localhost = InetAddress.getLocalHost()
val clientSocketAddress = call.attributes.get(Grpc.TRANSPORT_ATTR_REMOTE_ADDR) as? InetSocketAddress
- ?: throw BluePrintProcessorException("failed to get client address")
+ ?: throw BluePrintProcessorException("failed to get client address")
val serviceName = call.methodDescriptor.fullMethodName
MDC.put("InvokeTimestamp", ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT))
@@ -77,15 +88,13 @@ class GrpcLoggerService {
log.trace("MDC Properties : ${MDC.getCopyOfContextMap()}")
}
-
/** Used before invoking any GRPC outbound request, Inbound Invocation ID is used as request Id
* for outbound Request, If invocation Id is missing then default Request Id will be generated.
*/
fun grpcInvoking(requestHeader: Metadata) {
requestHeader.putStringKeyValue(ONAP_REQUEST_ID, MDC.get("InvocationID").defaultToUUID())
requestHeader.putStringKeyValue(ONAP_INVOCATION_ID, UUID.randomUUID().toString())
- val partnerName = System.getProperty("APPNAME") ?: "BlueprintsProcessor"
- requestHeader.putStringKeyValue(ONAP_PARTNER_NAME, partnerName)
+ requestHeader.putStringKeyValue(ONAP_PARTNER_NAME, BluePrintConstants.APP_NAME)
}
/** Used when server returns response */
@@ -98,4 +107,4 @@ class GrpcLoggerService {
log.warn("couldn't set grpc response headers", e)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcClientService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcClientService.kt
index a70cbbce0..44df5fbe5 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcClientService.kt
@@ -18,7 +18,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service
import io.grpc.ManagedChannel
import io.grpc.internal.DnsNameResolverProvider
-import io.grpc.internal.PickFirstLoadBalancerProvider
import io.grpc.netty.GrpcSslContexts
import io.grpc.netty.NettyChannelBuilder
import io.netty.handler.ssl.SslContext
@@ -26,17 +25,21 @@ import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TLSAuthGrpcClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.interceptor.GrpcClientLoggingInterceptor
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
-class TLSAuthGrpcClientService(private val tlsAuthGrpcClientProperties: TLSAuthGrpcClientProperties)
- : BluePrintGrpcClientService {
+class TLSAuthGrpcClientService(private val tlsAuthGrpcClientProperties: TLSAuthGrpcClientProperties) :
+ BluePrintGrpcClientService {
override suspend fun channel(): ManagedChannel {
+
+ val target =
+ if (tlsAuthGrpcClientProperties.port == -1) tlsAuthGrpcClientProperties.host
+ else "${tlsAuthGrpcClientProperties.host}:${tlsAuthGrpcClientProperties.port}"
+
return NettyChannelBuilder
- .forAddress(tlsAuthGrpcClientProperties.host, tlsAuthGrpcClientProperties.port)
- .nameResolverFactory(DnsNameResolverProvider())
- .loadBalancerFactory(PickFirstLoadBalancerProvider())
- .intercept(GrpcClientLoggingInterceptor())
- .sslContext(sslContext())
- .build()
+ .forTarget(target)
+ .nameResolverFactory(DnsNameResolverProvider())
+ .intercept(GrpcClientLoggingInterceptor())
+ .sslContext(sslContext())
+ .build()
}
fun sslContext(): SslContext {
@@ -44,11 +47,14 @@ class TLSAuthGrpcClientService(private val tlsAuthGrpcClientProperties: TLSAuthG
if (tlsAuthGrpcClientProperties.trustCertCollection != null) {
builder.trustManager(normalizedFile(tlsAuthGrpcClientProperties.trustCertCollection!!))
}
- if (tlsAuthGrpcClientProperties.clientCertChain != null
- && tlsAuthGrpcClientProperties.clientPrivateKey != null) {
- builder.keyManager(normalizedFile(tlsAuthGrpcClientProperties.clientCertChain!!),
- normalizedFile(tlsAuthGrpcClientProperties.clientPrivateKey!!))
+ if (tlsAuthGrpcClientProperties.clientCertChain != null &&
+ tlsAuthGrpcClientProperties.clientPrivateKey != null
+ ) {
+ builder.keyManager(
+ normalizedFile(tlsAuthGrpcClientProperties.clientCertChain!!),
+ normalizedFile(tlsAuthGrpcClientProperties.clientPrivateKey!!)
+ )
}
return builder.build()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcServerService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcServerService.kt
index fc73d43f9..915ea1730 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcServerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TLSAuthGrpcServerService.kt
@@ -24,20 +24,21 @@ import io.netty.handler.ssl.SslContextBuilder
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TLSAuthGrpcServerProperties
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
-
-class TLSAuthGrpcServerService(private val tlsAuthGrpcServerProperties: TLSAuthGrpcServerProperties)
- : BluePrintGrpcServerService {
+class TLSAuthGrpcServerService(private val tlsAuthGrpcServerProperties: TLSAuthGrpcServerProperties) :
+ BluePrintGrpcServerService {
override fun serverBuilder(): NettyServerBuilder {
return NettyServerBuilder
- .forPort(tlsAuthGrpcServerProperties.port)
- .sslContext(sslContext())
+ .forPort(tlsAuthGrpcServerProperties.port)
+ .sslContext(sslContext())
}
fun sslContext(): SslContext {
val sslClientContextBuilder = SslContextBuilder
- .forServer(normalizedFile(tlsAuthGrpcServerProperties.certChain),
- normalizedFile(tlsAuthGrpcServerProperties.privateKey))
+ .forServer(
+ normalizedFile(tlsAuthGrpcServerProperties.certChain),
+ normalizedFile(tlsAuthGrpcServerProperties.privateKey)
+ )
tlsAuthGrpcServerProperties.trustCertCollection?.let { trustCertFile ->
sslClientContextBuilder.trustManager(normalizedFile(trustCertFile))
@@ -45,5 +46,4 @@ class TLSAuthGrpcServerService(private val tlsAuthGrpcServerProperties: TLSAuthG
}
return GrpcSslContexts.configure(sslClientContextBuilder).build()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TokenAuthGrpcClientService.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TokenAuthGrpcClientService.kt
index 601dc0e33..4c991df1f 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TokenAuthGrpcClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/TokenAuthGrpcClientService.kt
@@ -16,31 +16,44 @@
package org.onap.ccsdk.cds.blueprintsprocessor.grpc.service
-import io.grpc.*
+import io.grpc.CallOptions
+import io.grpc.Channel
+import io.grpc.ClientCall
+import io.grpc.ClientInterceptor
+import io.grpc.ForwardingClientCall
+import io.grpc.ManagedChannel
+import io.grpc.Metadata
+import io.grpc.MethodDescriptor
import io.grpc.internal.DnsNameResolverProvider
-import io.grpc.internal.PickFirstLoadBalancerProvider
import io.grpc.netty.NettyChannelBuilder
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.interceptor.GrpcClientLoggingInterceptor
-class TokenAuthGrpcClientService(private val tokenAuthGrpcClientProperties: TokenAuthGrpcClientProperties)
- : BluePrintGrpcClientService {
+class TokenAuthGrpcClientService(private val tokenAuthGrpcClientProperties: TokenAuthGrpcClientProperties) :
+ BluePrintGrpcClientService {
override suspend fun channel(): ManagedChannel {
+ val target =
+ if (tokenAuthGrpcClientProperties.port == -1) tokenAuthGrpcClientProperties.host
+ else "${tokenAuthGrpcClientProperties.host}:${tokenAuthGrpcClientProperties.port}"
+
val managedChannel = NettyChannelBuilder
- .forAddress(tokenAuthGrpcClientProperties.host, tokenAuthGrpcClientProperties.port)
- .nameResolverFactory(DnsNameResolverProvider())
- .loadBalancerFactory(PickFirstLoadBalancerProvider())
- .intercept(GrpcClientLoggingInterceptor())
- .intercept(TokenAuthClientInterceptor(tokenAuthGrpcClientProperties)).usePlaintext().build()
+ .forTarget(target)
+ .nameResolverFactory(DnsNameResolverProvider())
+ .intercept(GrpcClientLoggingInterceptor())
+ .intercept(TokenAuthClientInterceptor(tokenAuthGrpcClientProperties)).usePlaintext().build()
return managedChannel
}
}
-class TokenAuthClientInterceptor(private val tokenAuthGrpcClientProperties: TokenAuthGrpcClientProperties) : ClientInterceptor {
+class TokenAuthClientInterceptor(private val tokenAuthGrpcClientProperties: TokenAuthGrpcClientProperties) :
+ ClientInterceptor {
- override fun <ReqT, RespT> interceptCall(method: MethodDescriptor<ReqT, RespT>,
- callOptions: CallOptions, channel: Channel): ClientCall<ReqT, RespT> {
+ override fun <ReqT, RespT> interceptCall(
+ method: MethodDescriptor<ReqT, RespT>,
+ callOptions: CallOptions,
+ channel: Channel
+ ): ClientCall<ReqT, RespT> {
val authHeader = Metadata.Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER)
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
index 13432c043..d9a8082d4 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcLibPropertyServiceTest.kt
@@ -24,7 +24,11 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.grpc.*
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BasicAuthGrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.BluePrintGrpcLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TLSAuthGrpcClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TLSAuthGrpcServerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.grpc.TokenAuthGrpcClientProperties
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
@@ -35,34 +39,38 @@ import kotlin.test.assertNotNull
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintGrpcLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.grpcclient.sample.type=basic-auth",
- "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.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",
-
- "blueprintsprocessor.grpcserver.tls-sample.type=tls-auth",
- "blueprintsprocessor.grpcserver.tls-sample.port=50505",
- "blueprintsprocessor.grpcserver.tls-sample.certChain=server1.pem",
- "blueprintsprocessor.grpcserver.tls-sample.privateKey=server1.key",
- "blueprintsprocessor.grpcserver.tls-sample.trustCertCollection=ca.pem",
-
- "blueprintsprocessor.grpcclient.tls-sample.type=tls-auth",
- "blueprintsprocessor.grpcclient.tls-sample.host=127.0.0.1",
- "blueprintsprocessor.grpcclient.tls-sample.port=50505",
- "blueprintsprocessor.grpcclient.tls-sample.trustCertCollection=ca.pem",
- "blueprintsprocessor.grpcclient.tls-sample.clientCertChain=client.pem",
- "blueprintsprocessor.grpcclient.tls-sample.clientPrivateKey=client.key"
-])
+@ContextConfiguration(
+ classes = [BluePrintGrpcLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprintsprocessor.grpcclient.sample.type=basic-auth",
+ "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.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",
+
+ "blueprintsprocessor.grpcserver.tls-sample.type=tls-auth",
+ "blueprintsprocessor.grpcserver.tls-sample.port=50505",
+ "blueprintsprocessor.grpcserver.tls-sample.certChain=server1.pem",
+ "blueprintsprocessor.grpcserver.tls-sample.privateKey=server1.key",
+ "blueprintsprocessor.grpcserver.tls-sample.trustCertCollection=ca.pem",
+
+ "blueprintsprocessor.grpcclient.tls-sample.type=tls-auth",
+ "blueprintsprocessor.grpcclient.tls-sample.host=127.0.0.1",
+ "blueprintsprocessor.grpcclient.tls-sample.port=50505",
+ "blueprintsprocessor.grpcclient.tls-sample.trustCertCollection=ca.pem",
+ "blueprintsprocessor.grpcclient.tls-sample.clientCertChain=client.pem",
+ "blueprintsprocessor.grpcclient.tls-sample.clientPrivateKey=client.key"
+ ]
+)
class BluePrintGrpcLibPropertyServiceTest {
@Autowired
@@ -74,17 +82,22 @@ class BluePrintGrpcLibPropertyServiceTest {
@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 pro" +
- "perty in property bean")
- assertNotNull(properties.password, "failed to get host pr" +
- "operty 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 property in property bean"
+ )
+ assertNotNull(
+ properties.password, "failed to get host property in property bean"
+ )
}
/**
@@ -93,14 +106,15 @@ class BluePrintGrpcLibPropertyServiceTest {
@Test
fun testGrpcClientPropertiesWithJson() {
val json: String = "{\n" +
- " \"type\" : \"token-auth\",\n" +
- " \"host\" : \"127.0.0.1\",\n" +
- " \"port\" : \"50505\"\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
+ actualObj
+ ) as TokenAuthGrpcClientProperties
assertNotNull(properties, "failed to create property bean")
assertEquals(properties.host, "127.0.0.1")
assertNotNull(properties.port, "50505")
@@ -112,7 +126,8 @@ class BluePrintGrpcLibPropertyServiceTest {
@Test
fun testGrpcClientServiceBasic() {
val svc = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(
- "sample")
+ "sample"
+ )
assertTrue(svc is BasicAuthGrpcClientService)
}
@@ -122,7 +137,8 @@ class BluePrintGrpcLibPropertyServiceTest {
@Test
fun testGrpcClientServiceToken() {
val svc = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(
- "token")
+ "token"
+ )
assertTrue(svc is TokenAuthGrpcClientService)
}
@@ -132,23 +148,23 @@ class BluePrintGrpcLibPropertyServiceTest {
@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" +
- "}"
+ " \"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)
+ .blueprintGrpcClientService(actualObj)
assertTrue(svc is BasicAuthGrpcClientService)
}
@Test
fun testGrpcClientTLSProperties() {
val properties = bluePrintGrpcLibPropertyService
- .grpcClientProperties("blueprintsprocessor.grpcclient.tls-sample") as TLSAuthGrpcClientProperties
+ .grpcClientProperties("blueprintsprocessor.grpcclient.tls-sample") as TLSAuthGrpcClientProperties
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")
@@ -166,14 +182,14 @@ class BluePrintGrpcLibPropertyServiceTest {
}
""".trimIndent()
val jsonProperties = bluePrintGrpcLibPropertyService
- .grpcClientProperties(configDsl.jsonAsJsonType()) as TLSAuthGrpcClientProperties
+ .grpcClientProperties(configDsl.jsonAsJsonType()) as TLSAuthGrpcClientProperties
assertNotNull(jsonProperties, "failed to create property bean from json")
}
@Test
fun testGrpcServerTLSProperties() {
val properties = bluePrintGrpcLibPropertyService
- .grpcServerProperties("blueprintsprocessor.grpcserver.tls-sample") as TLSAuthGrpcServerProperties
+ .grpcServerProperties("blueprintsprocessor.grpcserver.tls-sample") as TLSAuthGrpcServerProperties
assertNotNull(properties, "failed to create property bean")
assertNotNull(properties.port, "failed to get host property in property bean")
assertNotNull(properties.trustCertCollection, "failed to get trustCertCollection property in property bean")
@@ -189,11 +205,11 @@ class BluePrintGrpcLibPropertyServiceTest {
}
""".trimIndent()
val jsonProperties = bluePrintGrpcLibPropertyService
- .grpcServerProperties(configDsl.jsonAsJsonType()) as TLSAuthGrpcServerProperties
+ .grpcServerProperties(configDsl.jsonAsJsonType()) as TLSAuthGrpcServerProperties
assertNotNull(jsonProperties, "failed to create property bean from json")
val grpcServerService = bluePrintGrpcLibPropertyService.blueprintGrpcServerService("tls-sample")
assertNotNull(grpcServerService, "failed to get grpc server service")
Assert.assertEquals(TLSAuthGrpcServerService::class.java, grpcServerService.javaClass)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcServerTest.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcServerTest.kt
index 8154d3747..026fe5af5 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcServerTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/BluePrintGrpcServerTest.kt
@@ -30,7 +30,7 @@ import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput
-import java.util.*
+import java.util.UUID
import kotlin.test.Test
import kotlin.test.assertNotNull
@@ -62,14 +62,16 @@ class BluePrintGrpcServerTest {
}
/** TLS Client Integration testing, GRPC TLS Junit testing is not supported. */
- //@Test
+ // @Test
fun testGrpcTLSServerIntegration() {
runBlocking {
val tlsAuthGrpcClientService = TLSAuthGrpcClientService(tlsAuthGrpcClientProperties)
val grpcChannel = tlsAuthGrpcClientService.channel()
/** Get Send and Receive Channel for bidirectional process method*/
- val (reqChannel, resChannel) = clientCallBidiStreaming(BluePrintProcessingServiceGrpc.getProcessMethod(),
- grpcChannel)
+ val (reqChannel, resChannel) = clientCallBidiStreaming(
+ BluePrintProcessingServiceGrpc.getProcessMethod(),
+ grpcChannel
+ )
launch {
resChannel.consumeEach {
log.info("Received Response")
@@ -85,25 +87,24 @@ class BluePrintGrpcServerTest {
private fun getRequest(requestId: String): ExecutionServiceInput {
val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(requestId)
- .setSubRequestId("$requestId-" + UUID.randomUUID().toString()).build()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(requestId)
+ .setSubRequestId("$requestId-" + UUID.randomUUID().toString()).build()
val actionIdentifier = ActionIdentifiers.newBuilder()
- .setActionName("SampleScript")
- .setBlueprintName("sample-cba")
- .setBlueprintVersion("1.0.0")
- .setMode(ACTION_MODE_SYNC)
- .build()
+ .setActionName("SampleScript")
+ .setBlueprintName("sample-cba")
+ .setBlueprintVersion("1.0.0")
+ .setMode(ACTION_MODE_SYNC)
+ .build()
val jsonContent = """{ "key1" : "value1" }"""
val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
JsonFormat.parser().merge(jsonContent, payloadBuilder)
return ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
index d5bc70c48..fb7282f75 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/grpc/service/MockTLSBluePrintProcessingServer.kt
@@ -27,7 +27,6 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.BluePrintProcessin
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput
-
val log = logger(MockTLSBluePrintProcessingServer::class)
/** For Integration testing stat this server, Set the working path to run this method */
@@ -40,16 +39,15 @@ fun main() {
privateKey = "src/test/resources/tls-manual/py-executor-key.pem"
}
val server = TLSAuthGrpcServerService(tlsAuthGrpcServerProperties).serverBuilder()
- .intercept(GrpcServerLoggingInterceptor())
- .addService(MockTLSBluePrintProcessingServer())
- .build()
+ .intercept(GrpcServerLoggingInterceptor())
+ .addService(MockTLSBluePrintProcessingServer())
+ .build()
server.start()
log.info("GRPC Serve started(${server.isShutdown}) on port(${server.port})...")
server.awaitTermination()
} catch (e: Exception) {
log.error("Failed to start tls grpc integration server", e)
}
-
}
class MockTLSBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
@@ -57,17 +55,21 @@ class MockTLSBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrin
return object : StreamObserver<ExecutionServiceInput> {
override fun onNext(executionServiceInput: ExecutionServiceInput) {
- log.info("Received requestId(${executionServiceInput.commonHeader.requestId}) " +
- "subRequestId(${executionServiceInput.commonHeader.subRequestId})")
+ log.info(
+ "Received requestId(${executionServiceInput.commonHeader.requestId}) " +
+ "subRequestId(${executionServiceInput.commonHeader.subRequestId})"
+ )
responseObserver.onNext(buildResponse(executionServiceInput))
responseObserver.onCompleted()
}
override fun onError(error: Throwable) {
log.debug("Fail to process message", error)
- responseObserver.onError(io.grpc.Status.INTERNAL
+ responseObserver.onError(
+ io.grpc.Status.INTERNAL
.withDescription(error.message)
- .asException())
+ .asException()
+ )
}
override fun onCompleted() {
@@ -78,13 +80,12 @@ class MockTLSBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrin
private fun buildResponse(input: ExecutionServiceInput): ExecutionServiceOutput {
val status = Status.newBuilder().setCode(200)
- .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
- .build()
+ .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
+ .build()
return ExecutionServiceOutput.newBuilder()
- .setCommonHeader(input.commonHeader)
- .setActionIdentifiers(input.actionIdentifiers)
- .setStatus(status)
- .build()
-
+ .setCommonHeader(input.commonHeader)
+ .setActionIdentifiers(input.actionIdentifiers)
+ .setStatus(status)
+ .build()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-chain.pem b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-chain.pem
index 30f09dfea..98c4f39ba 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-chain.pem
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-chain.pem
@@ -1,27 +1,37 @@
-----BEGIN CERTIFICATE-----
-MIIEpDCCAowCCQDyhR+GR2RUiTANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls
-b2NhbGhvc3QwHhcNMTkxMDIzMDAwMTA0WhcNMjkxMDIwMDAwMTA0WjAUMRIwEAYD
-VQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCs
-c4d6qfbW+GSMp+XURoLXtSAbbehoBXL2beSzqQNW6e+Q9IVtSPZst8VRjUXelFzM
-m7VpS9jhiXOPZ5KKUOD0GVuNQc54VpwtHt7t9L5wS9OvdnLijnMIkc0iUvC6+Rcq
-HSfbNC2Tb+a8jLwojmtRCeY/MyCnmqYpD+U3b6Eue89VpMOIfmDuTqSRRBYNVO72
-hq7FI3UD8+zREg7htfzjJjG14Ec5iVMDxJA1FlwtXFnZxDHgbLjEVjTTR/9Wm1eU
-aJ4oWRt3gG/vnJNa+GwN4w/My+j/5/n/YpNh6GeQrHxBl/SL/SAFBshlwozr4K4K
-av5MqRKyhCACV4SsdhKJUEDtvrtukJvh/ZDW8jdNbFJAljm8UucZGbJrZl6G7XB3
-WteI7rezo0mL0NMBZIT3nQSMEpefKUFZFiE5lYvIk3UuChqIM0xdgV4INwLRHZdc
-1TtiGaBJV05y3Klo5gaUgNGbHP26zfub5TydiMrOA5W2mUvMkG2oit9aqnbaZBLD
-t17cCKzpzcVF5uNUng3j6sQvpTt3S4L28TvKUMAfpecQqvxMoxG0/9HZuv2z+U+L
-LVVsS07yJPIGMLcq1LMM++8LwD1MupcoShjNOq/lUOL6hIMfLOIfxt8Kv8WykVzv
-6yjKEIurjkwMipq4kvr9J7FFi54kGr7uvXWQRHDFJwIDAQABMA0GCSqGSIb3DQEB
-CwUAA4ICAQB7gJzvaOIP3/S2jrObz67g0jiz1cfb4I9KQwpwb6JUWbYm1QjBcGm4
-IhNbdPMD6dpwBc/A4JctA5E+/fArvl14UtK1jkaaE/GCumL0VUSZeAM6CK/63brt
-LplqCunv8ePHmiwjJBnhu+ewe1+mDMVDMw0iot/q+pOM3vqNS1Fipja+xFK1JQZx
-JmkjW/Ug3NHk/SSTfO+VNmlI5bBBApMqKmd9picsyDZ7dTBtZvbqV5eQsPZvv14G
-oEvWnvvom+D5GojroSO+OMHNDR3bzK6p0Cu8AiTy9Ls6J2e4GXJz3Cg/kuF9tNlR
-3X62zDT+CUipuYyTvmjbSyNMGwU7BIZTKFPuTtjh7EwT2g6S8RV9PmT98CQW6kTT
-RJbL7nMIOF0WusysAT5wj1HJ0QKBQCXK+L6WTKTTovaEE7JSVrYe7wVF8Q9SyBIM
-4CPVZt+GMyQKJ9SRnVgTDEMb7sj9HPaoVeDc6LQTv8Q//wFeTdZIWXQhpVJCQCEG
-qkRk9r3isF60ISOXXIYhqE+hx3QXY9M2UyHDtKXPZ7X370vADi2ebBMF8MpIZYl5
-628dME9JhOhLhD5qPJeva2Nq4gLpK+rO6t7ML0Us4edoKyoScowXAh80q1GW3EO3
-IxTK123651C/S0kDqLqZ9rknEdpwSujrT2UW95jUlfo5OKDrPpdOBw==
+MIIGXTCCBEWgAwIBAgIJALA8s9WVhurtMA0GCSqGSIb3DQEBCwUAMH8xCzAJBgNV
+BAYTAlVTMRMwEQYDVQQIDApOZXcgSmVyc2V5MRMwEQYDVQQHDApNaWRkbGV0b3du
+MRcwFQYDVQQKDA5PTkFQIENvbW11bml0eTEOMAwGA1UEAwwFQ0NTREsxHTAbBgkq
+hkiG9w0BCQEWDmJzMjc5NkBhdHQuY29tMB4XDTE5MTEyOTIwNTUzNFoXDTI5MTEy
+NjIwNTUzNFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCk5ldyBKZXJzZXkxEzAR
+BgNVBAcMCk1pZGRsZXRvd24xFzAVBgNVBAoMDk9OQVAgQ29tbXVuaXR5MQ4wDAYD
+VQQDDAVDQ1NESzEdMBsGCSqGSIb3DQEJARYOYnMyNzk2QGF0dC5jb20wggIiMA0G
+CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDMb8yqD/lu3IHffa1H+LnCTKCijZDC
+85sPta8nH9cQxqRLJyjkOZs+K1z5i6Qn1AH8jOYqG1dRO0Y3pTqu0q5s5Q5Qg2ZF
+xZPW0772HL2Id1WAL62ymPcAp4/JPgeFqcVtRcxx+MPKTohjSY9l+cAPuAQ3izmz
+ValxYVvI8s3qRnvp9sjaOTm4vz/9/7mci9hDKn4B8K7u8fUPKkqYQOOaiv31rYVG
+sw7CIGvHGQMz89loWtB7A4ioZmveZdRdRs5kXbGwvuZQOnc6e8wYO211wkPEJ/go
+sulWwMqcwN9L6712g6ZnoFD+gtut+OLIlrZGS/5MEzMnvmX9NzXiKOP9Zp+Qj4jM
+3pa1pt33LxoBYux7r9154wi9kCXLI2XUTA5TbaufXv6/tn3R9fzMYEUeUdLeEEtr
+NBTEpviTaAxgkpLhGbrSd6F3wbvnBh/gPrBW/0HrAnpMuV5V8JFP1SrT2EbguaW5
+G4keckBMkcOPpz/qvYuXW2FD/XO5yz1keJqXs4HSSM0/ZYcNk89wn50I4GLUY0Q5
+hnk9Twdf8zglSRUDHLCrsA88wJXHBL6W6xVQjQFikY94YOVyvcqXvnmlhOhLamr2
+72bbjrVPvZw4nUYZeg/WpdalmpJb4M9MVLLFo11O150PRRUqnHTHHKGXv7C2mCAO
+MIEPr/WJpS50WwIDAQABo4HbMIHYMB0GA1UdDgQWBBT+kmcpEJ/kS/kW9rGc0uom
+T0VqBDAfBgNVHSMEGDAWgBT+kmcpEJ/kS/kW9rGc0uomT0VqBDAJBgNVHRMEAjAA
+MAsGA1UdDwQEAwIF4DATBgNVHSUEDDAKBggrBgEFBQcDATA7BgNVHREENDAyghBj
+ZHMtY29udHJvbGxlci0qgg1weS1leGVjdXRvci0qgglsb2NhbGhvc3SHBH8AAAEw
+LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMA0G
+CSqGSIb3DQEBCwUAA4ICAQCdquyIETbOWFtXpzL/SQ8jB0yzBmErA3vQPm847qSz
+r8QNXsEyPq7lo06xJTfhlmfpOBzCVdpP+/3pvJfKJ8/wC/D3B8E88Ozzz/yCZPuG
+SNcv+SSnki729ptc1bx6It0FQFahXGywm2ASHGMz4zfmMtnjIfBEuMBCD+V4liwr
+oCEw8E1d+fxArv72LMbNYxPQ+HfrasYhINgVnYSpftqIGpi0PGaEoCVrosQnB0Gk
+5kHWvTXqMC+G9Q1MSQk8vs3lnp9Y4gXbdeaMu3YSmM9nVAY1uZiZRBHVbMadIDFO
+NQmDBKfyN6uK3uBV1S84woC0o5iqIR5EF3u4NeCX5jRWR1Uu4zAG70TpcLmyP1do
+Kt49m9sVrxoCgzjzRd1yZ50BZ1/5550OeF55swQv/ncGriD8uxaQu49NbUo2Rw8R
+Af5TMMW9+0KN6zDOUIVfK5a6NGqnylN3drB2jIjGyTOVycm5paL+iuKEg7euxvZ8
+51Z6QWe3F3+wVYVWtDeN3/9FUm3FzonmZvoChYkz7NTifQpS7/46BpBa5DoblcUu
+MMXWMYieVv3wLIvtFFi2CoNh0tyD7TcNsAB4hLbbBxtXmAB82tgjQhOdkQErm+qi
+Gq5AwlI8k3hhkLDcWH4hUx4YTLJLdTeQGKyM6dB+NBZATyzOrY5j86j7vITLeG8t
+3w==
-----END CERTIFICATE-----
diff --git a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-key.pem b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-key.pem
index 830a3ae21..9407765b5 100644
--- a/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-key.pem
+++ b/ms/blueprintsprocessor/modules/commons/grpc-lib/src/test/resources/tls-manual/py-executor-key.pem
@@ -1,52 +1,52 @@
-----BEGIN PRIVATE KEY-----
-MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCsc4d6qfbW+GSM
-p+XURoLXtSAbbehoBXL2beSzqQNW6e+Q9IVtSPZst8VRjUXelFzMm7VpS9jhiXOP
-Z5KKUOD0GVuNQc54VpwtHt7t9L5wS9OvdnLijnMIkc0iUvC6+RcqHSfbNC2Tb+a8
-jLwojmtRCeY/MyCnmqYpD+U3b6Eue89VpMOIfmDuTqSRRBYNVO72hq7FI3UD8+zR
-Eg7htfzjJjG14Ec5iVMDxJA1FlwtXFnZxDHgbLjEVjTTR/9Wm1eUaJ4oWRt3gG/v
-nJNa+GwN4w/My+j/5/n/YpNh6GeQrHxBl/SL/SAFBshlwozr4K4Kav5MqRKyhCAC
-V4SsdhKJUEDtvrtukJvh/ZDW8jdNbFJAljm8UucZGbJrZl6G7XB3WteI7rezo0mL
-0NMBZIT3nQSMEpefKUFZFiE5lYvIk3UuChqIM0xdgV4INwLRHZdc1TtiGaBJV05y
-3Klo5gaUgNGbHP26zfub5TydiMrOA5W2mUvMkG2oit9aqnbaZBLDt17cCKzpzcVF
-5uNUng3j6sQvpTt3S4L28TvKUMAfpecQqvxMoxG0/9HZuv2z+U+LLVVsS07yJPIG
-MLcq1LMM++8LwD1MupcoShjNOq/lUOL6hIMfLOIfxt8Kv8WykVzv6yjKEIurjkwM
-ipq4kvr9J7FFi54kGr7uvXWQRHDFJwIDAQABAoICADepPmRAMbTnDYU8t/jRHXBE
-PO29htL0V0vk4nl+pt5JuZJe6iYA89DZa+3LnG6gEmfUJjSrT4BUXiE+O9U7D7CZ
-8qvgPqUmx1fk6+2AHmuefd/XanNnqQduD/jxLlQbC/gC2xdsev1ok9/tyNmKRmcs
-u81QUkzmpJUCVWiUNkELozswaBBJQj4I0iM1B60b6dlWVVi5/g3dkGVW38jIdaxX
-apoansKaaVoA+s63vd7CPRoFsleOoAB3FqvPREIO97CmJ848HJpwsTB0qDcnkbDV
-xgbDFhxrIozko09ptOvEUILXag45EDmvG8WEivmjVml0aUoTFD7cWHyJBQCpR4fU
-5W9mYd4Rrzbmpb+LGYdNyrp3wo3C7dJ7/ffBMQxmXTdMZkcxorxj4BRG3oACRQ1u
-Ff1iUruZzIIDtEkrC9hc5QpLlDf9b1obm8L9sxf1QmTt59o5oFG40GPwPP19GXwE
-l2faHwho2jYLM9rhuSsK/5sSmUshPNQYmfMnbWzTtghMPE/g0Cfpt8qbspq+G1bk
-z3M97JlFMF83ccRotDElX9E/ttjU7Lehoz+1sOyHiVW1E4oqKer4t+nI2bp6VYZm
-W94qptW7kb4o0DsvPCaoTPBxLJ1ag2WBlqoFkVI0YaxZiZ8OTR55Ovi4z5xWBO1q
-NkCKgdAUQvQVzVtASVGBAoIBAQDSw2nvPFN4gGZ6OI+8j2gWtPcsrhSHS9ykxBeB
-mB/HExYIe8k3EvClf2rnfwzuKgKyVMp7Ev7nH2jS/PGZq37QyXrw0NBGRnvJY0Ez
-YB1KTgf9xaHMGMut5efNvv/cPwYriqosgJ0pdt0vvUAIQ6EBv+iDXXqJ1lQUSRYk
-wKjFABi6TeJY4t9vC474KoXTDaHlwn9+TwnuRBk85wrZzlhK90J0iVa9/Eqeddsc
-Z3CuTlc+NmcP3qvniYODq8nyVc0pKw+28AVYYEd3aJfgm+dpcB21L0oz7CaxH/Rz
-FNONuQRaOzJrcuJsde/KG2X+MHs6hVMXXXWciPrJ2l+Cq7dnAoIBAQDRdwZDcgem
-tJHLihCRzUl9PKip4ZA5757ZyTy6WMLR3wMS2cNTK8+bTrUa0SSC4WSI28pybFA7
-QdSR08c5Nd7jXcIrtqspgZKhb0E60i8VQHhh6ba/kyQjsEz9c/G1WquPK13j2vZ0
-79bomDwFJPsFzABU+sC0/F42ZVQzy9qXkjngjtmaGfrCc7X+pV28nEGtyxHci3L4
-XXfE2dOb+GBVZPLBVXwcthdRYsFuU9GMy2GH0zVtWPOcGRnlpx53Tqg7NIeR0Nm1
-K35EaK8PH92PsAr0Xza7vQHY4cPRz+RhDzjyGQtnhKf96U6gzzt4ZVbQ/UuzDBcL
-PQ2DvUH+sqxBAoIBAEW5kiUsDu0xhTVv2tVll+jTK2ZjnLT5ut/jY2djHTgtrz9V
-PEb1BBmsIoC9PljYGxZGCMpYiW2KrZIHTiIpYwXNcdeTLSPik3cXV+2YIXiAghJJ
-PHKZzWAVS+97/YcubmsfL5cTYWrjQN9XO4TAYtaCV3iGB1DsT9p6J1I3Tl4F3yhb
-NcN0IrjI2R5uauFchC/PfYAaw81ISBUm1iciJYF/dUO6X7DwcvsjQD6QVe3ESwZw
-1v2gC7zIeHKp9WAvVHUHIubBVvNavqnZN01+JjtydNGI+IJe4Jn+WU9tF2OuTqtP
-JCn50sBQ7+gr0j0aatn8W3XCXHNRua3niWtgRYcCggEAT7OzfWxhPuyMYV9qiKAN
-a4ruPp3mjDUCQ6pP4jQuBT+PYtfbe8U63MSpIsgb1XVAFNdVBA70xGd7I/XqY3l9
-ExS08n8yR7vW+Hhl4KTjZ3m9lLwiXmj1omLOGM7KVRBoITUGJ9JEXyB3rM9oXyjA
-H2eNZMh5FSTGEHqj/IV/6paoUSrp37os8VqoEHoJ3d+zGhcf98RT/e9KyGt+GmX6
-+eNMf4YwkJg07THfmkRoguNMfCtAtBfZsjbW5MyfShRy7PxC7ZgDju06wXr3yZB9
-dNQuhufH4s27azQUl7w8ETaCm5QuA7i1V2c0FPpljZ052JHZAQsDpbIYd11HREvm
-QQKCAQEA0W7xNYoFvnyikdG0t266LLv1EkWDFdgkelGx/eGe/JZ+au3uTM94EssC
-ni64XX2P8vK/te+c3jItYO4MRgnDJ7GW+bRnJFu2kBE0W4chx7vga0XApVCP+Ugg
-owv5yf9cOAHFulvPefsU0snYStD3gNq77XDg0CwoyUkpeq+GiupoQ8tquMSsrEwp
-ve5DtDip3cLHz2oVLB3mR4kKVwVwmOgO5RKq6N/H6Jxtf/Zk1I260dKr+Dv2MnDh
-dysO4zH5YEt2ML3oY4zY8lu+I5bHCBR1updSny0B31WrXAJyfZpMx+HOwETFKa3B
-v9AGKz0Jc2GOIRKHrCQ/WkZePetaYQ==
+MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDMb8yqD/lu3IHf
+fa1H+LnCTKCijZDC85sPta8nH9cQxqRLJyjkOZs+K1z5i6Qn1AH8jOYqG1dRO0Y3
+pTqu0q5s5Q5Qg2ZFxZPW0772HL2Id1WAL62ymPcAp4/JPgeFqcVtRcxx+MPKTohj
+SY9l+cAPuAQ3izmzValxYVvI8s3qRnvp9sjaOTm4vz/9/7mci9hDKn4B8K7u8fUP
+KkqYQOOaiv31rYVGsw7CIGvHGQMz89loWtB7A4ioZmveZdRdRs5kXbGwvuZQOnc6
+e8wYO211wkPEJ/gosulWwMqcwN9L6712g6ZnoFD+gtut+OLIlrZGS/5MEzMnvmX9
+NzXiKOP9Zp+Qj4jM3pa1pt33LxoBYux7r9154wi9kCXLI2XUTA5TbaufXv6/tn3R
+9fzMYEUeUdLeEEtrNBTEpviTaAxgkpLhGbrSd6F3wbvnBh/gPrBW/0HrAnpMuV5V
+8JFP1SrT2EbguaW5G4keckBMkcOPpz/qvYuXW2FD/XO5yz1keJqXs4HSSM0/ZYcN
+k89wn50I4GLUY0Q5hnk9Twdf8zglSRUDHLCrsA88wJXHBL6W6xVQjQFikY94YOVy
+vcqXvnmlhOhLamr272bbjrVPvZw4nUYZeg/WpdalmpJb4M9MVLLFo11O150PRRUq
+nHTHHKGXv7C2mCAOMIEPr/WJpS50WwIDAQABAoICAE70ksfPeZc+ZI5LPIRCZIPN
+EnEVWaZhbS6pDad/nZEmFsfLrPhP40wkdTkPnGuhbs76H959RsDhsqHFF5/zUFhQ
+MrIXvYUO5KUgjG0C9pRg+k2SnHQQrby7+kVPxpnx0oT8YxRVblCQ+g3WmCJbTbkE
+aeSFydggKlvWrRsz4yEq7aqTnEjjtw5KFs3jWO1D+VcfbyESso0oN2wO+lZJIV5L
+df/Pb1y5xOZmnRl86IbFE99Ay6nm2H2paNmw3E7WDNoocXsAj3TGz8tvioiFUyYa
+zA9THH2jc4kE1nup5dOtjTPbboYxHXbeVTegmv27b1RA/0qkU6py13LvQslA36QK
+jl7my7AM165FtzpuAJqcvalgrfMZOOOFPi4MB20C2rT+xze3CJ9Vn6A3zrSj27Hv
+krZK74hWk2m7UwtWmvb1ykJATj2MsnaGv0HwKDcikm5dKcejaRy4yFgYj74nrR64
+qDyYXNhu9NewIBTSK8Liq0SsvMkGDarfdfs3+foORPUzyAnfaeReSn+CkmalpjIy
+YX/za74G1gp39Ls2NOqy+vknkzYVyJZg0OBoa348OsB3igo6hmF3YRT1/48Vl58h
+TwZy8e07aZGlE6iDZUlDt6vM1RQH9ZB5L8D4SiaJP9pk2AtsfbnDlwPkdnyRTVzr
+ePKchCjMVhhF8iJFIF0RAoIBAQDtMIZ231lzMzPIJxbq62WbfQZdWmHaPObOePCq
+BYQ01K5nkhIQo+dnCBrsSjEHKDHQEkHpzt1d8IWYXU/F5dpyiTzQvpNEb8oDwKRO
+30UdTer5ziQZuNv3TKfhdtP1TXeT7PhRr2Xtuhb3znf7lzysYUWKWLJTmL/PieI2
+OW2ZPBiLnJzZwlKfUxzKvfPOja6vjcVasDipw7h0erz2ZWhWKBM/ANwsm4nAaBV7
+t1XHIQGKxPzoETsovcKbytfR9DryMrT/GVwVeYtrdqUG1SiE4gWg4FHxw74sZzcz
+eAOevNUr7DAuSvuOCGHFK4MfiSwmy8O4PcetJ4/43HvL5VU5AoIBAQDcplGkcaw3
+IacYpLB0S30HSI7WQY5mHBuNRtQpJ+fZ5UilZ/ZURKvD2q0kTxGTwGlag08sxOsR
+YgKwLDQsIAPJRBIo6x1rU99ZnE1AKAaLjrE/MVGXyLYSVaNo4373FYU7Tz60T0f8
+C02e1nonNva0NeMB9+vZV5JwZTptq1qLl96i5szWpQRB679gf6tSNaLTMCn1UFCT
+ha0BzOuy9UI8EIHWn5St6iJ3CaoeWub3GRtp0fpiqEiryO9YepXod+V9zT9BaXPM
+CDnuNoyfrcfmdTdAxroLk2FMcg/z5XDKCyRqgvLH2pNNXn37KEhuUHDEar+UsoiI
+jzq3RARWvEozAoIBAQCKfqoVIQc+/+e9eC2mkDqtFsyvl8XJQ4RVjUKhVEVE/+ay
+LRWFR98nRxFJZWzJTAwB/ZclKZgScQ3g0KNy32q1NDMhhBXDgS7JECQgtbfKi6On
+p1lm94zhEo54VQUgl9I5usWoFK2EqQMeQR3H9yADW2zagj3mGCvvyAghN1kqf2+p
+nZHsiM3roAEQ1OdWdV5JvZM+B+WeIt1CjiRmDwJkRFQwlpT5Kvy9L0lUCtH4Sup2
+l91AuEb93AeVJlTskBoXL8qFpc4h7+2bmxRzL+XP6ZX1wOW4MF6L2NzfnbUnbAVg
+9zGO5lOKNJS6J1USBeuU36fxnYlJLu+fFUbn4InpAoIBADwtmEKzRfbbVMlh0UZG
+eFkOLva8dmve6pzDXoXC/nbtE70Y95PQDtChyWsHrZGQfqtS+LsLEdlx063cwHXw
+XVf9Gr7SMPnerCGygVcoE3Dof+ruNoShFxc1CBZJRY157xZX7JAct1NEee0CLdqY
+IPzRXZJh3Y8vVR8WXLMgctdzmiLvs5ou81RPSai16THIsxnKHwdq2i8B3EeLbhUm
+0uOy1NaGO3SbUL8Kgb05qZhm3pUj0ZgqsXc4nB6TgGMgoBSJb+EVM6HH9JTFh+Dc
+8pImEeW2zXLuxTCmQzePsg1IsKvj/vcG4/nL9awUNnzvr3HCc3HIp3gnKCpngI9v
+VwUCggEAW+m7BDMuVQhGfbk62Pe+w54532JMsUdlmgI43wOXBi8NbxMaZiv/pyeF
+nAnxL6Ar+DhR0OG45ZFtEXU5KqGvS9e/nf+Y8dpbEhSpSa7XIEXV57aChgxwTBVl
+k1go0u9Kh12bl0X6aD42+nEIa/aL/8nycCzyvf+oU3CgJS8iRbmsz0BaKGrBVIU9
+IpsQIeosSH592o3n16jFtIkzIjWu16HC2Dny9uUdjLTjHPCqv34mW2EH0xD+VevW
+wh+ezl41sqniYR0U2/a90HyWz1DRASUMLGAiyqghUc9DANjh072tU58yzuott0L7
+lZqnHGyRAFqP6UxZgtwu30KuKIZBlg==
-----END PRIVATE KEY-----
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
index 8d08ae838..4d5aedbaa 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/pom.xml
@@ -30,8 +30,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageExtensions.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageExtensions.kt
index a817c0c74..509689eca 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageExtensions.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageExtensions.kt
@@ -20,7 +20,6 @@ import org.apache.kafka.common.header.Headers
import org.apache.kafka.common.header.internals.RecordHeader
import java.nio.charset.Charset
-
fun <T : Headers> T?.toMap(): MutableMap<String, String> {
val map: MutableMap<String, String> = hashMapOf()
this?.forEach { map[it.key()] = String(it.value(), Charset.defaultCharset()) }
@@ -29,4 +28,4 @@ fun <T : Headers> T?.toMap(): MutableMap<String, String> {
fun Headers.addHeader(key: String, value: String) {
this.add(RecordHeader(key, value.toByteArray()))
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
index ecffa280f..cc4c7fa4a 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibConfiguration.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.message
-
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService
import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BlueprintMessageConsumerService
@@ -36,14 +35,13 @@ open class BluePrintMessageLibConfiguration
* Exposed Dependency Service by this Message Lib Module
*/
fun BluePrintDependencyService.messageLibPropertyService(): BluePrintMessageLibPropertyService =
- instance(MessageLibConstants.SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY)
+ instance(MessageLibConstants.SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY)
/** Extension functions for message producer service **/
fun BluePrintDependencyService.messageProducerService(selector: String): BlueprintMessageProducerService {
return messageLibPropertyService().blueprintMessageProducerService(selector)
}
-
fun BluePrintDependencyService.messageProducerService(jsonNode: JsonNode): BlueprintMessageProducerService {
return messageLibPropertyService().blueprintMessageProducerService(jsonNode)
}
@@ -65,4 +63,4 @@ class MessageLibConstants {
const val TYPE_KAFKA_BASIC_AUTH = "kafka-basic-auth"
const val TYPE_KAFKA_STREAMS_BASIC_AUTH = "kafka-streams-basic-auth"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
index d0c3d5ae1..59e3606ea 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/BluePrintMessageLibData.kt
@@ -22,7 +22,6 @@ import org.apache.kafka.streams.StreamsConfig
/** Producer Properties **/
open class MessageProducerProperties
-
open class KafkaBasicAuthMessageProducerProperties : MessageProducerProperties() {
lateinit var bootstrapServers: String
var topic: String? = null
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/kafka/AbstractKafkaTopologyComponents.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/kafka/AbstractKafkaTopologyComponents.kt
index 4c6c0acdd..72a70893a 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/kafka/AbstractKafkaTopologyComponents.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/kafka/AbstractKafkaTopologyComponents.kt
@@ -30,7 +30,6 @@ abstract class AbstractBluePrintMessageProcessor<K, V> : Processor<K, V> {
lateinit var processorContext: ProcessorContext
-
override fun process(key: K, value: V) = runBlocking(Dispatchers.IO) {
try {
processNB(key, value)
@@ -42,7 +41,6 @@ abstract class AbstractBluePrintMessageProcessor<K, V> : Processor<K, V> {
override fun init(context: ProcessorContext) {
log.info("initializing processor (${this.javaClass.simpleName})")
this.processorContext = context
-
}
override fun close() {
@@ -54,12 +52,12 @@ abstract class AbstractBluePrintMessageProcessor<K, V> : Processor<K, V> {
/** CDS Kafka Stream Punctuator abstract class to implement */
abstract class AbstractBluePrintMessagePunctuator : Punctuator {
- lateinit var processorContext: ProcessorContext
+ lateinit var processorContext: ProcessorContext
override fun punctuate(timestamp: Long) = runBlocking(Dispatchers.IO) {
punctuateNB(timestamp)
}
abstract suspend fun punctuateNB(timestamp: Long)
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
index 853b88bc9..44b50af44 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BluePrintMessageLibPropertyService.kt
@@ -19,7 +19,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.message.service
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.message.*
+import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageConsumerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaBasicAuthMessageProducerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaStreamsBasicAuthConsumerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageConsumerProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.message.MessageProducerProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.stereotype.Service
@@ -62,8 +67,8 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
}
}
- private fun blueprintMessageProducerService(MessageProducerProperties: MessageProducerProperties)
- : BlueprintMessageProducerService {
+ private fun blueprintMessageProducerService(MessageProducerProperties: MessageProducerProperties):
+ BlueprintMessageProducerService {
when (MessageProducerProperties) {
is KafkaBasicAuthMessageProducerProperties -> {
@@ -77,7 +82,8 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
private fun kafkaBasicAuthMessageProducerProperties(prefix: String): KafkaBasicAuthMessageProducerProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaBasicAuthMessageProducerProperties::class.java)
+ prefix, KafkaBasicAuthMessageProducerProperties::class.java
+ )
}
/** Consumer Property Lib Service Implementation **/
@@ -126,8 +132,8 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
}
}
- private fun blueprintMessageConsumerService(messageConsumerProperties: MessageConsumerProperties)
- : BlueprintMessageConsumerService {
+ private fun blueprintMessageConsumerService(messageConsumerProperties: MessageConsumerProperties):
+ BlueprintMessageConsumerService {
when (messageConsumerProperties) {
is KafkaBasicAuthMessageConsumerProperties -> {
@@ -144,12 +150,13 @@ open class BluePrintMessageLibPropertyService(private var bluePrintPropertiesSer
private fun kafkaBasicAuthMessageConsumerProperties(prefix: String): KafkaBasicAuthMessageConsumerProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaBasicAuthMessageConsumerProperties::class.java)
+ prefix, KafkaBasicAuthMessageConsumerProperties::class.java
+ )
}
private fun kafkaStreamsBasicAuthMessageConsumerProperties(prefix: String): KafkaStreamsBasicAuthConsumerProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, KafkaStreamsBasicAuthConsumerProperties::class.java)
+ prefix, KafkaStreamsBasicAuthConsumerProperties::class.java
+ )
}
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
index 716fda609..f74abcdb7 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerService.kt
@@ -50,21 +50,31 @@ interface BlueprintMessageConsumerService {
}
/** Consume the [topics] with [additionalConfig], so that we can execute dynamic function [consumerFunction] */
- suspend fun consume(topics: List<String>, additionalConfig: Map<String, Any>?,
- consumerFunction: ConsumerFunction) {
+ suspend fun consume(
+ topics: List<String>,
+ additionalConfig: Map<String, Any>?,
+ consumerFunction: ConsumerFunction
+ ) {
throw BluePrintProcessorException("Not Implemented")
}
/** close the channel, consumer and other resources */
suspend fun shutDown()
}
+
/** Consumer dynamic implementation interface */
interface KafkaConsumerRecordsFunction : ConsumerFunction {
- suspend fun invoke(messageConsumerProperties: MessageConsumerProperties, consumer: Consumer<*, *>,
- consumerRecords: ConsumerRecords<*, *>)
+
+ suspend fun invoke(
+ messageConsumerProperties: MessageConsumerProperties,
+ consumer: Consumer<*, *>,
+ consumerRecords: ConsumerRecords<*, *>
+ )
}
interface KafkaStreamConsumerFunction : ConsumerFunction {
- suspend fun createTopology(messageConsumerProperties: MessageConsumerProperties,
- additionalConfig: Map<String, Any>?): Topology
-} \ No newline at end of file
+ suspend fun createTopology(
+ messageConsumerProperties: MessageConsumerProperties,
+ additionalConfig: Map<String, Any>?
+ ): Topology
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
index 7d8138639..cdc65a1c6 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerService.kt
@@ -47,4 +47,4 @@ interface BlueprintMessageProducerService {
}
suspend fun sendMessageNB(topic: String, message: Any, headers: MutableMap<String, String>?): Boolean
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt
index 757846c81..3415c8d0d 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageConsumerService.kt
@@ -34,8 +34,9 @@ import java.time.Duration
import kotlin.concurrent.thread
open class KafkaBasicAuthMessageConsumerService(
- private val messageConsumerProperties: KafkaBasicAuthMessageConsumerProperties)
- : BlueprintMessageConsumerService {
+ private val messageConsumerProperties: KafkaBasicAuthMessageConsumerProperties
+) :
+ BlueprintMessageConsumerService {
val log = logger(KafkaBasicAuthMessageConsumerService::class)
val channel = Channel<String>()
@@ -76,7 +77,6 @@ open class KafkaBasicAuthMessageConsumerService(
return subscribe(consumerTopic, additionalConfig)
}
-
override suspend fun subscribe(topics: List<String>, additionalConfig: Map<String, Any>?): Channel<String> {
/** Create Kafka consumer */
kafkaConsumer = kafkaConsumer(additionalConfig)
@@ -124,8 +124,11 @@ open class KafkaBasicAuthMessageConsumerService(
return consume(topics = consumerTopic, additionalConfig = additionalConfig, consumerFunction = consumerFunction)
}
- override suspend fun consume(topics: List<String>, additionalConfig: Map<String, Any>?,
- consumerFunction: ConsumerFunction) {
+ override suspend fun consume(
+ topics: List<String>,
+ additionalConfig: Map<String, Any>?,
+ consumerFunction: ConsumerFunction
+ ) {
val kafkaConsumerFunction = consumerFunction as KafkaConsumerRecordsFunction
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt
index ad9a594b0..8416282af 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaBasicAuthMessageProducerService.kt
@@ -20,7 +20,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.message.service
import org.apache.commons.lang.builder.ToStringBuilder
import org.apache.kafka.clients.producer.Callback
import org.apache.kafka.clients.producer.KafkaProducer
-import org.apache.kafka.clients.producer.ProducerConfig.*
+import org.apache.kafka.clients.producer.ProducerConfig.ACKS_CONFIG
+import org.apache.kafka.clients.producer.ProducerConfig.BOOTSTRAP_SERVERS_CONFIG
+import org.apache.kafka.clients.producer.ProducerConfig.CLIENT_ID_CONFIG
+import org.apache.kafka.clients.producer.ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG
+import org.apache.kafka.clients.producer.ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG
+import org.apache.kafka.clients.producer.ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG
import org.apache.kafka.clients.producer.ProducerRecord
import org.apache.kafka.common.header.internals.RecordHeader
import org.apache.kafka.common.serialization.ByteArraySerializer
@@ -32,8 +37,9 @@ import org.slf4j.LoggerFactory
import java.nio.charset.Charset
class KafkaBasicAuthMessageProducerService(
- private val messageProducerProperties: KafkaBasicAuthMessageProducerProperties)
- : BlueprintMessageProducerService {
+ private val messageProducerProperties: KafkaBasicAuthMessageProducerProperties
+) :
+ BlueprintMessageProducerService {
private val log = LoggerFactory.getLogger(KafkaBasicAuthMessageProducerService::class.java)!!
@@ -51,8 +57,11 @@ class KafkaBasicAuthMessageProducerService(
return sendMessageNB(messageProducerProperties.topic!!, message, headers)
}
- override suspend fun sendMessageNB(topic: String, message: Any,
- headers: MutableMap<String, String>?): Boolean {
+ override suspend fun sendMessageNB(
+ topic: String,
+ message: Any,
+ headers: MutableMap<String, String>?
+ ): Boolean {
val byteArrayMessage = when (message) {
is String -> message.toByteArray(Charset.defaultCharset())
else -> message.asJsonString().toByteArray(Charset.defaultCharset())
@@ -95,4 +104,3 @@ class KafkaBasicAuthMessageProducerService(
return kafkaProducer!!
}
}
-
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerService.kt
index d0297df4c..0b353d58b 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerService.kt
@@ -23,10 +23,10 @@ import org.apache.kafka.streams.StreamsConfig
import org.onap.ccsdk.cds.blueprintsprocessor.message.KafkaStreamsBasicAuthConsumerProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.logger
-import java.util.*
+import java.util.Properties
-open class KafkaStreamsBasicAuthConsumerService(private val messageConsumerProperties: KafkaStreamsBasicAuthConsumerProperties)
- : BlueprintMessageConsumerService {
+open class KafkaStreamsBasicAuthConsumerService(private val messageConsumerProperties: KafkaStreamsBasicAuthConsumerProperties) :
+ BlueprintMessageConsumerService {
val log = logger(KafkaStreamsBasicAuthConsumerService::class)
lateinit var kafkaStreams: KafkaStreams
@@ -68,4 +68,4 @@ open class KafkaStreamsBasicAuthConsumerService(private val messageConsumerPrope
kafkaStreams.close()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
index 21bf1b76c..04b754b13 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerService.kt
@@ -31,15 +31,17 @@ import java.time.Instant
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
-import java.util.*
+import java.util.UUID
class MessageLoggerService {
private val log = logger(MessageLoggerService::class)
fun messageConsuming(headers: CommonHeader, consumerRecord: ConsumerRecord<*, *>) {
- messageConsuming(headers.requestId, headers.subRequestId,
- headers.originatorId, consumerRecord)
+ messageConsuming(
+ headers.requestId, headers.subRequestId,
+ headers.originatorId, consumerRecord
+ )
}
fun messageConsuming(consumerRecord: ConsumerRecord<*, *>) {
@@ -50,14 +52,19 @@ class MessageLoggerService {
messageConsuming(requestID, invocationID, partnerName, consumerRecord)
}
-
- fun messageConsuming(requestID: String, invocationID: String, partnerName: String,
- consumerRecord: ConsumerRecord<*, *>) {
+ fun messageConsuming(
+ requestID: String,
+ invocationID: String,
+ partnerName: String,
+ consumerRecord: ConsumerRecord<*, *>
+ ) {
val headers = consumerRecord.headers().toMap()
val localhost = InetAddress.getLocalHost()
- MDC.put("InvokeTimestamp", ZonedDateTime
+ MDC.put(
+ "InvokeTimestamp", ZonedDateTime
.ofInstant(Instant.ofEpochMilli(consumerRecord.timestamp()), ZoneOffset.UTC)
- .format(DateTimeFormatter.ISO_INSTANT))
+ .format(DateTimeFormatter.ISO_INSTANT)
+ )
MDC.put("RequestID", requestID)
MDC.put("InvocationID", invocationID)
MDC.put("PartnerName", partnerName)
@@ -77,12 +84,11 @@ class MessageLoggerService {
val localhost = InetAddress.getLocalHost()
requestHeader.addHeader(BluePrintConstants.ONAP_REQUEST_ID, MDC.get("InvocationID").defaultToUUID())
requestHeader.addHeader(BluePrintConstants.ONAP_INVOCATION_ID, UUID.randomUUID().toString())
- val partnerName = System.getProperty("APPNAME") ?: "BlueprintsProcessor"
- requestHeader.addHeader(BluePrintConstants.ONAP_PARTNER_NAME, partnerName)
+ requestHeader.addHeader(BluePrintConstants.ONAP_PARTNER_NAME, BluePrintConstants.APP_NAME)
requestHeader.addHeader("ClientIPAddress", localhost.hostAddress)
}
fun messageConsumingExisting() {
MDC.clear()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
index b2accfb4d..823ba7dee 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageConsumerServiceTest.kt
@@ -23,7 +23,11 @@ import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
-import org.apache.kafka.clients.consumer.*
+import org.apache.kafka.clients.consumer.Consumer
+import org.apache.kafka.clients.consumer.ConsumerRecord
+import org.apache.kafka.clients.consumer.ConsumerRecords
+import org.apache.kafka.clients.consumer.MockConsumer
+import org.apache.kafka.clients.consumer.OffsetResetStrategy
import org.apache.kafka.common.TopicPartition
import org.junit.Test
import org.junit.runner.RunWith
@@ -40,26 +44,30 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
-
@RunWith(SpringRunner::class)
@DirtiesContext
-@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.messageconsumer.sample.type=kafka-basic-auth",
- "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.sample.groupId=sample-group",
- "blueprintsprocessor.messageconsumer.sample.topic=default-topic",
- "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageconsumer.sample.pollMillSec=10",
- "blueprintsprocessor.messageconsumer.sample.pollRecords=1",
-
- "blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id"
-])
+@ContextConfiguration(
+ classes = [BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprintsprocessor.messageconsumer.sample.type=kafka-basic-auth",
+ "blueprintsprocessor.messageconsumer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.sample.groupId=sample-group",
+ "blueprintsprocessor.messageconsumer.sample.topic=default-topic",
+ "blueprintsprocessor.messageconsumer.sample.clientId=default-client-id",
+ "blueprintsprocessor.messageconsumer.sample.pollMillSec=10",
+ "blueprintsprocessor.messageconsumer.sample.pollRecords=1",
+
+ "blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id"
+ ]
+)
open class BlueprintMessageConsumerServiceTest {
+
val log = logger(BlueprintMessageConsumerServiceTest::class)
@Autowired
@@ -69,7 +77,7 @@ open class BlueprintMessageConsumerServiceTest {
fun testKafkaBasicAuthConsumerService() {
runBlocking {
val blueprintMessageConsumerService = bluePrintMessageLibPropertyService
- .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService
+ .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService
assertNotNull(blueprintMessageConsumerService, "failed to get blueprintMessageConsumerService")
val spyBlueprintMessageConsumerService = spyk(blueprintMessageConsumerService, recordPrivateCalls = true)
@@ -93,8 +101,10 @@ open class BlueprintMessageConsumerServiceTest {
mockKafkaConsumer.updateBeginningOffsets(partitionsBeginningMap)
mockKafkaConsumer.updateEndOffsets(partitionsEndMap)
for (i in 1..10) {
- val record = ConsumerRecord<String, ByteArray>(topic, 1, i.toLong(), "key_$i",
- "I am message $i".toByteArray())
+ val record = ConsumerRecord<String, ByteArray>(
+ topic, 1, i.toLong(), "key_$i",
+ "I am message $i".toByteArray()
+ )
mockKafkaConsumer.addRecord(record)
}
@@ -114,7 +124,7 @@ open class BlueprintMessageConsumerServiceTest {
fun testKafkaBasicAuthConsumerWithDynamicFunction() {
runBlocking {
val blueprintMessageConsumerService = bluePrintMessageLibPropertyService
- .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService
+ .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService
assertNotNull(blueprintMessageConsumerService, "failed to get blueprintMessageConsumerService")
val spyBlueprintMessageConsumerService = spyk(blueprintMessageConsumerService, recordPrivateCalls = true)
@@ -138,16 +148,21 @@ open class BlueprintMessageConsumerServiceTest {
mockKafkaConsumer.updateBeginningOffsets(partitionsBeginningMap)
mockKafkaConsumer.updateEndOffsets(partitionsEndMap)
for (i in 1..10) {
- val record = ConsumerRecord<String, ByteArray>(topic, 1, i.toLong(), "key_$i",
- "I am message $i".toByteArray())
+ val record = ConsumerRecord<String, ByteArray>(
+ topic, 1, i.toLong(), "key_$i",
+ "I am message $i".toByteArray()
+ )
mockKafkaConsumer.addRecord(record)
}
every { spyBlueprintMessageConsumerService.kafkaConsumer(any()) } returns mockKafkaConsumer
/** Test Consumer Function implementation */
val consumerFunction = object : KafkaConsumerRecordsFunction {
- override suspend fun invoke(messageConsumerProperties: MessageConsumerProperties,
- consumer: Consumer<*, *>, consumerRecords: ConsumerRecords<*, *>) {
+ override suspend fun invoke(
+ messageConsumerProperties: MessageConsumerProperties,
+ consumer: Consumer<*, *>,
+ consumerRecords: ConsumerRecords<*, *>
+ ) {
val count = consumerRecords.count()
log.trace("Received Message count($count)")
}
@@ -159,11 +174,11 @@ open class BlueprintMessageConsumerServiceTest {
}
/** Integration Kafka Testing, Enable and use this test case only for local desktop testing with real kafka broker */
- //@Test
+ // @Test
fun testKafkaIntegration() {
runBlocking {
val blueprintMessageConsumerService = bluePrintMessageLibPropertyService
- .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService
+ .blueprintMessageConsumerService("sample") as KafkaBasicAuthMessageConsumerService
assertNotNull(blueprintMessageConsumerService, "failed to get blueprintMessageConsumerService")
val channel = blueprintMessageConsumerService.subscribe(null)
@@ -175,18 +190,20 @@ open class BlueprintMessageConsumerServiceTest {
/** Send message with every 1 sec */
val blueprintMessageProducerService = bluePrintMessageLibPropertyService
- .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService
+ .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService
launch {
repeat(5) {
delay(100)
val headers: MutableMap<String, String> = hashMapOf()
headers["id"] = it.toString()
- blueprintMessageProducerService.sendMessageNB(message = "this is my message($it)",
- headers = headers)
+ blueprintMessageProducerService.sendMessageNB(
+ message = "this is my message($it)",
+ headers = headers
+ )
}
}
delay(5000)
blueprintMessageConsumerService.shutDown()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
index 4fe5f5dd1..b824189d2 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/BlueprintMessageProducerServiceTest.kt
@@ -35,17 +35,20 @@ import java.util.concurrent.Future
import kotlin.test.Test
import kotlin.test.assertTrue
-
@RunWith(SpringRunner::class)
@DirtiesContext
-@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id"
-])
+@ContextConfiguration(
+ classes = [BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id"
+ ]
+)
open class BlueprintMessageProducerServiceTest {
@Autowired
@@ -55,7 +58,7 @@ open class BlueprintMessageProducerServiceTest {
fun testKafkaBasicAuthProducertService() {
runBlocking {
val blueprintMessageProducerService = bluePrintMessageLibPropertyService
- .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService
+ .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService
val mockKafkaTemplate = mockk<KafkaProducer<String, ByteArray>>()
@@ -72,8 +75,4 @@ open class BlueprintMessageProducerServiceTest {
assertTrue(response, "failed to get command response")
}
}
-
}
-
-
-
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerServiceTest.kt
index 9cd974622..1657d70b4 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaStreamsBasicAuthConsumerServiceTest.kt
@@ -38,25 +38,29 @@ import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
-
@RunWith(SpringRunner::class)
@DirtiesContext
-@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-[
- "blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth",
- "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageproducer.sample.topic=default-stream-topic",
- "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
+@ContextConfiguration(
+ classes = [BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ [
+ "blueprintsprocessor.messageproducer.sample.type=kafka-basic-auth",
+ "blueprintsprocessor.messageproducer.sample.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageproducer.sample.topic=default-stream-topic",
+ "blueprintsprocessor.messageproducer.sample.clientId=default-client-id",
- "blueprintsprocessor.messageconsumer.stream-consumer.type=kafka-streams-basic-auth",
- "blueprintsprocessor.messageconsumer.stream-consumer.bootstrapServers=127.0.0.1:9092",
- "blueprintsprocessor.messageconsumer.stream-consumer.applicationId=test-streams-application",
- "blueprintsprocessor.messageconsumer.stream-consumer.topic=default-stream-topic"
+ "blueprintsprocessor.messageconsumer.stream-consumer.type=kafka-streams-basic-auth",
+ "blueprintsprocessor.messageconsumer.stream-consumer.bootstrapServers=127.0.0.1:9092",
+ "blueprintsprocessor.messageconsumer.stream-consumer.applicationId=test-streams-application",
+ "blueprintsprocessor.messageconsumer.stream-consumer.topic=default-stream-topic"
-])
+ ]
+)
class KafkaStreamsBasicAuthConsumerServiceTest {
+
@Autowired
lateinit var bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService
@@ -67,15 +71,17 @@ class KafkaStreamsBasicAuthConsumerServiceTest {
}
/** Integration Kafka Testing, Enable and use this test case only for local desktop testing with real kafka broker */
- //@Test
+ // @Test
fun testKafkaStreamingMessageConsumer() {
runBlocking {
val streamingConsumerService = bluePrintMessageLibPropertyService.blueprintMessageConsumerService("stream-consumer")
// Dynamic Consumer Function to create Topology
val consumerFunction = object : KafkaStreamConsumerFunction {
- override suspend fun createTopology(messageConsumerProperties: MessageConsumerProperties,
- additionalConfig: Map<String, Any>?): Topology {
+ override suspend fun createTopology(
+ messageConsumerProperties: MessageConsumerProperties,
+ additionalConfig: Map<String, Any>?
+ ): Topology {
val topology = Topology()
val kafkaStreamsBasicAuthConsumerProperties = messageConsumerProperties
as KafkaStreamsBasicAuthConsumerProperties
@@ -93,29 +99,34 @@ class KafkaStreamsBasicAuthConsumerServiceTest {
// Store Buolder
val countStoreSupplier = Stores.keyValueStoreBuilder(
- Stores.persistentKeyValueStore("PriorityMessageState"),
- Serdes.String(),
- PriorityMessageSerde())
- .withLoggingEnabled(changelogConfig)
+ Stores.persistentKeyValueStore("PriorityMessageState"),
+ Serdes.String(),
+ PriorityMessageSerde()
+ )
+ .withLoggingEnabled(changelogConfig)
topology.addProcessor("FirstProcessor", firstProcessorSupplier, "Source")
topology.addStateStore(countStoreSupplier, "FirstProcessor")
- topology.addSink("SINK", "default-stream-topic-out", Serdes.String().serializer(),
- PriorityMessageSerde().serializer(), "FirstProcessor")
+ topology.addSink(
+ "SINK", "default-stream-topic-out", Serdes.String().serializer(),
+ PriorityMessageSerde().serializer(), "FirstProcessor"
+ )
return topology
}
}
/** Send message with every 1 sec */
val blueprintMessageProducerService = bluePrintMessageLibPropertyService
- .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService
+ .blueprintMessageProducerService("sample") as KafkaBasicAuthMessageProducerService
launch {
repeat(5) {
delay(1000)
val headers: MutableMap<String, String> = hashMapOf()
headers["id"] = it.toString()
- blueprintMessageProducerService.sendMessageNB(message = "this is my message($it)",
- headers = headers)
+ blueprintMessageProducerService.sendMessageNB(
+ message = "this is my message($it)",
+ headers = headers
+ )
}
}
streamingConsumerService.consume(null, consumerFunction)
@@ -123,4 +134,4 @@ class KafkaStreamsBasicAuthConsumerServiceTest {
streamingConsumerService.shutDown()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerServiceTest.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerServiceTest.kt
index 82e40efd1..3dce3344f 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MessageLoggerServiceTest.kt
@@ -29,7 +29,6 @@ import kotlin.test.assertEquals
class MessageLoggerServiceTest {
-
@Test
fun testMessagingHeaders() {
val messageLoggerService = MessageLoggerService()
@@ -55,7 +54,5 @@ class MessageLoggerServiceTest {
assertEquals("1234-12", map[BluePrintConstants.ONAP_REQUEST_ID])
messageLoggerService.messageConsumingExisting()
-
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
index 4db9c772e..5d77c3746 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/MockKafkaTopologyComponents.kt
@@ -28,7 +28,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import java.io.Serializable
import java.nio.charset.Charset
-import java.util.*
+import java.util.UUID
class PriorityMessage : Serializable {
lateinit var id: String
@@ -47,7 +47,7 @@ open class PriorityMessageSerde : Serde<PriorityMessage> {
return object : Deserializer<PriorityMessage> {
override fun deserialize(topic: String, data: ByteArray): PriorityMessage {
return JacksonUtils.readValue(String(data), PriorityMessage::class.java)
- ?: throw BluePrintProcessorException("failed to convert")
+ ?: throw BluePrintProcessorException("failed to convert")
}
override fun configure(configs: MutableMap<String, *>?, isKey: Boolean) {
@@ -73,7 +73,6 @@ open class PriorityMessageSerde : Serde<PriorityMessage> {
}
}
-
class FirstProcessor : Processor<ByteArray, ByteArray> {
private val log = logger(FirstProcessor::class)
@@ -100,4 +99,4 @@ class FirstProcessor : Processor<ByteArray, ByteArray> {
override fun close() {
log.info("Close...")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/pom.xml b/ms/blueprintsprocessor/modules/commons/pom.xml
index 33255ac46..30c34ab52 100755
--- a/ms/blueprintsprocessor/modules/commons/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/pom.xml
@@ -44,8 +44,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>resource-dict</artifactId>
</dependency>
<!-- Test Dependencies -->
<dependency>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
index a79e8d6df..2f5ae6624 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/pom.xml
@@ -33,8 +33,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-proto</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-proto</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt
index 47b55b018..8e1b5b2ce 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/ApiDataExtensions.kt
@@ -1,5 +1,6 @@
/*
* Copyright © 2019 IBM.
+ * Modifications Copyright © 2018-2019 AT&T Intellectual Property.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +17,39 @@
package org.onap.ccsdk.cds.blueprintsprocessor.core
+import com.fasterxml.jackson.databind.JsonNode
+import com.google.protobuf.Struct
+import com.google.protobuf.util.JsonFormat
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
import org.onap.ccsdk.cds.controllerblueprints.core.asType
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import kotlin.reflect.KClass
-
fun <T : Any> ExecutionServiceInput.payloadAsType(clazzType: KClass<T>): T {
val actionName = this.actionIdentifiers.actionName
val requestJsonNode = this.payload.get("$actionName-request")
return requestJsonNode.asType(clazzType.java)
-} \ No newline at end of file
+}
+
+/** Convert Proto Struct to Json string */
+fun Struct.asJson(): String {
+ return JsonFormat.printer().print(this)
+}
+
+/** Convert Proto Struct to Json node */
+fun Struct.asJsonType(): JsonNode {
+ return this.asJson().jsonAsJsonType()
+}
+
+/** Convert Json node to Proto Struct */
+fun JsonNode.asProtoStruct(): Struct {
+ return this.asJsonString(false).asProtoStruct()
+}
+
+/** Convert Json string to Proto Struct */
+fun String.asProtoStruct(): Struct {
+ val struct = Struct.newBuilder()
+ JsonFormat.parser().merge(this, struct)
+ return struct.build()
+}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
index 62dc933f1..76b37a5b4 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
@@ -41,12 +41,13 @@ open class BluePrintCoreConfiguration(private val bluePrintPropertiesService: Bl
@Bean
open fun bluePrintLoadConfiguration(): BluePrintLoadConfiguration {
return bluePrintPropertiesService
- .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintLoadConfiguration::class.java)
+ .propertyBeanType(PREFIX_BLUEPRINT_PROCESSOR, BluePrintLoadConfiguration::class.java)
}
}
@Configuration
open class BluePrintPropertyConfiguration {
+
@Autowired
lateinit var environment: Environment
@@ -59,6 +60,7 @@ open class BluePrintPropertyConfiguration {
@Service
open class BluePrintPropertiesService(private var bluePrintPropertyBinder: Binder) {
+
fun <T> propertyBeanType(prefix: String, type: Class<T>): T {
return bluePrintPropertyBinder.bind(prefix, Bindable.of(type)).get()
}
@@ -74,5 +76,4 @@ open class BlueprintDependencyConfiguration : ApplicationContextAware {
BluePrintDependencyService.inject(applicationContext)
log.info("Dependency Management module created...")
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
index dae6eea85..d94985400 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
@@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode
import io.swagger.annotations.ApiModelProperty
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import java.util.*
+import java.util.Date
/**
* BlueprintProcessorData
@@ -33,14 +33,17 @@ import java.util.*
*/
open class ExecutionServiceInput {
+
@get:ApiModelProperty(required = true, value = "Headers providing request context.")
lateinit var commonHeader: CommonHeader
@get:ApiModelProperty(required = true, value = "Provide information about the action to execute.")
lateinit var actionIdentifiers: ActionIdentifiers
- @get:ApiModelProperty(required = true,
- value = "Contain the information to be passed as input to the action." +
- "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
- " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
+ @get:ApiModelProperty(
+ required = true,
+ value = "Contain the information to be passed as input to the action." +
+ "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+ " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
+ )
lateinit var payload: ObjectNode
@get:ApiModelProperty(hidden = true)
@get:JsonIgnore
@@ -54,10 +57,12 @@ open class ExecutionServiceOutput {
lateinit var actionIdentifiers: ActionIdentifiers
@get:ApiModelProperty(required = true, value = "Status of the request.")
lateinit var status: Status
- @get:ApiModelProperty(required = true,
- value = "Contain the information to be passed as input to the action." +
- "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
- " and the input for resource resolution located within the xxx-request block, contained within xxx-properties")
+ @get:ApiModelProperty(
+ required = true,
+ value = "Contain the information to be passed as input to the action." +
+ "The payload is constituted of two section: the workflow input which is the higher level block (xxx-request)" +
+ " and the input for resource resolution located within the xxx-request block, contained within xxx-properties"
+ )
lateinit var payload: ObjectNode
@get:ApiModelProperty(hidden = true)
@get:JsonIgnore
@@ -74,9 +79,11 @@ open class ActionIdentifiers {
lateinit var blueprintVersion: String
@get:ApiModelProperty(required = true, value = "Name of the workflow to execute.")
lateinit var actionName: String
- @get:ApiModelProperty(required = true,
- value = "Async processing is only supported for gRPC client.",
- allowableValues = "sync, async")
+ @get:ApiModelProperty(
+ required = true,
+ value = "Async processing is only supported for gRPC client.",
+ allowableValues = "sync, async"
+ )
lateinit var mode: String
}
@@ -106,9 +113,11 @@ open class Status {
var code: Int = 200
@get:ApiModelProperty(required = true, value = "Type of the event being emitted by CDS.")
var eventType: String = EventType.EVENT_COMPONENT_EXECUTED.name
- @get:ApiModelProperty(required = true,
- value = "Time when the execution ended.",
- example = "2012-04-23T18:25:43.511Z")
+ @get:ApiModelProperty(
+ required = true,
+ value = "Time when the execution ended.",
+ example = "2012-04-23T18:25:43.511Z"
+ )
@get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp: Date = Date()
@get:ApiModelProperty(required = false, value = "Error message when system failed")
@@ -120,4 +129,4 @@ open class Status {
open class StepData {
lateinit var name: String
var properties: MutableMap<String, JsonNode> = mutableMapOf()
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
index d63f34ced..628b65ea4 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt
@@ -17,34 +17,39 @@
package org.onap.ccsdk.cds.blueprintsprocessor.core.api.data
import com.fasterxml.jackson.databind.JsonNode
-import java.util.*
+import java.util.Date
enum class StatusType {
SUCCESS, FAILURE
}
-data class RemoteIdentifier(var blueprintName: String,
- var blueprintVersion: String)
-
-
-data class RemoteScriptExecutionInput(var requestId: String,
- var correlationId: String? = null,
- var remoteIdentifier: RemoteIdentifier? = null,
- var command: String,
- var timeOut: Long = 30,
- var properties: MutableMap<String, JsonNode> = hashMapOf()
+data class RemoteIdentifier(
+ var blueprintName: String,
+ var blueprintVersion: String
)
+data class RemoteScriptExecutionInput(
+ var requestId: String,
+ var correlationId: String? = null,
+ var remoteIdentifier: RemoteIdentifier? = null,
+ var command: String,
+ var timeOut: Long = 30,
+ var properties: MutableMap<String, JsonNode> = hashMapOf()
+)
-data class RemoteScriptExecutionOutput(var requestId: String,
- var response: List<String>,
- var status: StatusType = StatusType.SUCCESS,
- var timestamp: Date = Date(),
- var payload: JsonNode)
+data class RemoteScriptExecutionOutput(
+ var requestId: String,
+ var response: List<String>,
+ var status: StatusType = StatusType.SUCCESS,
+ var timestamp: Date = Date(),
+ var payload: JsonNode
+)
-data class PrepareRemoteEnvInput(var requestId: String,
- var correlationId: String? = null,
- var remoteIdentifier: RemoteIdentifier? = null,
- var packages: JsonNode,
- var timeOut: Long = 120,
- var properties: MutableMap<String, JsonNode> = hashMapOf())
+data class PrepareRemoteEnvInput(
+ var requestId: String,
+ var correlationId: String? = null,
+ var remoteIdentifier: RemoteIdentifier? = null,
+ var packages: JsonNode,
+ var timeOut: Long = 120,
+ var properties: MutableMap<String, JsonNode> = hashMapOf()
+)
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
index bb2c040f7..2f925dc5b 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
@@ -48,6 +48,7 @@ interface ComponentNode {
* @author Brinda Santh
*/
open class ComponentNodeFactory : ApplicationContextAware {
+
private val log = LoggerFactory.getLogger(ComponentNodeFactory::class.java)
var componentNodes: MutableMap<String, ComponentNode> = hashMapOf()
@@ -65,4 +66,4 @@ open class ComponentNodeFactory : ApplicationContextAware {
componentNodes = context.getBeansOfType(ComponentNode::class.java)
log.info("Injected Component Nodes : {}", componentNodes)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/ApiDataUtils.kt
index 9cd00a3ba..24ed45c52 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappings.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/ApiDataUtils.kt
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Bell Canada.
+ * Modifications Copyright © 2018-2019 AT&T Intellectual Property.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,20 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.blueprintsprocessor.core.utils
import com.fasterxml.jackson.databind.node.ObjectNode
-import com.google.common.base.Strings
import com.google.protobuf.Struct
import com.google.protobuf.util.JsonFormat
-import org.onap.ccsdk.cds.controllerblueprints.common.api.*
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_SYNC
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
+import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
+import org.onap.ccsdk.cds.controllerblueprints.common.api.Flag
+import org.onap.ccsdk.cds.controllerblueprints.common.api.Status
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.controllerDate
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.currentTimestamp
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.toControllerDate
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput
-import java.text.SimpleDateFormat
-import java.util.*
-
-private val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
// ACTION IDENTIFIER
@@ -55,8 +60,10 @@ fun org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader.toProto():
commonHeader.originatorId = this.originatorId
commonHeader.requestId = this.requestId
commonHeader.subRequestId = this.subRequestId
- commonHeader.timestamp = this.timestamp.toString()
- commonHeader.flag = this.flags?.toProto()
+ commonHeader.timestamp = this.timestamp.currentTimestamp()
+ if (this.flags != null) {
+ commonHeader.flag = this.flags!!.toProto()
+ }
return commonHeader.build()
}
@@ -65,10 +72,10 @@ fun CommonHeader.toJava(): org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.
commonHeader.originatorId = this.originatorId
commonHeader.requestId = this.requestId
commonHeader.subRequestId = this.subRequestId
- commonHeader.timestamp = if (!Strings.isNullOrEmpty(this.timestamp)) {
- formatter.parse(this.timestamp)
+ commonHeader.timestamp = if (!this.timestamp.isNullOrEmpty()) {
+ this.timestamp!!.toControllerDate()
} else {
- Date()
+ controllerDate()
}
commonHeader.flags = this.flag?.toJava()
return commonHeader
@@ -123,4 +130,75 @@ fun org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput.
JsonFormat.parser().merge(JacksonUtils.getJson(this.payload), struct)
executionServiceOuput.payload = struct.build()
return executionServiceOuput.build()
-} \ No newline at end of file
+}
+
+/** Create proto common header with [requestId] [subRequestId] and [originator] */
+fun createCommonHeaderProto(
+ requestId: String,
+ subRequestId: String,
+ originator: String
+) = CommonHeader.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setOriginatorId(originator)
+ .setRequestId(requestId)
+ .setSubRequestId(subRequestId).build()!!
+
+/** Create proto action identifiers with [name] [version] and [action] */
+fun createActionIdentifiersProto(
+ name: String,
+ version: String,
+ action: String
+) = ActionIdentifiers.newBuilder()
+ .setBlueprintName(name)
+ .setBlueprintVersion(version)
+ .setActionName(action)
+ .setMode(ACTION_MODE_SYNC)
+ .build()!!
+
+/** Create proto status with [message] and [code] */
+fun createStatus(
+ message: String,
+ code: Int
+) = Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(message)
+ .setCode(code)
+ .build()!!
+
+/** Create ExecutionServiceInput using [commonHeader], [actionIdentifier] and response payload [jsonContent] */
+fun createExecutionServiceInputProto(
+ commonHeader: CommonHeader,
+ actionIdentifier: ActionIdentifiers,
+ jsonContent: String
+): ExecutionServiceInput {
+
+ val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
+ JsonFormat.parser().merge(jsonContent, payloadBuilder)
+
+ return ExecutionServiceInput.newBuilder()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
+}
+
+/** Create ExecutionServiceOutput using [commonHeader], [actionIdentifier] [status]and
+ * response payload [jsonContent]
+ * */
+fun createExecutionServiceOutputProto(
+ commonHeader: CommonHeader,
+ actionIdentifier: ActionIdentifiers,
+ status: Status,
+ jsonContent: String
+): ExecutionServiceOutput {
+
+ val payloadBuilder = ExecutionServiceOutput.newBuilder().payloadBuilder
+ JsonFormat.parser().merge(jsonContent, payloadBuilder)
+
+ return ExecutionServiceOutput.newBuilder()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setStatus(status)
+ .setPayload(payloadBuilder.build())
+ .build()
+}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt
index 9eb95e679..426e43cda 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/PayloadUtils.kt
@@ -18,30 +18,56 @@ package org.onap.ccsdk.cds.blueprintsprocessor.core.utils
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
+import org.onap.ccsdk.cds.controllerblueprints.core.returnNullIfMissing
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
+object PayloadUtils {
-class PayloadUtils {
+ fun prepareRequestPayloadStr(workflowName: String, jsonNode: JsonNode): String {
+ return prepareRequestPayload(workflowName, jsonNode).asJsonString(false)
+ }
- companion object {
+ fun prepareRequestPayload(workflowName: String, jsonNode: JsonNode): JsonNode {
+ val objectNode = JacksonUtils.objectMapper.createObjectNode()
+ objectNode["$workflowName-request"] = jsonNode
+ return objectNode
+ }
- fun prepareInputsFromWorkflowPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode, workflowName: String) {
- val input = payload.get("$workflowName-request")
- bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
- }
+ fun getResponseDataFromPayload(workflowName: String, responsePayload: JsonNode): JsonNode {
+ return responsePayload.get("$workflowName-response").returnNullIfMissing()
+ ?: throw BluePrintProcessorException("failed to get property($workflowName-response)")
+ }
- fun prepareDynamicInputsFromWorkflowPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode, workflowName: String) {
- val input = payload.get("$workflowName-request")
- val propertyFields = input.get("$workflowName-properties")
- prepareDynamicInputsFromComponentPayload(bluePrintRuntimeService, propertyFields)
- }
+ fun prepareInputsFromWorkflowPayload(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ payload: JsonNode,
+ workflowName: String
+ ) {
+ val input = payload.get("$workflowName-request")
+ bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
+ }
+
+ fun prepareDynamicInputsFromWorkflowPayload(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ payload: JsonNode,
+ workflowName: String
+ ) {
+ val input = payload.get("$workflowName-request")
+ val propertyFields = input.get("$workflowName-properties")
+ prepareDynamicInputsFromComponentPayload(bluePrintRuntimeService, propertyFields)
+ }
- fun prepareDynamicInputsFromComponentPayload(bluePrintRuntimeService: BluePrintRuntimeService<*>, payload: JsonNode) {
- payload.fields().forEach { property ->
- val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
- .append(BluePrintConstants.PATH_DIVIDER).append(property.key).toString()
- bluePrintRuntimeService.put(path, property.value)
- }
+ fun prepareDynamicInputsFromComponentPayload(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ payload: JsonNode
+ ) {
+ payload.fields().forEach { property ->
+ val path = StringBuilder(BluePrintConstants.PATH_INPUTS)
+ .append(BluePrintConstants.PATH_DIVIDER).append(property.key).toString()
+ bluePrintRuntimeService.put(path, property.value)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt
index 3dd629c13..c27285020 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/BluePrintPropertiesTest.kt
@@ -17,4 +17,4 @@
package org.onap.ccsdk.cds.blueprintsprocessor.core
// TODO
-open class BluePrintPropertiesTest \ No newline at end of file
+open class BluePrintPropertiesTest
diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingTests.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingsTest.kt
index b1d7d144c..e8bdbf9ef 100644
--- a/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingTests.kt
+++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/utils/BluePrintMappingsTest.kt
@@ -8,6 +8,7 @@ import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.common.api.Flag
+import org.onap.ccsdk.cds.controllerblueprints.core.utils.currentTimestamp
import org.springframework.test.context.junit4.SpringRunner
import java.text.SimpleDateFormat
@@ -70,7 +71,9 @@ class BluePrintMappingsTest {
fun commonHeaderToJavaTest() {
val flag = Flag.newBuilder().setIsForce(true).setTtl(2).build()
- val commonHeader = CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString).setFlag(flag).build()
+ val commonHeader =
+ CommonHeader.newBuilder().setOriginatorId("Origin").setRequestId("requestID").setSubRequestId("subRequestID").setTimestamp(dateString)
+ .setFlag(flag).build()
val commonHeader2 = commonHeader.toJava()
Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
@@ -96,12 +99,14 @@ class BluePrintMappingsTest {
Assert.assertEquals(commonHeader.originatorId, commonHeader2.originatorId)
Assert.assertEquals(commonHeader.requestId, commonHeader2.requestId)
Assert.assertEquals(commonHeader.subRequestId, commonHeader2.subRequestId)
- Assert.assertEquals(commonHeader.timestamp.toString(), commonHeader2.timestamp)
+ Assert.assertEquals(commonHeader.timestamp.currentTimestamp(), commonHeader2.timestamp)
}
@Test
fun actionIdentifierToJavaTest() {
- val actionIdentifiers = ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0").setMode("Execution").build()
+ val actionIdentifiers =
+ ActionIdentifiers.newBuilder().setActionName("Process Action").setBlueprintName("BlueprintName").setBlueprintVersion("3.0")
+ .setMode("Execution").build()
val actionIdentifiers2 = actionIdentifiers.toJava()
Assert.assertEquals(actionIdentifiers.actionName, actionIdentifiers2.actionName)
@@ -129,4 +134,4 @@ class BluePrintMappingsTest {
Assert.assertEquals(actionIdentifiers.blueprintVersion, actionIdentifiers2.blueprintVersion)
Assert.assertEquals(actionIdentifiers.mode, actionIdentifiers2.mode)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
index a7d49c5ed..20835f0b2 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/pom.xml
@@ -33,8 +33,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
index 182d5defa..9e1be36a7 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibConfiguration.kt
@@ -35,19 +35,16 @@ open class BluePrintRestLibConfiguration
* Exposed Dependency Service by this Rest Lib Module
*/
fun BluePrintDependencyService.restLibPropertyService(): BluePrintRestLibPropertyService =
- instance(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
-
+ instance(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY)
fun BluePrintDependencyService.restClientService(selector: String): BlueprintWebClientService {
return restLibPropertyService().blueprintWebClientService(selector)
}
-
fun BluePrintDependencyService.restClientService(jsonNode: JsonNode): BlueprintWebClientService {
return restLibPropertyService().blueprintWebClientService(jsonNode)
}
-
class RestLibConstants {
companion object {
const val SERVICE_BLUEPRINT_REST_LIB_PROPERTY = "blueprint-rest-lib-property-service"
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
index ea32a1635..4c18f81ab 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/BluePrintRestLibData.kt
@@ -35,11 +35,13 @@ open class SSLRestClientProperties : RestClientProperties() {
// FIXME("Define basic auth userName and password properties")
open class SSLBasicAuthRestClientProperties : SSLRestClientProperties() {
+
var basicAuth: BasicAuthRestClientProperties? = null
}
// FIXME("Define token properties")
open class SSLTokenAuthRestClientProperties : SSLRestClientProperties() {
+
var tokenAuth: TokenAuthRestClientProperties? = null
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
index a3da44f61..429931377 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/RestClientPropertiesDSL.kt
@@ -129,9 +129,9 @@ open class SSLRestClientPropertiesBuilder : RestClientPropertiesBuilder() {
}
open class SSLBasicAuthRestClientPropertiesBuilder : SSLRestClientPropertiesBuilder() {
- //TODO()
+ // TODO()
}
open class SSLTokenAuthRestClientPropertiesBuilder : SSLRestClientPropertiesBuilder() {
- //TODO()
-} \ No newline at end of file
+ // TODO()
+}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
index 5aaee24de..5b6691eff 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/filters/RestServerLoggingWebFilter.kt
@@ -24,15 +24,15 @@ import org.springframework.web.server.WebFilterChain
import reactor.core.publisher.Mono
import reactor.util.context.Context
-
open class RestServerLoggingWebFilter : WebFilter {
override fun filter(serverWebExchange: ServerWebExchange, webFilterChain: WebFilterChain): Mono<Void> {
val loggingService = RestLoggerService()
loggingService.entering(serverWebExchange.request)
val filterChain = webFilterChain.filter(serverWebExchange).subscriberContext(
- Context.of(MDCContext, MDCContext()))
+ Context.of(MDCContext, MDCContext())
+ )
loggingService.exiting(serverWebExchange.request, serverWebExchange.response)
return filterChain
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
index 9ce3beab6..540b3d9ad 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BasicAuthRestClientService.kt
@@ -21,37 +21,42 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import java.nio.charset.Charset
-import java.util.*
+import java.util.Base64
-class BasicAuthRestClientService(private val restClientProperties:
- BasicAuthRestClientProperties) :
+class BasicAuthRestClientService(
+ private val restClientProperties:
+ BasicAuthRestClientProperties
+) :
BlueprintWebClientService {
override fun defaultHeaders(): Map<String, String> {
- val encodedCredentials = setBasicAuth(restClientProperties.username,
- restClientProperties.password)
+ val encodedCredentials = setBasicAuth(
+ restClientProperties.username,
+ restClientProperties.password
+ )
return mapOf(
HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials")
+ HttpHeaders.AUTHORIZATION to "Basic $encodedCredentials"
+ )
}
override fun host(uri: String): String {
return restClientProperties.url + uri
}
-
override fun convertToBasicHeaders(headers: Map<String, String>):
- Array<BasicHeader> {
+ Array<BasicHeader> {
val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- //inject additionalHeaders
+ // inject additionalHeaders
customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
val encodedCredentials = setBasicAuth(
restClientProperties.username,
- restClientProperties.password)
+ restClientProperties.password
+ )
customHeaders[HttpHeaders.AUTHORIZATION] =
"Basic $encodedCredentials"
}
@@ -61,7 +66,7 @@ class BasicAuthRestClientService(private val restClientProperties:
private fun setBasicAuth(username: String, password: String): String {
val credentialsString = "$username:$password"
return Base64.getEncoder().encodeToString(
- credentialsString.toByteArray(Charset.defaultCharset()))
+ credentialsString.toByteArray(Charset.defaultCharset())
+ )
}
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
index 84ba7d414..8f528a2ef 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyService.kt
@@ -20,7 +20,14 @@ package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.*
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.PolicyManagerRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.SSLBasicAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.SSLRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.SSLTokenAuthRestClientProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.rest.TokenAuthRestClientProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.stereotype.Service
@@ -43,7 +50,7 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
open fun blueprintWebClientService(jsonNode: JsonNode): BlueprintWebClientService {
val service = preInterceptor?.getInstance(jsonNode)
- ?: blueprintWebClientService(restClientProperties(jsonNode))
+ ?: blueprintWebClientService(restClientProperties(jsonNode))
return postInterceptor?.getInstance(jsonNode, service) ?: service
}
@@ -58,7 +65,8 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
fun restClientProperties(prefix: String): RestClientProperties {
val type = bluePrintPropertiesService.propertyBeanType(
- "$prefix.type", String::class.java)
+ "$prefix.type", String::class.java
+ )
return when (type) {
RestLibConstants.TYPE_BASIC_AUTH -> {
basicAuthRestClientProperties(prefix)
@@ -80,8 +88,10 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
policyManagerRestClientProperties(prefix)
}
else -> {
- throw BluePrintProcessorException("Rest adaptor($type) is" +
- " not supported")
+ throw BluePrintProcessorException(
+ "Rest adaptor($type) is" +
+ " not supported"
+ )
}
}
}
@@ -111,7 +121,8 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
}
else -> {
throw BluePrintProcessorException(
- "Rest adaptor($type) is not supported")
+ "Rest adaptor($type) is not supported"
+ )
}
}
}
@@ -138,24 +149,28 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
private fun tokenRestClientProperties(prefix: String):
TokenAuthRestClientProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, TokenAuthRestClientProperties::class.java)
+ prefix, TokenAuthRestClientProperties::class.java
+ )
}
private fun basicAuthRestClientProperties(prefix: String):
BasicAuthRestClientProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, BasicAuthRestClientProperties::class.java)
+ prefix, BasicAuthRestClientProperties::class.java
+ )
}
private fun sslBasicAuthRestClientProperties(prefix: String):
SSLRestClientProperties {
val sslProps: SSLBasicAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix, SSLBasicAuthRestClientProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(
+ prefix, SSLBasicAuthRestClientProperties::class.java
+ )
val basicProps: BasicAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(
- prefix, BasicAuthRestClientProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(
+ prefix, BasicAuthRestClientProperties::class.java
+ )
sslProps.basicAuth = basicProps
return sslProps
}
@@ -164,11 +179,15 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
SSLRestClientProperties {
val sslProps: SSLTokenAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(prefix,
- SSLTokenAuthRestClientProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(
+ prefix,
+ SSLTokenAuthRestClientProperties::class.java
+ )
val basicProps: TokenAuthRestClientProperties =
- bluePrintPropertiesService.propertyBeanType(prefix,
- TokenAuthRestClientProperties::class.java)
+ bluePrintPropertiesService.propertyBeanType(
+ prefix,
+ TokenAuthRestClientProperties::class.java
+ )
sslProps.tokenAuth = basicProps
return sslProps
}
@@ -176,13 +195,15 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
private fun sslNoAuthRestClientProperties(prefix: String):
SSLRestClientProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, SSLRestClientProperties::class.java)
+ prefix, SSLRestClientProperties::class.java
+ )
}
private fun policyManagerRestClientProperties(prefix: String):
PolicyManagerRestClientProperties {
return bluePrintPropertiesService.propertyBeanType(
- prefix, PolicyManagerRestClientProperties::class.java)
+ prefix, PolicyManagerRestClientProperties::class.java
+ )
}
interface PreInterceptor {
@@ -197,5 +218,3 @@ open class BluePrintRestLibPropertyService(private var bluePrintPropertiesServic
fun getInstance(selector: String, service: BlueprintWebClientService): BlueprintWebClientService
}
}
-
-
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
index 3e31bf9ec..3c8d92c26 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BlueprintWebClientService.kt
@@ -23,7 +23,12 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.apache.commons.io.IOUtils
import org.apache.http.client.ClientProtocolException
-import org.apache.http.client.methods.*
+import org.apache.http.client.methods.HttpDelete
+import org.apache.http.client.methods.HttpGet
+import org.apache.http.client.methods.HttpPatch
+import org.apache.http.client.methods.HttpPost
+import org.apache.http.client.methods.HttpPut
+import org.apache.http.client.methods.HttpUriRequest
import org.apache.http.entity.StringEntity
import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.impl.client.HttpClients
@@ -57,8 +62,12 @@ interface BlueprintWebClientService {
/** High performance non blocking Retry function, If execution block [block] throws BluePrintRetryException
* exception then this will perform wait and retrigger accoring to times [times] with delay [delay]
*/
- suspend fun <T> retry(times: Int = 1, initialDelay: Long = 0, delay: Long = 1000,
- block: suspend (Int) -> T): T {
+ suspend fun <T> retry(
+ times: Int = 1,
+ initialDelay: Long = 0,
+ delay: Long = 1000,
+ block: suspend (Int) -> T
+ ): T {
val exceptionBlock = { e: Exception ->
if (e !is BluePrintRetryException) {
throw e
@@ -71,8 +80,12 @@ interface BlueprintWebClientService {
return this.exchangeResource(methodType, path, request, defaultHeaders())
}
- fun exchangeResource(methodType: String, path: String, request: String,
- headers: Map<String, String>): WebClientResponse<String> {
+ fun exchangeResource(
+ methodType: String,
+ path: String,
+ request: String,
+ headers: Map<String, String>
+ ): WebClientResponse<String> {
/**
* TODO: Basic headers in the implementations of this client do not get added
* in blocking version, whereas in NB version defaultHeaders get added.
@@ -86,11 +99,12 @@ interface BlueprintWebClientService {
HttpMethod.PUT -> put(path, request, convertedHeaders, String::class.java)
HttpMethod.PATCH -> patch(path, request, convertedHeaders, String::class.java)
else -> throw BluePrintProcessorException(
- "Unsupported methodType($methodType) attempted on path($path)")
+ "Unsupported methodType($methodType) attempted on path($path)"
+ )
}
}
- //TODO: convert to multi-map
+ // TODO: convert to multi-map
fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
return headers.map { BasicHeader(it.key, it.value) }.toTypedArray()
}
@@ -145,8 +159,10 @@ interface BlueprintWebClientService {
@Throws(IOException::class, ClientProtocolException::class)
private fun <T> performCallAndExtractTypedWebClientResponse(
- httpUriRequest: HttpUriRequest, responseType: Class<T>):
- WebClientResponse<T> {
+ httpUriRequest: HttpUriRequest,
+ responseType: Class<T>
+ ):
+ WebClientResponse<T> {
val httpResponse = httpClient().execute(httpUriRequest)
val statusCode = httpResponse.statusLine.statusCode
httpResponse.entity.content.use {
@@ -164,7 +180,7 @@ interface BlueprintWebClientService {
}
suspend fun <T> getNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
get(path, additionalHeaders!!, responseType)
}
@@ -176,8 +192,12 @@ interface BlueprintWebClientService {
return postNB(path, request, additionalHeaders, String::class.java)
}
- suspend fun <T> postNB(path: String, request: Any, additionalHeaders: Array<BasicHeader>?,
- responseType: Class<T>): WebClientResponse<T> = withContext(Dispatchers.IO) {
+ suspend fun <T> postNB(
+ path: String,
+ request: Any,
+ additionalHeaders: Array<BasicHeader>?,
+ responseType: Class<T>
+ ): WebClientResponse<T> = withContext(Dispatchers.IO) {
post(path, request, additionalHeaders!!, responseType)
}
@@ -185,14 +205,20 @@ interface BlueprintWebClientService {
return putNB(path, request, null, String::class.java)
}
- suspend fun putNB(path: String, request: Any,
- additionalHeaders: Array<BasicHeader>?): WebClientResponse<String> {
+ suspend fun putNB(
+ path: String,
+ request: Any,
+ additionalHeaders: Array<BasicHeader>?
+ ): WebClientResponse<String> {
return putNB(path, request, additionalHeaders, String::class.java)
}
- suspend fun <T> putNB(path: String, request: Any,
- additionalHeaders: Array<BasicHeader>?,
- responseType: Class<T>): WebClientResponse<T> = withContext(Dispatchers.IO) {
+ suspend fun <T> putNB(
+ path: String,
+ request: Any,
+ additionalHeaders: Array<BasicHeader>?,
+ responseType: Class<T>
+ ): WebClientResponse<T> = withContext(Dispatchers.IO) {
put(path, request, additionalHeaders!!, responseType)
}
@@ -201,36 +227,42 @@ interface BlueprintWebClientService {
}
suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?):
- WebClientResponse<String> {
+ WebClientResponse<String> {
return deleteNB(path, additionalHeaders, String::class.java)
}
suspend fun <T> deleteNB(path: String, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
delete(path, additionalHeaders!!, responseType)
}
suspend fun <T> patchNB(path: String, request: Any, additionalHeaders: Array<BasicHeader>?, responseType: Class<T>):
- WebClientResponse<T> = withContext(Dispatchers.IO) {
+ WebClientResponse<T> = withContext(Dispatchers.IO) {
patch(path, request, additionalHeaders!!, responseType)
}
suspend fun exchangeNB(methodType: String, path: String, request: Any): WebClientResponse<String> {
- return exchangeNB(methodType, path, request, hashMapOf(),
- String::class.java)
+ return exchangeNB(
+ methodType, path, request, hashMapOf(),
+ String::class.java
+ )
}
suspend fun exchangeNB(methodType: String, path: String, request: Any, additionalHeaders: Map<String, String>?):
- WebClientResponse<String> {
+ WebClientResponse<String> {
return exchangeNB(methodType, path, request, additionalHeaders, String::class.java)
}
- suspend fun <T> exchangeNB(methodType: String, path: String, request: Any,
- additionalHeaders: Map<String, String>?,
- responseType: Class<T>): WebClientResponse<T> {
+ suspend fun <T> exchangeNB(
+ methodType: String,
+ path: String,
+ request: Any,
+ additionalHeaders: Map<String, String>?,
+ responseType: Class<T>
+ ): WebClientResponse<T> {
- //TODO: possible inconsistency
- //NOTE: this basic headers function is different from non-blocking
+ // TODO: possible inconsistency
+ // NOTE: this basic headers function is different from non-blocking
val convertedHeaders: Array<BasicHeader> = basicHeaders(additionalHeaders!!)
return when (HttpMethod.resolve(methodType)) {
HttpMethod.GET -> getNB(path, convertedHeaders, responseType)
@@ -259,7 +291,7 @@ interface BlueprintWebClientService {
}
private fun basicHeaders(headers: Map<String, String>?):
- Array<BasicHeader> {
+ Array<BasicHeader> {
val basicHeaders = mutableListOf<BasicHeader>()
defaultHeaders().forEach { (name, value) ->
basicHeaders.add(BasicHeader(name, value))
@@ -278,18 +310,18 @@ interface BlueprintWebClientService {
.build()
}
- //TODO maybe there could be cases where we care about return headers?
+ // TODO maybe there could be cases where we care about return headers?
data class WebClientResponse<T>(val status: Int, val body: T)
fun verifyAdditionalHeaders(restClientProperties: RestClientProperties): Map<String, String> {
val customHeaders: MutableMap<String, String> = mutableMapOf()
- //Extract additionalHeaders from the requestProperties and
- //throw an error if HttpHeaders.AUTHORIZATION key (headers are case-insensitive)
+ // Extract additionalHeaders from the requestProperties and
+ // throw an error if HttpHeaders.AUTHORIZATION key (headers are case-insensitive)
restClientProperties.additionalHeaders?.let {
if (it.keys.map { k -> k.toLowerCase().trim() }.contains(HttpHeaders.AUTHORIZATION.toLowerCase())) {
val errMsg = "Error in definition of endpoint ${restClientProperties.url}." +
- " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
- " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
+ " User-supplied \"additionalHeaders\" cannot contain AUTHORIZATION header with" +
+ " auth-type \"${RestLibConstants.TYPE_BASIC_AUTH}\""
WebClientUtils.log.error(errMsg)
throw BluePrintProcessorException(errMsg)
} else {
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
index 969de836c..313710745 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestLoggerService.kt
@@ -16,10 +16,17 @@
package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
-import kotlinx.coroutines.*
+import kotlinx.coroutines.AbstractCoroutine
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.CoroutineStart
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.InternalCoroutinesApi
+import kotlinx.coroutines.handleCoroutineException
+import kotlinx.coroutines.newCoroutineContext
import kotlinx.coroutines.reactor.ReactorContext
import kotlinx.coroutines.reactor.asCoroutineContext
import org.apache.http.message.BasicHeader
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_INVOCATION_ID
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_PARTNER_NAME
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants.ONAP_REQUEST_ID
@@ -37,7 +44,7 @@ import java.net.InetAddress
import java.time.ZoneOffset
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
-import java.util.*
+import java.util.UUID
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
@@ -51,8 +58,7 @@ class RestLoggerService {
fun httpInvoking(headers: Array<BasicHeader>) {
headers.plusElement(BasicHeader(ONAP_REQUEST_ID, MDC.get("InvocationID").defaultToUUID()))
headers.plusElement(BasicHeader(ONAP_INVOCATION_ID, UUID.randomUUID().toString()))
- val partnerName = System.getProperty("APPNAME") ?: "BlueprintsProcessor"
- headers.plusElement(BasicHeader(ONAP_PARTNER_NAME, partnerName))
+ headers.plusElement(BasicHeader(ONAP_PARTNER_NAME, BluePrintConstants.APP_NAME))
}
}
@@ -79,8 +85,7 @@ class RestLoggerService {
val resHeaders = response.headers
resHeaders[ONAP_REQUEST_ID] = MDC.get("RequestID")
resHeaders[ONAP_INVOCATION_ID] = MDC.get("InvocationID")
- val partnerName = System.getProperty("APPNAME") ?: "BlueprintsProcessor"
- resHeaders[ONAP_PARTNER_NAME] = partnerName
+ resHeaders[ONAP_PARTNER_NAME] = BluePrintConstants.APP_NAME
} catch (e: Exception) {
log.warn("couldn't set response headers", e)
} finally {
@@ -89,17 +94,19 @@ class RestLoggerService {
}
}
-
/** Used in Rest controller API methods to populate MDC context to nested coroutines from reactor web filter context. */
@UseExperimental(InternalCoroutinesApi::class)
-fun <T> monoMdc(context: CoroutineContext = EmptyCoroutineContext,
- block: suspend CoroutineScope.() -> T?): Mono<T> = Mono.create { sink ->
+fun <T> monoMdc(
+ context: CoroutineContext = EmptyCoroutineContext,
+ block: suspend CoroutineScope.() -> T?
+): Mono<T> = Mono.create { sink ->
val reactorContext = (context[ReactorContext]?.context?.putAll(sink.currentContext())
- ?: sink.currentContext()).asCoroutineContext()
+ ?: sink.currentContext()).asCoroutineContext()
/** Populate MDC context only if present in Reactor Context */
- val newContext = if (!reactorContext.context.isEmpty
- && reactorContext.context.hasKey(MDCContext)) {
+ val newContext = if (!reactorContext.context.isEmpty &&
+ reactorContext.context.hasKey(MDCContext)
+ ) {
val mdcContext = reactorContext.context.get<MDCContext>(MDCContext)
GlobalScope.newCoroutineContext(context + reactorContext + mdcContext)
} else GlobalScope.newCoroutineContext(context + reactorContext)
@@ -111,9 +118,10 @@ fun <T> monoMdc(context: CoroutineContext = EmptyCoroutineContext,
@InternalCoroutinesApi
class MonoMDCCoroutine<in T>(
- parentContext: CoroutineContext,
- private val sink: MonoSink<T>
+ parentContext: CoroutineContext,
+ private val sink: MonoSink<T>
) : AbstractCoroutine<T>(parentContext, true), Disposable {
+
private var disposed = false
override fun onCompleted(value: T) {
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/SSLRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/SSLRestClientService.kt
index 0ef1757e2..86e3ced06 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/SSLRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/SSLRestClientService.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.rest.service
+import org.apache.http.conn.ssl.NoopHostnameVerifier
import org.apache.http.conn.ssl.SSLConnectionSocketFactory
import org.apache.http.impl.client.CloseableHttpClient
import org.apache.http.impl.client.HttpClients
@@ -32,7 +33,6 @@ import java.io.File
import java.io.FileInputStream
import java.security.KeyStore
import java.security.cert.X509Certificate
-import org.apache.http.conn.ssl.NoopHostnameVerifier
class SSLRestClientService(private val restClientProperties: SSLRestClientProperties) :
BlueprintWebClientService {
@@ -44,8 +44,8 @@ class SSLRestClientService(private val restClientProperties: SSLRestClientProper
}
private fun getAuthService(): BlueprintWebClientService? {
- //type,url and additional headers don't get carried over to TokenAuthRestClientProperties from SSLTokenAuthRestClientProperties
- //set them in auth obj to be consistent. TODO: refactor
+ // type,url and additional headers don't get carried over to TokenAuthRestClientProperties from SSLTokenAuthRestClientProperties
+ // set them in auth obj to be consistent. TODO: refactor
return when (restClientProperties) {
is SSLBasicAuthRestClientProperties -> {
val basicAuthProps = restClientProperties.basicAuth!!
@@ -62,7 +62,7 @@ class SSLRestClientService(private val restClientProperties: SSLRestClientProper
TokenAuthRestClientService(token)
}
else -> {
- //Returns null for No auth
+ // Returns null for No auth
null
}
}
@@ -74,7 +74,8 @@ class SSLRestClientService(private val restClientProperties: SSLRestClientProper
}
return mapOf(
HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE)
+ HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE
+ )
}
override fun host(uri: String): String {
@@ -104,7 +105,7 @@ class SSLRestClientService(private val restClientProperties: SSLRestClientProper
}
sslContext.loadTrustMaterial(File(sslTrust), sslTrustPwd.toCharArray(), acceptingTrustStrategy)
- var csf : SSLConnectionSocketFactory
+ var csf: SSLConnectionSocketFactory
if (sslTrustIgnoreHostname) {
csf = SSLConnectionSocketFactory(sslContext.build(), NoopHostnameVerifier())
} else {
@@ -123,14 +124,16 @@ class SSLRestClientService(private val restClientProperties: SSLRestClientProper
override fun convertToBasicHeaders(headers: Map<String, String>): Array<BasicHeader> {
val mergedDefaultAndSuppliedHeaders = defaultHeaders().plus(headers)
- //During the initialization, getAuthService() sets the auth variable.
- //If it's not null, then we have an authentication mechanism.
- //If null - indicates no-auth used
+ // During the initialization, getAuthService() sets the auth variable.
+ // If it's not null, then we have an authentication mechanism.
+ // If null - indicates no-auth used
if (auth != null) {
return auth!!.convertToBasicHeaders(mergedDefaultAndSuppliedHeaders)
}
- //inject additionalHeaders
- return super.convertToBasicHeaders(mergedDefaultAndSuppliedHeaders
- .plus(verifyAdditionalHeaders(restClientProperties)))
+ // inject additionalHeaders
+ return super.convertToBasicHeaders(
+ mergedDefaultAndSuppliedHeaders
+ .plus(verifyAdditionalHeaders(restClientProperties))
+ )
}
}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
index 73b534143..57702f8ac 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/TokenAuthRestClientService.kt
@@ -21,21 +21,24 @@ import org.onap.ccsdk.cds.blueprintsprocessor.rest.TokenAuthRestClientProperties
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
-class TokenAuthRestClientService(private val restClientProperties:
- TokenAuthRestClientProperties) :
+class TokenAuthRestClientService(
+ private val restClientProperties:
+ TokenAuthRestClientProperties
+) :
BlueprintWebClientService {
override fun defaultHeaders(): Map<String, String> {
return mapOf(
HttpHeaders.CONTENT_TYPE to MediaType.APPLICATION_JSON_VALUE,
HttpHeaders.ACCEPT to MediaType.APPLICATION_JSON_VALUE,
- HttpHeaders.AUTHORIZATION to restClientProperties.token!!)
+ HttpHeaders.AUTHORIZATION to restClientProperties.token!!
+ )
}
override fun convertToBasicHeaders(headers: Map<String, String>):
- Array<BasicHeader> {
+ Array<BasicHeader> {
val customHeaders: MutableMap<String, String> = headers.toMutableMap()
- //inject additionalHeaders
+ // inject additionalHeaders
customHeaders.putAll(verifyAdditionalHeaders(restClientProperties))
if (!headers.containsKey(HttpHeaders.AUTHORIZATION)) {
customHeaders[HttpHeaders.AUTHORIZATION] = restClientProperties.token!!
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/utils/WebClientUtils.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/utils/WebClientUtils.kt
index 42006569f..ff4d54730 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/utils/WebClientUtils.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/utils/WebClientUtils.kt
@@ -32,4 +32,4 @@ class WebClientUtils {
fun logResponse(): HttpResponseInterceptor =
HttpResponseInterceptor { response, _ -> log.info("Response status(${response.statusLine.statusCode} - ${response.statusLine.reasonPhrase})") }
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
index 1e4518a8c..53047d4a8 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/BluePrintRestLibPropertyServiceTest.kt
@@ -41,50 +41,59 @@ import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, BluePrintPropertyConfiguration::class,
- BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
- "blueprintsprocessor.restclient.sample.userId=sampleuser",
- "blueprintsprocessor.restclient.sslbasic.type=ssl-basic-auth",
- "blueprintsprocessor.restclient.sslbasic.url=https://localhost:8443",
- "blueprintsprocessor.restclient.sslbasic.username=admin",
- "blueprintsprocessor.restclient.sslbasic.password=cds",
- "blueprintsprocessor.restclient.sslbasic.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.sslbasic.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.sslbasic.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssltoken.type=ssl-token-auth",
- "blueprintsprocessor.restclient.ssltoken.url=https://localhost:8443",
- "blueprintsprocessor.restclient.ssltoken.token=72178473kjshdkjgvbsdkjv903274908",
- "blueprintsprocessor.restclient.ssltoken.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.ssltoken.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssltoken.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssl.type=ssl-no-auth",
- "blueprintsprocessor.restclient.ssl.url=https://localhost:8443",
- "blueprintsprocessor.restclient.ssl.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.ssl.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssl.sslTrustPassword=changeit",
- "blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
-])
+@ContextConfiguration(
+ classes = [BluePrintRestLibConfiguration::class, BluePrintPropertyConfiguration::class,
+ BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprintsprocessor.restclient.sample.type=basic-auth",
+ "blueprintsprocessor.restclient.sample.url=http://localhost:8080",
+ "blueprintsprocessor.restclient.sample.userId=sampleuser",
+ "blueprintsprocessor.restclient.sslbasic.type=ssl-basic-auth",
+ "blueprintsprocessor.restclient.sslbasic.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.sslbasic.username=admin",
+ "blueprintsprocessor.restclient.sslbasic.password=cds",
+ "blueprintsprocessor.restclient.sslbasic.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.sslbasic.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.sslbasic.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssltoken.type=ssl-token-auth",
+ "blueprintsprocessor.restclient.ssltoken.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.ssltoken.token=72178473kjshdkjgvbsdkjv903274908",
+ "blueprintsprocessor.restclient.ssltoken.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.ssltoken.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssltoken.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssl.type=ssl-no-auth",
+ "blueprintsprocessor.restclient.ssl.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.ssl.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.ssl.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssl.sslTrustPassword=changeit",
+ "blueprintsprocessor.restclient.ssl.sslKey=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.ssl.sslKeyPassword=changeit"
+ ]
+)
class BluePrintRestLibPropertyServiceTest {
+
@Autowired
lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
@Test
fun testRestClientProperties() {
val properties = bluePrintRestLibPropertyService.restClientProperties(
- "blueprintsprocessor.restclient.sample")
+ "blueprintsprocessor.restclient.sample"
+ )
assertNotNull(properties, "failed to create property bean")
- assertNotNull(properties.url, "failed to get url property in" +
- " property bean")
+ assertNotNull(
+ properties.url, "failed to get url property in" +
+ " property bean"
+ )
}
@Test
fun testSSLBasicProperties() {
val properties = bluePrintRestLibPropertyService.restClientProperties(
- "blueprintsprocessor.restclient.sslbasic")
+ "blueprintsprocessor.restclient.sslbasic"
+ )
assertNotNull(properties, "failed to create property bean")
val p: SSLBasicAuthRestClientProperties =
properties as SSLBasicAuthRestClientProperties
@@ -99,7 +108,8 @@ class BluePrintRestLibPropertyServiceTest {
@Test
fun testSSLTokenProperties() {
val properties = bluePrintRestLibPropertyService.restClientProperties(
- "blueprintsprocessor.restclient.ssltoken")
+ "blueprintsprocessor.restclient.ssltoken"
+ )
assertNotNull(properties, "failed to create property bean")
val p: SSLTokenAuthRestClientProperties =
@@ -114,7 +124,8 @@ class BluePrintRestLibPropertyServiceTest {
@Test
fun testSSLNoAuthProperties() {
val properties = bluePrintRestLibPropertyService.restClientProperties(
- "blueprintsprocessor.restclient.ssl")
+ "blueprintsprocessor.restclient.ssl"
+ )
assertNotNull(properties, "failed to create property bean")
val p: SSLRestClientProperties =
@@ -127,12 +138,12 @@ class BluePrintRestLibPropertyServiceTest {
assertEquals(p.sslKeyPassword, "changeit")
}
-
@Test
fun testSSLBasicPropertiesAsJson() {
val actualObj: JsonNode = defaultMapper.readTree(sslBasicAuthEndpointWithHeadersField())
val properties = bluePrintRestLibPropertyService.restClientProperties(
- actualObj)
+ actualObj
+ )
assertNotNull(properties, "failed to create property bean")
val p: SSLBasicAuthRestClientProperties = properties as SSLBasicAuthRestClientProperties
@@ -166,7 +177,8 @@ class BluePrintRestLibPropertyServiceTest {
fun testSSLNoAuthPropertiesAsJson() {
val actualObj: JsonNode = defaultMapper.readTree(sslNoAuthEndpointWithHeadersField())
val properties = bluePrintRestLibPropertyService.restClientProperties(
- actualObj)
+ actualObj
+ )
assertNotNull(properties, "failed to create property bean")
val p: SSLRestClientProperties =
@@ -185,8 +197,10 @@ class BluePrintRestLibPropertyServiceTest {
fun testBlueprintWebClientService() {
val blueprintWebClientService = bluePrintRestLibPropertyService
.blueprintWebClientService("sample")
- assertNotNull(blueprintWebClientService,
- "failed to create blueprintWebClientService")
+ assertNotNull(
+ blueprintWebClientService,
+ "failed to create blueprintWebClientService"
+ )
}
@Test
@@ -197,7 +211,7 @@ class BluePrintRestLibPropertyServiceTest {
assertNotNull(blueprintWebClientService, "failed to create blueprintWebClientService")
}
- //pass the result of $typeEndpointWithHeadersField() output with and without headers to compare.
+ // pass the result of $typeEndpointWithHeadersField() output with and without headers to compare.
private fun validateHeadersDidNotChangeWithEmptyAdditionalHeaders(noHeaders: String, withHeaders: String) {
val parsedObj: JsonNode = defaultMapper.readTree(noHeaders)
val bpWebClientService =
@@ -208,7 +222,7 @@ class BluePrintRestLibPropertyServiceTest {
val bpWebClientServiceWithHeaders =
bluePrintRestLibPropertyService.blueprintWebClientService(parsedObjWithHeaders)
val extractedHeadersWithAdditionalHeaders = bpWebClientServiceWithHeaders.convertToBasicHeaders(mapOf())
- //Array<BasicHeader<>> -> Map<String,String>
+ // Array<BasicHeader<>> -> Map<String,String>
val headersMap = extractedHeaders.map { it.name to it.value }.toMap()
val additionalHeadersMap = extractedHeadersWithAdditionalHeaders.map { it.name to it.value }.toMap()
assertEquals(headersMap, additionalHeadersMap)
@@ -256,18 +270,20 @@ class BluePrintRestLibPropertyServiceTest {
val bpWebClientService =
bluePrintRestLibPropertyService.blueprintWebClientService(parsedObj)
val extractedHeaders = bpWebClientService.convertToBasicHeaders(mapOf())
- assertEquals(MediaType.APPLICATION_XML.toString(),
- extractedHeaders.filter { it.name == HttpHeaders.CONTENT_TYPE }[0].value!!)
+ assertEquals(
+ MediaType.APPLICATION_XML.toString(),
+ extractedHeaders.filter { it.name == HttpHeaders.CONTENT_TYPE }[0].value!!
+ )
}
@Test
fun `BasicAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
- //default content type is application/json
+ // default content type is application/json
val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
}
- //called from within "assertFailsWith(exceptionClass = BluePrintProcessorException::class) {"
+ // called from within "assertFailsWith(exceptionClass = BluePrintProcessorException::class) {"
private fun attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson: String) {
val parsedObj: JsonNode = defaultMapper.readTree(endPointWithHeadersJson)
val bpWebClientService =
@@ -281,7 +297,7 @@ class BluePrintRestLibPropertyServiceTest {
val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(additionalHeadersWithAuth)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
}
- //spec says headers are case insensitive...
+ // spec says headers are case insensitive...
assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
val endPointWithHeadersJson = basicAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
@@ -309,7 +325,7 @@ class BluePrintRestLibPropertyServiceTest {
@Test
fun `TokenAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
- //default content type is application/json
+ // default content type is application/json
val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
}
@@ -320,14 +336,14 @@ class BluePrintRestLibPropertyServiceTest {
val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(additionalHeadersWithAuth)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
}
- //spec says headers are case insensitive...
+ // spec says headers are case insensitive...
assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
val endPointWithHeadersJson = sslTokenAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
}
}
- //TESTS FOR SSL BASIC AUTH headers
+ // TESTS FOR SSL BASIC AUTH headers
@Test
fun `SSLBasicAuth WebClientService with empty additionalHeaders does not modify headers`() {
val endPointJson = sslBasicAuthEndpointWithHeadersField()
@@ -349,7 +365,7 @@ class BluePrintRestLibPropertyServiceTest {
@Test
fun `SSLBasicAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
- //default content type is application/json
+ // default content type is application/json
val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
}
@@ -360,14 +376,14 @@ class BluePrintRestLibPropertyServiceTest {
val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(additionalHeadersWithAuth)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
}
- //spec says headers are case insensitive...
+ // spec says headers are case insensitive...
assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
val endPointWithHeadersJson = sslBasicAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
}
}
- //SSL-NO-AUTH headers tests
+ // SSL-NO-AUTH headers tests
@Test
fun `SSLNoAuth WebClientService with empty additionalHeaders does not modify headers`() {
val endPointJson = sslNoAuthEndpointWithHeadersField()
@@ -389,7 +405,7 @@ class BluePrintRestLibPropertyServiceTest {
@Test
fun `SSLNoAuth WebClientService additionalHeaders can overwrite default Content-Type`() {
- //default content type is application/json
+ // default content type is application/json
val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(contentTypeAdditionalHeader)
additionalHeadersChangedContentTypeToAPPLICATION_XML(endPointWithHeadersJson)
}
@@ -400,7 +416,7 @@ class BluePrintRestLibPropertyServiceTest {
val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(additionalHeadersWithAuth)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
}
- //spec says headers are case insensitive...
+ // spec says headers are case insensitive...
assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
val endPointWithHeadersJson = sslNoAuthEndpointWithHeadersField(additionalHeadersWithAuthLowercased)
attemptToPutAuthorizationHeaderIntoAdditionalHeaders(endPointWithHeadersJson)
@@ -412,12 +428,15 @@ class BluePrintRestLibPropertyServiceTest {
val expectedTokenAuthDefaultHeaders = mapOf<String, String>(
"Content-Type" to "application/json",
"Accept" to "application/json",
- "Authorization" to "72178473kjshdkjgvbsdkjv903274908")
+ "Authorization" to "72178473kjshdkjgvbsdkjv903274908"
+ )
- val endPointWithHeadersJsonWithBasicAuthHeader = basicAuthEndpointWithHeadersField(""",
+ val endPointWithHeadersJsonWithBasicAuthHeader = basicAuthEndpointWithHeadersField(
+ """,
"additionalHeaders" : {
"authorization": "Basic aGF2ZTphbmljZWRheQo="
- }""".trimIndent())
+ }""".trimIndent()
+ )
private fun sslTokenAuthEndpointWithHeadersField(headers: String = ""): String =
"""{
@@ -455,7 +474,7 @@ class BluePrintRestLibPropertyServiceTest {
"sslKeyPassword" : "changeit"$headers
}""".trimIndent()
- //Don't forget to supply "," as the first char to make valid JSON
+ // Don't forget to supply "," as the first char to make valid JSON
private fun basicAuthEndpointWithHeadersField(headers: String = ""): String =
"""{
"type": "basic-auth",
@@ -496,4 +515,3 @@ class BluePrintRestLibPropertyServiceTest {
}""".trimIndent()
}
}
-
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt
index 15133fa8a..f82fc6124 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientPropertiesDSLTest.kt
@@ -24,7 +24,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import kotlin.test.assertNotNull
class RestClientPropertiesDSLTest {
-
+
@Test
fun testBasicAuthRestClientProperties() {
val properties = BluePrintTypes.dslBasicAuthRestClientProperties {
@@ -56,4 +56,4 @@ class RestClientPropertiesDSLTest {
}
assertNotNull(properties, "failed to get dslSSLRestClientProperties")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
index 05f32904a..fa357e1fe 100644
--- a/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/rest-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/rest/service/RestClientServiceTest.kt
@@ -48,45 +48,56 @@ import org.springframework.security.web.server.SecurityWebFilterChain
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.DeleteMapping
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PatchMapping
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.PutMapping
+import org.springframework.web.bind.annotation.RequestHeader
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RestController
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class])
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, SampleController::class,
- SecurityConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-[
- "server.port=8443",
- "server.ssl.enabled=true",
- "server.ssl.key-store=classpath:keystore.p12",
- "server.ssl.key-store-password=changeit",
- "server.ssl.keyStoreType=PKCS12",
- "server.ssl.keyAlias=tomcat",
- "blueprintsprocessor.restclient.sample.type=basic-auth",
- "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:8081",
- "blueprintsprocessor.restclient.sample.username=admin",
- "blueprintsprocessor.restclient.sample.password=jans",
- "blueprintsprocessor.restclient.test.type=ssl-basic-auth",
- "blueprintsprocessor.restclient.test.url=https://localhost:8443",
- "blueprintsprocessor.restclient.test.username=admin",
- "blueprintsprocessor.restclient.test.password=jans",
- "blueprintsprocessor.restclient.test.keyStoreInstance=PKCS12",
- "blueprintsprocessor.restclient.test.sslTrust=src/test/resources/keystore.p12",
- "blueprintsprocessor.restclient.test.sslTrustPassword=changeit"
-])
+@ContextConfiguration(
+ classes = [BluePrintRestLibConfiguration::class, SampleController::class,
+ SecurityConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ [
+ "server.port=8443",
+ "server.ssl.enabled=true",
+ "server.ssl.key-store=classpath:keystore.p12",
+ "server.ssl.key-store-password=changeit",
+ "server.ssl.keyStoreType=PKCS12",
+ "server.ssl.keyAlias=tomcat",
+ "blueprintsprocessor.restclient.sample.type=basic-auth",
+ "blueprintsprocessor.restclient.sample.url=http://127.0.0.1:8081",
+ "blueprintsprocessor.restclient.sample.username=admin",
+ "blueprintsprocessor.restclient.sample.password=jans",
+ "blueprintsprocessor.restclient.test.type=ssl-basic-auth",
+ "blueprintsprocessor.restclient.test.url=https://localhost:8443",
+ "blueprintsprocessor.restclient.test.username=admin",
+ "blueprintsprocessor.restclient.test.password=jans",
+ "blueprintsprocessor.restclient.test.keyStoreInstance=PKCS12",
+ "blueprintsprocessor.restclient.test.sslTrust=src/test/resources/keystore.p12",
+ "blueprintsprocessor.restclient.test.sslTrustPassword=changeit"
+ ]
+)
class RestClientServiceTest {
@Autowired
lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
@Autowired
- lateinit var httpHandler : HttpHandler
+ lateinit var httpHandler: HttpHandler
- lateinit var http : WebServer
+ lateinit var http: WebServer
fun localPort() = http.port
@@ -106,21 +117,26 @@ class RestClientServiceTest {
@Test
fun testPatch() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("sample")
+ .blueprintWebClientService("sample")
val response = restClientService.exchangeResource(
- HttpMethod.PATCH.name, "/sample/name", "")
- assertEquals("Patch request successful", response.body,
- "failed to get patch response")
+ HttpMethod.PATCH.name, "/sample/name", ""
+ )
+ assertEquals(
+ "Patch request successful", response.body,
+ "failed to get patch response"
+ )
}
@Test
fun testBaseAuth() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("sample")
+ .blueprintWebClientService("sample")
val headers = mutableMapOf<String, String>()
headers["X-Transaction-Id"] = "1234"
- val response = restClientService.exchangeResource(HttpMethod.GET.name,
- "/sample/name", "")
+ val response = restClientService.exchangeResource(
+ HttpMethod.GET.name,
+ "/sample/name", ""
+ )
assertNotNull(response.body, "failed to get response")
}
@@ -135,12 +151,15 @@ class RestClientServiceTest {
val mapper = ObjectMapper()
val actualObj: JsonNode = mapper.readTree(json)
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService(actualObj)
- lateinit var res:String
+ .blueprintWebClientService(actualObj)
+ lateinit var res: String
runBlocking {
val get = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.GET.name,
- "/sample/basic", "").body}
+ restClientService.exchangeNB(
+ HttpMethod.GET.name,
+ "/sample/basic", ""
+ ).body
+ }
get.start()
res = get.await()
}
@@ -151,7 +170,7 @@ class RestClientServiceTest {
@Test
fun testSampleAaiReq() {
val restClientService = bluePrintRestLibPropertyService
- .blueprintWebClientService("test")
+ .blueprintWebClientService("test")
val headers = mutableMapOf<String, String>()
headers["X-TransactionId"] = "9999"
headers["X-FromAppId"] = "AAI"
@@ -171,34 +190,52 @@ class RestClientServiceTest {
lateinit var res6: String
runBlocking {
val get1 = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.GET.name,
- "/sample/aai/v14/business/customers", "", headers,
- Customer::class.java).body}
+ restClientService.exchangeNB(
+ HttpMethod.GET.name,
+ "/sample/aai/v14/business/customers", "", headers,
+ Customer::class.java
+ ).body
+ }
val get2 = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.GET.name,
- "/sample/aai/v14/business/customers", "", headers,
- Customer::class.java).body}
+ restClientService.exchangeNB(
+ HttpMethod.GET.name,
+ "/sample/aai/v14/business/customers", "", headers,
+ Customer::class.java
+ ).body
+ }
val post = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.POST.name,
- "/sample/aai/v14/business/customers", post1, headers,
- String::class.java).body}
+ restClientService.exchangeNB(
+ HttpMethod.POST.name,
+ "/sample/aai/v14/business/customers", post1, headers,
+ String::class.java
+ ).body
+ }
val put = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.PUT.name,
- "/sample/aai/v14/business/customers", post1, headers,
- String::class.java).body}
+ restClientService.exchangeNB(
+ HttpMethod.PUT.name,
+ "/sample/aai/v14/business/customers", post1, headers,
+ String::class.java
+ ).body
+ }
val patch = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.PATCH.name,
- "/sample/aai/v14/business/customers", post1, headers,
- String::class.java).body}
+ restClientService.exchangeNB(
+ HttpMethod.PATCH.name,
+ "/sample/aai/v14/business/customers", post1, headers,
+ String::class.java
+ ).body
+ }
val delete = async(start = CoroutineStart.LAZY) {
- restClientService.exchangeNB(HttpMethod.DELETE.name,
- "/sample/aai/v14/business/customers", "", headers,
- String::class.java).body}
+ restClientService.exchangeNB(
+ HttpMethod.DELETE.name,
+ "/sample/aai/v14/business/customers", "", headers,
+ String::class.java
+ ).body
+ }
get1.start()
get2.start()
@@ -246,13 +283,13 @@ open class SampleController {
@GetMapping("/basic")
fun getBasic(): String = "Basic request arrived successfully"
-
@GetMapping("/aai/v14/business/customers")
fun getAaiCustomers(
- @RequestHeader(name = "X-TransactionId", required = true)
- transId: String,
- @RequestHeader(name = "X-FromAppId", required = true)
- appId: String) : String {
+ @RequestHeader(name = "X-TransactionId", required = true)
+ transId: String,
+ @RequestHeader(name = "X-FromAppId", required = true)
+ appId: String
+ ): String {
if (transId != "9999" || appId != "AAI") {
return ""
}
@@ -266,23 +303,24 @@ open class SampleController {
@PostMapping("/aai/v14/business/customers")
fun postAaiCustomers(
- @RequestHeader(name = "X-TransactionId", required = true)
- transId: String,
- @RequestHeader(name = "X-FromAppId", required = true)
- appId: String) : String {
+ @RequestHeader(name = "X-TransactionId", required = true)
+ transId: String,
+ @RequestHeader(name = "X-FromAppId", required = true)
+ appId: String
+ ): String {
if (transId != "9999" || appId != "AAI") {
return ""
}
return "The message is successfully posted"
}
-
@PutMapping("/aai/v14/business/customers")
fun putAaiCustomers(
- @RequestHeader(name = "X-TransactionId", required = true)
- transId: String,
- @RequestHeader(name = "X-FromAppId", required = true)
- appId: String) : String {
+ @RequestHeader(name = "X-TransactionId", required = true)
+ transId: String,
+ @RequestHeader(name = "X-FromAppId", required = true)
+ appId: String
+ ): String {
if (transId != "9999" || appId != "AAI") {
return ""
}
@@ -291,10 +329,11 @@ open class SampleController {
@PatchMapping("/aai/v14/business/customers")
fun patchAaiCustomers(
- @RequestHeader(name = "X-TransactionId", required = true)
- transId: String,
- @RequestHeader(name = "X-FromAppId", required = true)
- appId: String) : String {
+ @RequestHeader(name = "X-TransactionId", required = true)
+ transId: String,
+ @RequestHeader(name = "X-FromAppId", required = true)
+ appId: String
+ ): String {
if (transId != "9999" || appId != "AAI") {
return ""
}
@@ -303,10 +342,11 @@ open class SampleController {
@DeleteMapping("/aai/v14/business/customers")
fun deleteAaiCustomers(
- @RequestHeader(name = "X-TransactionId", required = true)
- transId: String,
- @RequestHeader(name = "X-FromAppId", required = true)
- appId: String) : String {
+ @RequestHeader(name = "X-TransactionId", required = true)
+ transId: String,
+ @RequestHeader(name = "X-FromAppId", required = true)
+ appId: String
+ ): String {
if (transId != "9999" || appId != "AAI") {
return ""
}
@@ -323,20 +363,20 @@ open class SecurityConfiguration {
@Bean
open fun userDetailsService(): MapReactiveUserDetailsService {
val user: UserDetails = User.withDefaultPasswordEncoder()
- .username("admin")
- .password("jans")
- .roles("USER")
- .build()
+ .username("admin")
+ .password("jans")
+ .roles("USER")
+ .build()
return MapReactiveUserDetailsService(user)
}
@Bean
open fun springSecurityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
return http
- .csrf().disable()
- .authorizeExchange().anyExchange().authenticated()
- .and().httpBasic()
- .and().build()
+ .csrf().disable()
+ .authorizeExchange().anyExchange().authenticated()
+ .and().httpBasic()
+ .and().build()
}
}
@@ -344,7 +384,8 @@ open class SecurityConfiguration {
* Data class required for response
*/
data class Customer(
- val id: String,
- val name: String,
- val type: String,
- val resource: String)
+ val id: String,
+ val name: String,
+ val type: String,
+ val resource: String
+)
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
index 0e6a0bf1f..b67e0f416 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/pom.xml
@@ -31,8 +31,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
index 3c625a6d3..382c9b7d7 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibConfiguration.kt
@@ -33,16 +33,13 @@ open class BluePrintSshLibConfiguration
* Exposed Dependency Service by this SSH Lib Module
*/
fun BluePrintDependencyService.sshLibPropertyService(): BluePrintSshLibPropertyService =
- instance(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY)
-
+ instance(SshLibConstants.SERVICE_BLUEPRINT_SSH_LIB_PROPERTY)
fun BluePrintDependencyService.sshClientService(selector: String): BlueprintSshClientService =
- sshLibPropertyService().blueprintSshClientService(selector)
-
+ sshLibPropertyService().blueprintSshClientService(selector)
fun BluePrintDependencyService.sshClientService(jsonNode: JsonNode): BlueprintSshClientService =
- sshLibPropertyService().blueprintSshClientService(jsonNode)
-
+ sshLibPropertyService().blueprintSshClientService(jsonNode)
class SshLibConstants {
companion object {
@@ -50,4 +47,4 @@ class SshLibConstants {
const val PROPERTY_SSH_CLIENT_PREFIX = "blueprintsprocessor.sshclient."
const val TYPE_BASIC_AUTH = "basic-auth"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
index a70ea5588..c7d5105b4 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/BluePrintSshLibData.kt
@@ -26,4 +26,4 @@ open class SshClientProperties {
open class BasicAuthSshClientProperties : SshClientProperties() {
lateinit var password: String
lateinit var username: String
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
index adbde0f87..61baaa1ef 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BasicAuthSshClientService.kt
@@ -26,11 +26,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.ssh.BasicAuthSshClientProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.slf4j.LoggerFactory
import java.io.ByteArrayOutputStream
-import java.util.*
+import java.util.Collections
+import java.util.EnumSet
-
-open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties)
- : BlueprintSshClientService {
+open class BasicAuthSshClientService(private val basicAuthSshClientProperties: BasicAuthSshClientProperties) :
+ BlueprintSshClientService {
private val log = LoggerFactory.getLogger(BasicAuthSshClientService::class.java)!!
@@ -43,10 +43,12 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
sshClient.serverKeyVerifier = AcceptAllServerKeyVerifier.INSTANCE
sshClient.start()
log.debug("SSH Client Service started successfully")
- clientSession = sshClient.connect(basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
- basicAuthSshClientProperties.port)
- .verify(basicAuthSshClientProperties.connectionTimeOut)
- .session
+ clientSession = sshClient.connect(
+ basicAuthSshClientProperties.username, basicAuthSshClientProperties.host,
+ basicAuthSshClientProperties.port
+ )
+ .verify(basicAuthSshClientProperties.connectionTimeOut)
+ .session
clientSession.addPasswordIdentity(basicAuthSshClientProperties.password)
clientSession.auth().verify(basicAuthSshClientProperties.connectionTimeOut)
@@ -73,7 +75,7 @@ open class BasicAuthSshClientService(private val basicAuthSshClientProperties: B
channel = clientSession.createExecChannel(command)
checkNotNull(channel) { "failed to create Channel for the command : $command" }
- //TODO("Convert to streaming ")
+ // TODO("Convert to streaming ")
val outputStream = ByteArrayOutputStream()
channel!!.out = outputStream
channel!!.err = outputStream
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt
index 337208c78..90a1746e8 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyService.kt
@@ -53,11 +53,13 @@ open class BluePrintSshLibPropertyService(private var bluePrintProperties: BlueP
fun sshClientProperties(jsonNode: JsonNode): SshClientProperties {
val type = jsonNode.get("type")?.textValue()
- ?: throw BluePrintProcessorException("missing type field in ssh client properties")
+ ?: throw BluePrintProcessorException("missing type field in ssh client properties")
return when (type) {
SshLibConstants.TYPE_BASIC_AUTH -> {
- JacksonUtils.readValue(jsonNode,
- BasicAuthSshClientProperties::class.java)!!
+ JacksonUtils.readValue(
+ jsonNode,
+ BasicAuthSshClientProperties::class.java
+ )!!
}
else -> {
throw BluePrintProcessorException("SSH adaptor($type) is not supported")
@@ -79,7 +81,7 @@ open class BluePrintSshLibPropertyService(private var bluePrintProperties: BlueP
private fun basicAuthSshClientProperties(prefix: String): BasicAuthSshClientProperties {
return bluePrintProperties.propertyBeanType(
- prefix, BasicAuthSshClientProperties::class.java)
+ prefix, BasicAuthSshClientProperties::class.java
+ )
}
-
}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt
index 279e437cc..724c4277d 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientService.kt
@@ -44,4 +44,4 @@ interface BlueprintSshClientService {
suspend fun executeCommandNB(command: String, timeOut: Long): String
suspend fun closeSessionNB()
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
index f4275b8f2..f4c39c936 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BluePrintSshLibPropertyServiceTest.kt
@@ -29,17 +29,20 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
-
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintSshLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.sshclient.sample.type=basic-auth",
- "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
- "blueprintsprocessor.sshclient.sample.port=22",
- "blueprintsprocessor.sshclient.sample.password=1234",
- "blueprintsprocessor.sshclient.sample.username=dummy"
-])
+@ContextConfiguration(
+ classes = [BluePrintSshLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprintsprocessor.sshclient.sample.type=basic-auth",
+ "blueprintsprocessor.sshclient.sample.host=127.0.0.1",
+ "blueprintsprocessor.sshclient.sample.port=22",
+ "blueprintsprocessor.sshclient.sample.password=1234",
+ "blueprintsprocessor.sshclient.sample.username=dummy"
+ ]
+)
class BluePrintSshLibPropertyServiceTest {
@Autowired
@@ -48,11 +51,11 @@ class BluePrintSshLibPropertyServiceTest {
@Test
fun testRestClientProperties() {
val properties = bluePrintSshLibPropertyService
- .sshClientProperties("blueprintsprocessor.sshclient.sample") as BasicAuthSshClientProperties
+ .sshClientProperties("blueprintsprocessor.sshclient.sample") as BasicAuthSshClientProperties
assertNotNull(properties, "failed to create property bean")
assertEquals(properties.host, "127.0.0.1", "failed to match host property")
assertEquals(properties.port, 22, "failed to match port property")
assertEquals(properties.password, "1234", "failed to match host property")
assertEquals(properties.username, "dummy", "failed to match host property")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
index 430b988a4..683816f7f 100644
--- a/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/commons/ssh-lib/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/ssh/service/BlueprintSshClientServiceTest.kt
@@ -38,17 +38,20 @@ import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
-
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintSshLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
-@TestPropertySource(properties =
-["blueprintsprocessor.sshclient.sample.type=basic-auth",
- "blueprintsprocessor.sshclient.sample.host=localhost",
- "blueprintsprocessor.sshclient.sample.port=52815",
- "blueprintsprocessor.sshclient.sample.username=root",
- "blueprintsprocessor.sshclient.sample.password=dummyps"
-])
+@ContextConfiguration(
+ classes = [BluePrintSshLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
+@TestPropertySource(
+ properties =
+ ["blueprintsprocessor.sshclient.sample.type=basic-auth",
+ "blueprintsprocessor.sshclient.sample.host=localhost",
+ "blueprintsprocessor.sshclient.sample.port=52815",
+ "blueprintsprocessor.sshclient.sample.username=root",
+ "blueprintsprocessor.sshclient.sample.password=dummyps"
+ ]
+)
class BlueprintSshClientServiceTest {
@Autowired
@@ -76,7 +79,7 @@ class BlueprintSshClientServiceTest {
sshd.keyPairProvider = createTestHostKeyProvider()
sshd.passwordAuthenticator = BogusPasswordAuthenticator(userName, password)
sshd.publickeyAuthenticator = AcceptAllPublickeyAuthenticator.INSTANCE
- //sshd.shellFactory = EchoShellFactory()
+ // sshd.shellFactory = EchoShellFactory()
sshd.commandFactory = ProcessShellCommandFactory.INSTANCE
return sshd
}
@@ -96,5 +99,3 @@ class BogusPasswordAuthenticator(userName: String, password: String) : PasswordA
return true
}
}
-
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
index 2cf5f5f57..d1352b892 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/pom.xml
@@ -34,15 +34,14 @@
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
<artifactId>config-snapshots</artifactId>
- <version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt
index eb7929509..0b18fb01f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotController.kt
@@ -27,7 +27,14 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestMethod
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
/**
* Exposes Resource Configuration Snapshot API to store and retrieve stored resource configurations.
@@ -37,52 +44,66 @@ import org.springframework.web.bind.annotation.*
*/
@RestController
@RequestMapping("/api/v1/configs")
-@Api(value = "/api/v1/configs",
- description = "Interaction with stored configurations.")
+@Api(
+ value = "/api/v1/configs",
+ description = "Interaction with stored configurations."
+)
open class ResourceConfigSnapshotController(private val resourceConfigSnapshotService: ResourceConfigSnapshotService) {
- @RequestMapping(path = ["/health-check"],
+ @RequestMapping(
+ path = ["/health-check"],
method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
@ApiOperation(value = "Health Check", hidden = true)
fun ressCfgSnapshotControllerHealthCheck(): JsonNode = runBlocking {
"Success".asJsonPrimitive()
}
- @RequestMapping(path = [""],
+ @RequestMapping(
+ path = [""],
method = [RequestMethod.GET],
- produces = [MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE])
- @ApiOperation(value = "Retrieve a resource configuration snapshot.",
+ produces = [MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE]
+ )
+ @ApiOperation(
+ value = "Retrieve a resource configuration snapshot.",
notes = "Retrieve a config snapshot, identified by its Resource Id and Type. " +
- "An extra 'format' parameter can be passed to tell what content-type is expected.")
+ "An extra 'format' parameter can be passed to tell what content-type is expected."
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun get(
- @ApiParam(value = "Resource Type associated of the resource configuration snapshot.", required = false)
+ @ApiParam(value = "Resource Type associated of the resource configuration snapshot.", required = false)
@RequestParam(value = "resourceType", required = true) resourceType: String,
- @ApiParam(value = "Resource Id associated of the resource configuration snapshot.", required = false)
+ @ApiParam(value = "Resource Id associated of the resource configuration snapshot.", required = false)
@RequestParam(value = "resourceId", required = true) resourceId: String,
- @ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "RUNNING", required = false)
+ @ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "RUNNING", required = false)
@RequestParam(value = "status", required = false, defaultValue = "RUNNING") status: String,
- @ApiParam(value = "Expected format of the snapshot being retrieved.", defaultValue = MediaType.TEXT_PLAIN_VALUE,
- required = false)
- @RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String)
+ @ApiParam(
+ value = "Expected format of the snapshot being retrieved.", defaultValue = MediaType.TEXT_PLAIN_VALUE,
+ required = false
+ )
+ @RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String
+ ):
- : ResponseEntity<String> = runBlocking {
+ ResponseEntity<String> = runBlocking {
var configSnapshot = ""
if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
try {
- configSnapshot = resourceConfigSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId,
- resourceType, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase()))
- } catch (ex : NoSuchElementException) {
+ configSnapshot = resourceConfigSnapshotService.findByResourceIdAndResourceTypeAndStatus(
+ resourceId,
+ resourceType, ResourceConfigSnapshot.Status.valueOf(status.toUpperCase())
+ )
+ } catch (ex: NoSuchElementException) {
throw ResourceConfigSnapshotException(
- "Could not find configuration snapshot entry for type $resourceType and Id $resourceId")
+ "Could not find configuration snapshot entry for type $resourceType and Id $resourceId"
+ )
}
} else {
throw IllegalArgumentException("Missing param. You must specify resource-id and resource-type.")
@@ -97,12 +118,16 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
ResponseEntity.ok().contentType(expectedMediaType).body(configSnapshot)
}
- @PostMapping("/{resourceType}/{resourceId}/{status}",
- produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Store a resource configuration snapshot identified by resourceId, resourceType, status.",
+ @PostMapping(
+ "/{resourceType}/{resourceId}/{status}",
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
+ @ApiOperation(
+ value = "Store a resource configuration snapshot identified by resourceId, resourceType, status.",
notes = "Store a resource configuration snapshot, identified by its resourceId and resourceType, " +
"and optionally its status, either RUNNING or CANDIDATE.",
- response = ResourceConfigSnapshot::class, produces = MediaType.APPLICATION_JSON_VALUE)
+ response = ResourceConfigSnapshot::class, produces = MediaType.APPLICATION_JSON_VALUE
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun postWithResourceIdAndResourceType(
@@ -113,11 +138,14 @@ open class ResourceConfigSnapshotController(private val resourceConfigSnapshotSe
@ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "RUNNING", required = true)
@PathVariable(value = "status", required = true) status: String,
@ApiParam(value = "Config snapshot to store.", required = true)
- @RequestBody snapshot: String): ResponseEntity<ResourceConfigSnapshot> = runBlocking {
+ @RequestBody snapshot: String
+ ): ResponseEntity<ResourceConfigSnapshot> = runBlocking {
val resultStored =
- resourceConfigSnapshotService.write(snapshot, resourceId, resourceType,
- ResourceConfigSnapshot.Status.valueOf(status.toUpperCase()))
+ resourceConfigSnapshotService.write(
+ snapshot, resourceId, resourceType,
+ ResourceConfigSnapshot.Status.valueOf(status.toUpperCase())
+ )
ResponseEntity.ok().body(resultStored)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt
index d21464ef5..d4c31e780 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotExceptionHandler.kt
@@ -23,16 +23,16 @@ import com.fasterxml.jackson.annotation.JsonTypeName
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.slf4j.LoggerFactory
+import org.springframework.dao.EmptyResultDataAccessException
+import org.springframework.dao.IncorrectResultSizeDataAccessException
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.orm.jpa.JpaObjectRetrievalFailureException
-import org.springframework.dao.EmptyResultDataAccessException
-import org.springframework.dao.IncorrectResultSizeDataAccessException
-import org.springframework.web.server.ServerWebInputException
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.RestControllerAdvice
+import org.springframework.web.server.ServerWebInputException
import java.io.Serializable
-import java.util.*
+import java.util.Date
/**
* Handle exceptions in ResourceConfigSnapshot API and provide relevant HTTP status codes and messages
@@ -102,9 +102,11 @@ open class ResourceConfigSnapshotExceptionHandler {
log.error(e.message)
}
val errorMessage =
- ErrorMessage(errorCode.message(e.message!!),
+ ErrorMessage(
+ errorCode.message(e.message!!),
errorCode.value,
- debugMsg)
+ debugMsg
+ )
return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode.httpCode)!!)
}
}
@@ -113,6 +115,7 @@ open class ResourceConfigSnapshotExceptionHandler {
@JsonTypeName("errorMessage")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
class ErrorMessage(var message: String?, var code: Int?, var debugMessage: String?) : Serializable {
+
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp = Date()
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
index 89f62812e..34c7a7c7c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/ResourceConfigSnapshotControllerTest.kt
@@ -35,8 +35,10 @@ import org.springframework.web.reactive.function.BodyInserters
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class])
+@ContextConfiguration(
+ classes = [BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SecurityProperties::class]
+)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ResourceConfigSnapshotControllerTest {
@@ -68,24 +70,24 @@ class ResourceConfigSnapshotControllerTest {
runBlocking {
webTestClient
- .post()
- .uri("/api/v1/configs/$resourceType/$resourceId/running")
- .body(BodyInserters.fromObject(snapshotData))
- .exchange()
- .expectStatus().is2xxSuccessful
- .expectBody()
- .jsonPath("$.createdDate")
- .value<String> { println(it) }
+ .post()
+ .uri("/api/v1/configs/$resourceType/$resourceId/running")
+ .body(BodyInserters.fromObject(snapshotData))
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ .expectBody()
+ .jsonPath("$.createdDate")
+ .value<String> { println(it) }
webTestClient
- .post()
- .uri("/api/v1/configs/$resourceType/$resourceId/running")
- .body(BodyInserters.fromObject(snapshotData))
- .exchange()
- .expectStatus().is2xxSuccessful
- .expectBody()
- .jsonPath("$.createdDate")
- .value<String> { println(it)}
+ .post()
+ .uri("/api/v1/configs/$resourceType/$resourceId/running")
+ .body(BodyInserters.fromObject(snapshotData))
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ .expectBody()
+ .jsonPath("$.createdDate")
+ .value<String> { println(it) }
}
}
@@ -93,7 +95,7 @@ class ResourceConfigSnapshotControllerTest {
fun `get returns requested JSON content-type`() {
runBlocking {
post(resourceType, "22", "RUNNING")
- get("json", resourceType,"22", "RUNNING")
+ get("json", resourceType, "22", "RUNNING")
}
}
@@ -122,8 +124,8 @@ class ResourceConfigSnapshotControllerTest {
val arguments = "resourceId=MISSING&resourceType=PNF&status=TOTALLY_WRONG"
webTestClient.get().uri("/api/v1/configs?$arguments")
- .exchange()
- .expectStatus().isBadRequest
+ .exchange()
+ .expectStatus().isBadRequest
}
}
@@ -140,7 +142,7 @@ class ResourceConfigSnapshotControllerTest {
}
}
- private fun post( resourceType: String, resourceId: String, status: String) {
+ private fun post(resourceType: String, resourceId: String, status: String) {
webTestClient
.post()
.uri("/api/v1/configs/$resourceType/$resourceId/$status")
@@ -150,7 +152,7 @@ class ResourceConfigSnapshotControllerTest {
.expectBody()
}
- private fun get(expectedType : String, resourceType: String, resourceId: String, status: String) {
+ private fun get(expectedType: String, resourceType: String, resourceId: String, status: String) {
var requestArguments = "resourceId=$resourceId&resourceType=$resourceType&status=$status"
if (expectedType.isNotEmpty()) {
diff --git a/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..661e28def
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/configs-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/configs/api/TestDatabaseConfiguration.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.configs.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots",
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.config.snapshots",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
index 5f2a6dfb6..bca77f275 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandler.kt
@@ -30,31 +30,42 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString
import org.onap.ccsdk.cds.controllerblueprints.core.emptyTONull
import org.onap.ccsdk.cds.controllerblueprints.core.utils.currentTimestamp
-import org.onap.ccsdk.cds.controllerblueprints.management.api.*
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.DownloadAction
+import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk
+import org.onap.ccsdk.cds.controllerblueprints.management.api.RemoveAction
+import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction
import org.slf4j.LoggerFactory
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.stereotype.Service
-//TODO("Convert to coroutines handler")
+// TODO("Convert to coroutines handler")
@Service
-open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: BluePrintModelHandler)
- : BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
+open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: BluePrintModelHandler) :
+ BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase() {
private val log = LoggerFactory.getLogger(BluePrintManagementGRPCHandler::class.java)
@PreAuthorize("hasRole('USER')")
- override fun uploadBlueprint(request: BluePrintUploadInput, responseObserver:
- StreamObserver<BluePrintManagementOutput>) {
+ override fun uploadBlueprint(
+ request: BluePrintUploadInput,
+ responseObserver: StreamObserver<BluePrintManagementOutput>
+ ) {
runBlocking {
- //TODO("catch if request id is missing")
+ // TODO("catch if request id is missing")
log.info("request(${request.commonHeader.requestId})")
try {
/** Get the file byte array */
val byteArray = request.fileChunk.chunk.toByteArray()
/** Get the Upload Action */
val uploadAction = request.actionIdentifiers?.actionName.emptyTONull()
- ?: UploadAction.DRAFT.toString()
+ ?: UploadAction.DRAFT.toString()
when (uploadAction) {
UploadAction.DRAFT.toString() -> {
@@ -66,24 +77,36 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
responseObserver.onNext(successStatus(request.commonHeader, blueprintModel.asJsonString()))
}
UploadAction.VALIDATE.toString() -> {
- //TODO("Not Implemented")
- responseObserver.onNext(failStatus(request.commonHeader,
+ // TODO("Not Implemented")
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
"Upload action($uploadAction) not implemented",
- BluePrintProcessorException("Not Implemented")))
+ BluePrintProcessorException("Not Implemented")
+ )
+ )
}
UploadAction.ENRICH.toString() -> {
val enrichedByteArray = bluePrintModelHandler.enrichBlueprintFileSource(byteArray)
responseObserver.onNext(outputWithFileBytes(request.commonHeader, enrichedByteArray))
}
else -> {
- responseObserver.onNext(failStatus(request.commonHeader,
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
"Upload action($uploadAction) not implemented",
- BluePrintProcessorException("Not implemented")))
+ BluePrintProcessorException("Not implemented")
+ )
+ )
}
}
} catch (e: Exception) {
- responseObserver.onNext(failStatus(request.commonHeader,
- "request(${request.commonHeader.requestId}): Failed to upload CBA", e))
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to upload CBA", e
+ )
+ )
} finally {
responseObserver.onCompleted()
}
@@ -91,8 +114,10 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
}
@PreAuthorize("hasRole('USER')")
- override fun downloadBlueprint(request: BluePrintDownloadInput,
- responseObserver: StreamObserver<BluePrintManagementOutput>) {
+ override fun downloadBlueprint(
+ request: BluePrintDownloadInput,
+ responseObserver: StreamObserver<BluePrintManagementOutput>
+ ) {
runBlocking {
val blueprintName = request.actionIdentifiers.blueprintName
val blueprintVersion = request.actionIdentifiers.blueprintVersion
@@ -100,7 +125,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
/** Get the Search Action */
val searchAction = request.actionIdentifiers?.actionName.emptyTONull()
- ?: DownloadAction.SEARCH.toString()
+ ?: DownloadAction.SEARCH.toString()
log.info("request(${request.commonHeader.requestId}): Received download $blueprint")
try {
@@ -110,14 +135,22 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
responseObserver.onNext(outputWithFileBytes(request.commonHeader, downloadByteArray))
}
else -> {
- responseObserver.onNext(failStatus(request.commonHeader,
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
"Search action($searchAction) not implemented",
- BluePrintProcessorException("Not implemented")))
+ BluePrintProcessorException("Not implemented")
+ )
+ )
}
}
} catch (e: Exception) {
- responseObserver.onNext(failStatus(request.commonHeader,
- "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e))
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e
+ )
+ )
} finally {
responseObserver.onCompleted()
}
@@ -125,8 +158,11 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
}
@PreAuthorize("hasRole('USER')")
- override fun removeBlueprint(request: BluePrintRemoveInput, responseObserver:
- StreamObserver<BluePrintManagementOutput>) {
+ override fun removeBlueprint(
+ request: BluePrintRemoveInput,
+ responseObserver:
+ StreamObserver<BluePrintManagementOutput>
+ ) {
runBlocking {
val blueprintName = request.actionIdentifiers.blueprintName
@@ -137,7 +173,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
/** Get the Remove Action */
val removeAction = request.actionIdentifiers?.actionName.emptyTONull()
- ?: RemoveAction.DEFAULT.toString()
+ ?: RemoveAction.DEFAULT.toString()
try {
when (removeAction) {
@@ -146,22 +182,32 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
responseObserver.onNext(successStatus(request.commonHeader))
}
else -> {
- responseObserver.onNext(failStatus(request.commonHeader,
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
"Remove action($removeAction) not implemented",
- BluePrintProcessorException("Not implemented")))
+ BluePrintProcessorException("Not implemented")
+ )
+ )
}
}
} catch (e: Exception) {
- responseObserver.onNext(failStatus(request.commonHeader,
- "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e))
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to delete $blueprint", e
+ )
+ )
} finally {
responseObserver.onCompleted()
}
}
}
- override fun bootstrapBlueprint(request: BluePrintBootstrapInput,
- responseObserver: StreamObserver<BluePrintManagementOutput>) {
+ override fun bootstrapBlueprint(
+ request: BluePrintBootstrapInput,
+ responseObserver: StreamObserver<BluePrintManagementOutput>
+ ) {
runBlocking {
try {
log.info("request(${request.commonHeader.requestId}): Received bootstrap request")
@@ -173,10 +219,13 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
/** Perform bootstrap of Model Types, Resource Definitions and CBA */
bluePrintModelHandler.bootstrapBlueprint(bootstrapRequest)
responseObserver.onNext(successStatus(request.commonHeader))
-
} catch (e: Exception) {
- responseObserver.onNext(failStatus(request.commonHeader,
- "request(${request.commonHeader.requestId}): Failed to bootstrap", e))
+ responseObserver.onNext(
+ failStatus(
+ request.commonHeader,
+ "request(${request.commonHeader.requestId}): Failed to bootstrap", e
+ )
+ )
} finally {
responseObserver.onCompleted()
}
@@ -184,15 +233,17 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
}
private fun outputWithFileBytes(header: CommonHeader, byteArray: ByteArray): BluePrintManagementOutput =
- BluePrintManagementOutput.newBuilder()
- .setCommonHeader(header)
- .setFileChunk(FileChunk.newBuilder().setChunk(ByteString.copyFrom(byteArray)))
- .setStatus(Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_SUCCESS)
- .setCode(200)
- .build())
+ BluePrintManagementOutput.newBuilder()
+ .setCommonHeader(header)
+ .setFileChunk(FileChunk.newBuilder().setChunk(ByteString.copyFrom(byteArray)))
+ .setStatus(
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_SUCCESS)
+ .setCode(200)
.build()
+ )
+ .build()
private fun successStatus(header: CommonHeader, propertyContent: String? = null): BluePrintManagementOutput {
// Populate Response Payload
@@ -201,30 +252,34 @@ open class BluePrintManagementGRPCHandler(private val bluePrintModelHandler: Blu
JsonFormat.parser().merge(propertyContent, propertiesBuilder)
}
return BluePrintManagementOutput.newBuilder()
- .setCommonHeader(header)
- .setProperties(propertiesBuilder.build())
- .setStatus(Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_SUCCESS)
- .setCode(200)
- .build())
- .build()
+ .setCommonHeader(header)
+ .setProperties(propertiesBuilder.build())
+ .setStatus(
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_SUCCESS)
+ .setCode(200)
+ .build()
+ )
+ .build()
}
private fun failStatus(header: CommonHeader, message: String, e: Exception): BluePrintManagementOutput {
log.error(message, e)
return BluePrintManagementOutput.newBuilder()
- .setCommonHeader(header)
- .setStatus(Status.newBuilder()
- .setTimestamp(currentTimestamp())
- .setMessage(BluePrintConstants.STATUS_FAILURE)
- .setErrorMessage(message)
- .setCode(500)
- .build())
- .build()
-// return io.grpc.Status.INTERNAL
-// .withDescription(message)
-// .withCause(e)
-// .asException()
+ .setCommonHeader(header)
+ .setStatus(
+ Status.newBuilder()
+ .setTimestamp(currentTimestamp())
+ .setMessage(BluePrintConstants.STATUS_FAILURE)
+ .setErrorMessage(message)
+ .setCode(500)
+ .build()
+ )
+ .build()
+ // return io.grpc.Status.INTERNAL
+ // .withDescription(message)
+ // .withCause(e)
+ // .asException()
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
index 5ef50b09f..f257157c8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelController.kt
@@ -34,7 +34,16 @@ import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.http.codec.multipart.FilePart
import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.DeleteMapping
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.RequestPart
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Mono
/**
@@ -47,8 +56,10 @@ import reactor.core.publisher.Mono
@RequestMapping("/api/v1/blueprint-model")
open class BlueprintModelController(private val bluePrintModelHandler: BluePrintModelHandler) {
- @PostMapping(path = arrayOf("/bootstrap"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE),
- consumes = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @PostMapping(
+ path = arrayOf("/bootstrap"), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE),
+ consumes = arrayOf(MediaType.APPLICATION_JSON_VALUE)
+ )
@ResponseBody
@Throws(BluePrintException::class)
@PreAuthorize("hasRole('USER')")
@@ -74,9 +85,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@GetMapping("/paged", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@PreAuthorize("hasRole('USER')")
- fun allBlueprintModel(@RequestParam(defaultValue = "20") limit: Int,
- @RequestParam(defaultValue = "0") offset: Int,
- @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption): Page<BlueprintModelSearch> {
+ fun allBlueprintModel(
+ @RequestParam(defaultValue = "20") limit: Int,
+ @RequestParam(defaultValue = "0") offset: Int,
+ @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption
+ ): Page<BlueprintModelSearch> {
val pageRequest = PageRequest.of(offset, limit, Sort.Direction.ASC, sort.columnName)
return this.bluePrintModelHandler.allBlueprintModel(pageRequest)
}
@@ -88,18 +101,17 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
return this.bluePrintModelHandler.searchBluePrintModelsByKeyWord(keyWord)
}
-
@GetMapping("/paged/meta-data/{keyword}", produces = [MediaType.APPLICATION_JSON_VALUE])
@ResponseBody
@PreAuthorize("hasRole('USER')")
- fun allBlueprintModelMetaDataPaged(@NotNull @PathVariable(value = "keyword") keyWord: String,
- @RequestParam(defaultValue = "20") limit: Int,
- @RequestParam(defaultValue = "0") offset: Int,
- @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption
+ fun allBlueprintModelMetaDataPaged(
+ @NotNull @PathVariable(value = "keyword") keyWord: String,
+ @RequestParam(defaultValue = "20") limit: Int,
+ @RequestParam(defaultValue = "0") offset: Int,
+ @RequestParam(defaultValue = "DATE") sort: BlueprintSortByOption
): Page<BlueprintModelSearch> {
val pageRequest = PageRequest.of(offset, limit, Sort.Direction.ASC, sort.columnName)
return this.bluePrintModelHandler.searchBluePrintModelsByKeyWordPaged(keyWord, pageRequest)
-
}
@DeleteMapping("/{id}")
@@ -113,9 +125,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@ResponseBody
@Throws(BluePrintException::class)
@PreAuthorize("hasRole('USER')")
- fun getBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
- @PathVariable(value = "version") version: String)
- : Mono<BlueprintModelSearch> = monoMdc {
+ fun getBlueprintByNameAndVersion(
+ @PathVariable(value = "name") name: String,
+ @PathVariable(value = "version") version: String
+ ):
+ Mono<BlueprintModelSearch> = monoMdc {
bluePrintModelHandler.getBlueprintModelSearchByNameAndVersion(name, version)
}
@@ -123,9 +137,11 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
@ResponseBody
@Throws(BluePrintException::class)
@PreAuthorize("hasRole('USER')")
- fun downloadBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
- @PathVariable(value = "version") version: String)
- : Mono<ResponseEntity<Resource>> = monoMdc {
+ fun downloadBlueprintByNameAndVersion(
+ @PathVariable(value = "name") name: String,
+ @PathVariable(value = "version") version: String
+ ):
+ Mono<ResponseEntity<Resource>> = monoMdc {
bluePrintModelHandler.downloadBlueprintModelFileByNameAndVersion(name, version)
}
@@ -145,8 +161,10 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
bluePrintModelHandler.downloadBlueprintModelFile(id)
}
- @PostMapping("/enrich", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
- .MULTIPART_FORM_DATA_VALUE])
+ @PostMapping(
+ "/enrich", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType
+ .MULTIPART_FORM_DATA_VALUE]
+ )
@ResponseBody
@Throws(BluePrintException::class)
@PreAuthorize("hasRole('USER')")
@@ -170,14 +188,18 @@ open class BlueprintModelController(private val bluePrintModelHandler: BluePrint
}
@DeleteMapping("/name/{name}/version/{version}")
- @ApiOperation(value = "Delete a CBA",
- notes = "Delete the CBA package identified by its name and version.",
- produces = MediaType.APPLICATION_JSON_VALUE)
+ @ApiOperation(
+ value = "Delete a CBA",
+ notes = "Delete the CBA package identified by its name and version.",
+ produces = MediaType.APPLICATION_JSON_VALUE
+ )
@PreAuthorize("hasRole('USER')")
- fun deleteBlueprint(@ApiParam(value = "Name of the CBA.", required = true)
- @PathVariable(value = "name") name: String,
- @ApiParam(value = "Version of the CBA.", required = true)
- @PathVariable(value = "version") version: String) = monoMdc {
+ fun deleteBlueprint(
+ @ApiParam(value = "Name of the CBA.", required = true)
+ @PathVariable(value = "name") name: String,
+ @ApiParam(value = "Version of the CBA.", required = true)
+ @PathVariable(value = "version") version: String
+ ) = monoMdc {
bluePrintModelHandler.deleteBlueprintModel(name, version)
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
index 346015bc4..d0cb67315 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiData.kt
@@ -24,8 +24,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import java.io.Serializable
-import java.util.*
-
+import java.util.Date
class BootstrapRequest {
var loadModelType: Boolean = false
@@ -40,15 +39,16 @@ class BootstrapRequest {
* @version 1.0
*/
class AutoMapResponse {
+
var resourceAssignments: List<ResourceAssignment>? = null
var dataDictionaries: List<ResourceDictionary>? = null
}
-
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonTypeName("errorMessage")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
class ErrorMessage(var message: String?, var code: Int?, var debugMessage: String?) : Serializable {
+
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp = Date()
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt
index bac281356..adeb3cf89 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt
@@ -18,11 +18,18 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
import kotlinx.coroutines.runBlocking
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.springframework.http.MediaType
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.DeleteMapping
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping(value = arrayOf("/api/v1/model-type"))
@@ -55,4 +62,4 @@ open class ModelTypeController(private val modelTypeHandler: ModelTypeHandler) {
fun deleteModelTypeByName(@PathVariable(value = "name") name: String) = runBlocking {
modelTypeHandler.deleteByModelName(name)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
index bae890a87..562932e23 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
@@ -22,7 +22,14 @@ import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDicti
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceSourceMapping
import org.springframework.http.MediaType
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.DeleteMapping
+import org.springframework.web.bind.annotation.GetMapping
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping(value = ["/api/v1/dictionary"])
@@ -57,7 +64,6 @@ open class ResourceDictionaryController(private val resourceDictionaryHandler: R
@ResponseBody
fun searchResourceDictionaryByTags(@PathVariable(value = "tags") tags: String): List<ResourceDictionary> = runBlocking {
resourceDictionaryHandler.searchResourceDictionaryByTags(tags)
-
}
@GetMapping(path = ["/source-mapping"], produces = [MediaType.APPLICATION_JSON_VALUE])
@@ -65,5 +71,4 @@ open class ResourceDictionaryController(private val resourceDictionaryHandler: R
fun getResourceSourceMapping(): ResourceSourceMapping = runBlocking {
resourceDictionaryHandler.getResourceSourceMapping()
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt
index 97c7ab6a6..4779ad340 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaJsonNodeConverter.kt
@@ -18,7 +18,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain
import com.fasterxml.jackson.databind.JsonNode
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-
import javax.persistence.AttributeConverter
import javax.persistence.Converter
@@ -35,4 +34,4 @@ class JpaJsonNodeConverter : AttributeConverter<JsonNode, String> {
override fun convertToEntityAttribute(dbData: String): JsonNode {
return JacksonUtils.jsonNode(dbData)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt
index 75cfede50..f0692cdd9 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/JpaResourceDefinitionConverter.kt
@@ -18,7 +18,6 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
-
import javax.persistence.AttributeConverter
import javax.persistence.Converter
@@ -27,6 +26,7 @@ import javax.persistence.Converter
*/
@Converter
class JpaResourceDefinitionConverter : AttributeConverter<ResourceDefinition, String> {
+
override fun convertToDatabaseColumn(resourceDefinition: ResourceDefinition): String {
return JacksonUtils.getJson(resourceDefinition)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
index a964e0416..6e277e5c8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ModelType.kt
@@ -22,8 +22,16 @@ import io.swagger.annotations.ApiModelProperty
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Convert
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
/**
* Provide ModelType Entity
@@ -94,4 +102,4 @@ class ModelType : Serializable {
companion object {
private const val serialVersionUID = 1L
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
index ac5ea2070..209e2bbe8 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
@@ -22,8 +22,16 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
import java.io.Serializable
-import java.util.*
-import javax.persistence.*
+import java.util.Date
+import javax.persistence.Column
+import javax.persistence.Convert
+import javax.persistence.Entity
+import javax.persistence.EntityListeners
+import javax.persistence.Id
+import javax.persistence.Lob
+import javax.persistence.Table
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
/**
* Provide ResourceDictionary Entity
@@ -89,6 +97,4 @@ class ResourceDictionary : Serializable {
companion object {
private const val serialVersionUID = 1L
}
-
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
index 552339be9..f954df7ac 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintArtifactDefinitionEnhancerImpl.kt
@@ -32,22 +32,22 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.springframework.stereotype.Service
@Service
-open class BluePrintArtifactDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService)
- : BluePrintArtifactDefinitionEnhancer {
+open class BluePrintArtifactDefinitionEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService
+) :
+ BluePrintArtifactDefinitionEnhancer {
companion object {
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
}
-
private val log = logger(BluePrintArtifactDefinitionEnhancerImpl::class)
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
-
override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, artifactDefinition: ArtifactDefinition) {
log.info("enhancing ArtifactDefinition($name)")
@@ -55,7 +55,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(private val bluePrintRepoServ
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val artifactTypeName = artifactDefinition.type
- ?: throw BluePrintException("artifact type is missing for ArtifactDefinition($name)")
+ ?: throw BluePrintException("artifact type is missing for ArtifactDefinition($name)")
// Populate Artifact Type
BluePrintEnhancerUtils.populateArtifactType(bluePrintContext, bluePrintRepoService, artifactTypeName)
@@ -80,7 +80,7 @@ open class BluePrintArtifactDefinitionEnhancerImpl(private val bluePrintRepoServ
if (!alreadyEnhanced) {
val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(artifactFilePath, ResourceAssignment::class.java)
as? MutableList<ResourceAssignment>
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($artifactFilePath)")
+ ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($artifactFilePath)")
// Call Resource Assignment Enhancer
resourceAssignmentEnhancerService.enhanceBluePrint(bluePrintTypeEnhancerService, bluePrintRuntimeService, resourceAssignments)
@@ -88,5 +88,4 @@ open class BluePrintArtifactDefinitionEnhancerImpl(private val bluePrintRepoServ
bluePrintRuntimeService.put(alreadyEnhancedKey, true.asJsonPrimitive())
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
index 0b64ed503..030fbe8ae 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintAttributeDefinitionEnhancerImpl.kt
@@ -26,9 +26,11 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnha
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintAttributeDefinitionEnhancer {
+class BluePrintAttributeDefinitionEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) :
+ BluePrintAttributeDefinitionEnhancer {
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
@@ -39,10 +41,9 @@ class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService:
val propertyType = attributeDefinition.type
if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
-
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchema = attributeDefinition.entrySchema
- ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
+ ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, entrySchema.type)
@@ -51,5 +52,4 @@ class BluePrintAttributeDefinitionEnhancerImpl(private val bluePrintRepoService:
BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, propertyType)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
index b4d149e16..e99f49489 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImpl.kt
@@ -26,11 +26,13 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.UUID
@Service
-open class BluePrintEnhancerServiceImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- private val resourceDefinitionEnhancerService: ResourceDefinitionEnhancerService) : BluePrintEnhancerService {
+open class BluePrintEnhancerServiceImpl(
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ private val resourceDefinitionEnhancerService: ResourceDefinitionEnhancerService
+) : BluePrintEnhancerService {
private val log = logger(BluePrintEnhancerServiceImpl::class)
@@ -48,16 +50,20 @@ open class BluePrintEnhancerServiceImpl(private val bluePrintTypeEnhancerService
log.info("Enhancing blueprint($basePath)")
val blueprintRuntimeService = BluePrintMetadataUtils
- .getBaseEnhancementBluePrintRuntime(UUID.randomUUID().toString(), basePath)
+ .getBaseEnhancementBluePrintRuntime(UUID.randomUUID().toString(), basePath)
try {
- bluePrintTypeEnhancerService.enhanceServiceTemplate(blueprintRuntimeService, "service_template",
- blueprintRuntimeService.bluePrintContext().serviceTemplate)
+ bluePrintTypeEnhancerService.enhanceServiceTemplate(
+ blueprintRuntimeService, "service_template",
+ blueprintRuntimeService.bluePrintContext().serviceTemplate
+ )
log.info("##### Enhancing blueprint Resource Definitions")
- val resourceDefinitions = resourceDefinitionEnhancerService.enhance(bluePrintTypeEnhancerService,
- blueprintRuntimeService)
+ val resourceDefinitions = resourceDefinitionEnhancerService.enhance(
+ bluePrintTypeEnhancerService,
+ blueprintRuntimeService
+ )
// Write the Enhanced Blueprint Definitions
BluePrintFileUtils.writeEnhancedBluePrint(blueprintRuntimeService.bluePrintContext())
@@ -68,12 +74,9 @@ open class BluePrintEnhancerServiceImpl(private val bluePrintTypeEnhancerService
if (blueprintRuntimeService.getBluePrintError().errors.isNotEmpty()) {
throw BluePrintException(blueprintRuntimeService.getBluePrintError().errors.toString())
}
-
} catch (e: Exception) {
throw e
}
return blueprintRuntimeService.bluePrintContext()
}
-
}
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
index 723d7bb27..6ca0b2d14 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTemplateEnhancerImpl.kt
@@ -31,22 +31,22 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintNodeTemplateEnhancer {
+open class BluePrintNodeTemplateEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) :
+ BluePrintNodeTemplateEnhancer {
- private val log= logger(BluePrintNodeTemplateEnhancerImpl::class)
+ private val log = logger(BluePrintNodeTemplateEnhancerImpl::class)
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
-
override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
log.info("***** Enhancing NodeTemplate($name)")
this.bluePrintRuntimeService = bluePrintRuntimeService
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
val nodeTypeName = nodeTemplate.type
// Get NodeType from Repo and Update Service Template
val nodeType = BluePrintEnhancerUtils.populateNodeType(bluePrintContext, bluePrintRepoService, nodeTypeName)
@@ -54,7 +54,7 @@ open class BluePrintNodeTemplateEnhancerImpl(private val bluePrintRepoService: B
// Enrich NodeType
bluePrintTypeEnhancerService.enhanceNodeType(bluePrintRuntimeService, nodeTypeName, nodeType)
- //Enrich Node Template Artifacts
+ // Enrich Node Template Artifacts
enhanceNodeTemplateArtifactDefinition(name, nodeTemplate)
}
@@ -65,5 +65,4 @@ open class BluePrintNodeTemplateEnhancerImpl(private val bluePrintRepoService: B
bluePrintTypeEnhancerService.enhanceArtifactDefinition(bluePrintRuntimeService, artifactDefinitionName, artifactDefinition)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
index efb695b22..d28084e40 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintNodeTypeEnhancerImpl.kt
@@ -34,20 +34,20 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintNodeTypeEnhancer {
+open class BluePrintNodeTypeEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) : BluePrintNodeTypeEnhancer {
- private val log= logger(BluePrintNodeTypeEnhancerImpl::class)
+ private val log = logger(BluePrintNodeTypeEnhancerImpl::class)
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
-
override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) {
this.bluePrintRuntimeService = bluePrintRuntimeService
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
-
val derivedFrom = nodeType.derivedFrom
if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
@@ -62,15 +62,14 @@ open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BlueP
// NodeType Property Definitions
enrichNodeTypeProperties(name, nodeType)
- //NodeType Requirement
+ // NodeType Requirement
enrichNodeTypeRequirements(name, nodeType)
- //NodeType Capability
+ // NodeType Capability
enrichNodeTypeCapabilityProperties(name, nodeType)
- //NodeType Interface
+ // NodeType Interface
enrichNodeTypeInterfaces(name, nodeType)
-
}
open fun enrichNodeTypeAttributes(nodeTypeName: String, nodeType: NodeType) {
@@ -91,15 +90,19 @@ open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BlueP
// Populate Requirement Node
requirementDefinition.node?.let { requirementNodeTypeName ->
// Get Requirement NodeType from Repo and Update Service Template
- val requirementNodeType = BluePrintEnhancerUtils.populateNodeType(bluePrintContext,
- bluePrintRepoService, requirementNodeTypeName)
+ val requirementNodeType = BluePrintEnhancerUtils.populateNodeType(
+ bluePrintContext,
+ bluePrintRepoService, requirementNodeTypeName
+ )
// Enhance Node Type
enhance(bluePrintRuntimeService, requirementNodeTypeName, requirementNodeType)
// Enhance Relationship Type
val relationShipTypeName = requirementDefinition.relationship
- ?: throw BluePrintException("couldn't get relationship name for the NodeType($nodeTypeName) " +
- "Requirement($requirementName)")
+ ?: throw BluePrintException(
+ "couldn't get relationship name for the NodeType($nodeTypeName) " +
+ "Requirement($requirementName)"
+ )
enrichRelationShipType(relationShipTypeName)
}
}
@@ -118,7 +121,6 @@ open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BlueP
// Populate Node type Interface Operation
log.debug("Enriching NodeType({}) Interface({})", nodeTypeName, interfaceName)
populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)
-
}
}
@@ -136,8 +138,11 @@ open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BlueP
}
}
- open fun enrichNodeTypeInterfaceOperationOutputs(nodeTypeName: String, operationName: String,
- operation: OperationDefinition) {
+ open fun enrichNodeTypeInterfaceOperationOutputs(
+ nodeTypeName: String,
+ operationName: String,
+ operation: OperationDefinition
+ ) {
operation.outputs?.let { inputs ->
bluePrintTypeEnhancerService.enhancePropertyDefinitions(bluePrintRuntimeService, inputs)
}
@@ -149,5 +154,4 @@ open class BluePrintNodeTypeEnhancerImpl(private val bluePrintRepoService: BlueP
open fun enrichRelationShipType(relationshipName: String) {
BluePrintEnhancerUtils.populateRelationshipType(bluePrintContext, bluePrintRepoService, relationshipName)
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
index 83fd403e8..212dc440d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPolicyTypeEnhancerImpl.kt
@@ -27,17 +27,18 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-class BluePrintPolicyTypeEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintPolicyTypeEnhancer {
+class BluePrintPolicyTypeEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) :
+ BluePrintPolicyTypeEnhancer {
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
-
override fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: PolicyType) {
- this.bluePrintRuntimeService = bluePrintRuntimeService
+ this.bluePrintRuntimeService = bluePrintRuntimeService
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
index b87cf9c6b..eb7443443 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintPropertyDefinitionEnhancerImpl.kt
@@ -32,9 +32,11 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintPropertyDefinitionEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintPropertyDefinitionEnhancer {
+open class BluePrintPropertyDefinitionEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) :
+ BluePrintPropertyDefinitionEnhancer {
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
@@ -44,12 +46,13 @@ open class BluePrintPropertyDefinitionEnhancerImpl(private val bluePrintRepoServ
this.bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val propertyType = propertyDefinition.type
- if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)
- || BluePrintTypes.validComplexTypes().contains(propertyType)) {
+ if (BluePrintTypes.validPrimitiveTypes().contains(propertyType) ||
+ BluePrintTypes.validComplexTypes().contains(propertyType)
+ ) {
// Do Nothing,
} else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchema = propertyDefinition.entrySchema
- ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
+ ?: throw BluePrintException("Entry Schema is missing for collection property($name)")
if (!BluePrintTypes.validPrimitiveTypes().contains(entrySchema.type)) {
BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, entrySchema.type)
@@ -58,5 +61,4 @@ open class BluePrintPropertyDefinitionEnhancerImpl(private val bluePrintRepoServ
BluePrintEnhancerUtils.populateDataTypes(bluePrintContext, bluePrintRepoService, propertyType)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
index 65e5ff9e1..9f4a4592a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintServiceTemplateEnhancerImpl.kt
@@ -28,10 +28,10 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintServiceTemplateEnhancerImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService)
- : BluePrintServiceTemplateEnhancer {
- private val log = logger(BluePrintServiceTemplateEnhancerImpl::class)
+open class BluePrintServiceTemplateEnhancerImpl(private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) :
+ BluePrintServiceTemplateEnhancer {
+ private val log = logger(BluePrintServiceTemplateEnhancerImpl::class)
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var bluePrintContext: BluePrintContext
@@ -57,7 +57,6 @@ open class BluePrintServiceTemplateEnhancerImpl(private val bluePrintTypeEnhance
bluePrintContext.serviceTemplate.policyTypes = mutableMapOf()
bluePrintContext.serviceTemplate.relationshipTypes = mutableMapOf()
log.info("reinitialized all type definitions")
-
}
open fun enhanceTopologyTemplate() {
@@ -65,4 +64,4 @@ open class BluePrintServiceTemplateEnhancerImpl(private val bluePrintTypeEnhance
bluePrintTypeEnhancerService.enhanceTopologyTemplate(bluePrintRuntimeService, "topology_template", topologyTemplate)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
index c22370c33..c0100fbea 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTopologyTemplateEnhancerImpl.kt
@@ -27,8 +27,11 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintTopologyTemplateEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService) : BluePrintTopologyTemplateEnhancer {
+open class BluePrintTopologyTemplateEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService
+) :
+ BluePrintTopologyTemplateEnhancer {
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
@@ -57,5 +60,4 @@ open class BluePrintTopologyTemplateEnhancerImpl(private val bluePrintRepoServic
bluePrintTypeEnhancerService.enhanceWorkflow(bluePrintRuntimeService, workflowName, workflow)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt
index db361a248..5b7c6b2d0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintTypeEnhancerServiceImpl.kt
@@ -16,7 +16,16 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
-import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.*
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintArtifactDefinitionEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintAttributeDefinitionEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTemplateEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintNodeTypeEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPolicyTypeEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintPropertyDefinitionEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintServiceTemplateEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTopologyTemplateEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowEnhancer
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
@@ -62,4 +71,4 @@ open class BluePrintTypeEnhancerServiceImpl : BluePrintTypeEnhancerService {
override fun getAttributeDefinitionEnhancers(): List<BluePrintAttributeDefinitionEnhancer> {
return context.getBeansOfType(BluePrintAttributeDefinitionEnhancer::class.java).map { it.value }
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
index 394289ced..88127e3ca 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintWorkflowEnhancerImpl.kt
@@ -17,13 +17,17 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.data.Workflow
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowEnhancer
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -34,11 +38,14 @@ import org.springframework.stereotype.Service
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BluePrintRepoService,
- private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService)
- : BluePrintWorkflowEnhancer {
- private val log= logger(BluePrintWorkflowEnhancerImpl::class)
+open class BluePrintWorkflowEnhancerImpl(
+ private val bluePrintRepoService: BluePrintRepoService,
+ private val bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ private val resourceAssignmentEnhancerService: ResourceAssignmentEnhancerService
+) :
+ BluePrintWorkflowEnhancer {
+
+ private val log = logger(BluePrintWorkflowEnhancerImpl::class)
companion object {
const val ARTIFACT_TYPE_MAPPING_SOURCE: String = "artifact-mapping-resource"
@@ -70,8 +77,6 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
// Enrich Only for Resource Assignment and Dynamic Input Properties if any
enhanceStepTargets(name, workflow)
-
-
}
open fun enhanceWorkflowInputs(name: String, workflow: Workflow) {
@@ -102,11 +107,12 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
enhanceStepTargets(name, workflow, firstNodeTemplateName, true)
}
else -> {
- throw BluePrintProcessorException("couldn't execute workflow($name) step mapped " +
- "to node template($firstNodeTemplateName) derived from($derivedFrom)")
+ throw BluePrintProcessorException(
+ "couldn't execute workflow($name) step mapped " +
+ "to node template($firstNodeTemplateName) derived from($derivedFrom)"
+ )
}
}
-
}
private fun enhanceStepTargets(name: String, workflow: Workflow, nodeTemplateName: String, isDG: Boolean) {
@@ -132,10 +138,10 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
log.info("identified workflow($name) targets($componentNodeTemplateName)")
val resourceAssignmentArtifacts = bluePrintContext.nodeTemplateByName(componentNodeTemplateName)
- .artifacts?.filter {
+ .artifacts?.filter {
it.value.type == ARTIFACT_TYPE_MAPPING_SOURCE
}?.map {
- log.info("resource assignment artifacts(${it.key}) for NodeType(${componentNodeTemplateName})")
+ log.info("resource assignment artifacts(${it.key}) for NodeType($componentNodeTemplateName)")
it.value.file
}
resourceAssignmentArtifacts
@@ -162,13 +168,13 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
val filePath = "${bluePrintContext.rootPath}/$fileName"
- log.info("enriching artifacts file(${filePath}")
+ log.info("enriching artifacts file($filePath")
val resourceAssignmentProperties: MutableMap<String, PropertyDefinition> = hashMapOf()
val resourceAssignments: MutableList<ResourceAssignment> = JacksonUtils.getListFromFile(filePath, ResourceAssignment::class.java)
as? MutableList<ResourceAssignment>
- ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
+ ?: throw BluePrintProcessorException("couldn't get ResourceAssignment definitions for the file($filePath)")
val alreadyEnhancedKey = "enhanced-$fileName"
val alreadyEnhanced = bluePrintRuntimeService.check(alreadyEnhancedKey)
@@ -215,7 +221,6 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
// Overwrite WorkFlow DataType
bluePrintContext.serviceTemplate.dataTypes?.put(dataTypeName, dynamicDataType)
-
} else {
log.info("dynamic dataType($dataTypeName) already present for workflow($workflowName).")
}
@@ -224,4 +229,4 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
dynamicDataType.properties?.put(propertyName, propertyDefinition)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
index 55eb42f89..94e183405 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceAssignmentEnhancerService.kt
@@ -16,6 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
@@ -25,7 +26,6 @@ import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDictionaryConstants
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.factory.ResourceSourceMappingFactory
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@@ -38,9 +38,11 @@ import org.springframework.stereotype.Service
interface ResourceAssignmentEnhancerService {
@Throws(BluePrintException::class)
- fun enhanceBluePrint(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
- resourceAssignments: List<ResourceAssignment>)
+ fun enhanceBluePrint(
+ bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ resourceAssignments: List<ResourceAssignment>
+ )
}
/**
@@ -50,17 +52,20 @@ interface ResourceAssignmentEnhancerService {
*/
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService)
- : ResourceAssignmentEnhancerService {
- private val log= logger(ResourceAssignmentEnhancerServiceImpl::class)
+open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService) :
+ ResourceAssignmentEnhancerService {
+
+ private val log = logger(ResourceAssignmentEnhancerServiceImpl::class)
/**
* Get the defined source instance from the ResourceAssignment,
* then get the NodeType of the Sources assigned
*/
- override fun enhanceBluePrint(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>,
- resourceAssignments: List<ResourceAssignment>) {
+ override fun enhanceBluePrint(
+ bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ resourceAssignments: List<ResourceAssignment>
+ ) {
val uniqueSourceNodeTypeNames = hashSetOf<String>()
@@ -77,14 +82,16 @@ open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionR
// TODO("Candidate for Optimisation")
if (checkResourceDefinitionNeeded(resourceAssignment)) {
- bluePrintTypeEnhancerService.enhancePropertyDefinition(bluePrintRuntimeService, resourceAssignment.name,
- resourceAssignment.property!!);
+ bluePrintTypeEnhancerService.enhancePropertyDefinition(
+ bluePrintRuntimeService, resourceAssignment.name,
+ resourceAssignment.property!!
+ )
// Get the Resource Definition from Repo
val resourceDefinition: ResourceDefinition = getResourceDefinition(dictionaryName)
val sourceNodeTemplate = resourceDefinition.sources[dictionarySource]
- ?: throw BluePrintException("failed to get assigned dictionarySource($dictionarySource) from resourceDefinition($dictionaryName)")
+ ?: throw BluePrintException("failed to get assigned dictionarySource($dictionarySource) from resourceDefinition($dictionaryName)")
// Enrich as NodeTemplate
bluePrintTypeEnhancerService.enhanceNodeTemplate(bluePrintRuntimeService, dictionarySource, sourceNodeTemplate)
@@ -95,16 +102,15 @@ open class ResourceAssignmentEnhancerServiceImpl(private val resourceDefinitionR
val nodeType = resourceDefinitionRepoService.getNodeType(nodeTypeName)
bluePrintTypeEnhancerService.enhanceNodeType(bluePrintRuntimeService, nodeTypeName, nodeType)
}
-
}
private fun checkResourceDefinitionNeeded(resourceAssignment: ResourceAssignment): Boolean {
- return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT)
- || resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT))
- && BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))
+ return !((resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_INPUT) ||
+ resourceAssignment.dictionarySource.equals(ResourceDictionaryConstants.SOURCE_DEFAULT)) &&
+ BluePrintTypes.validPrimitiveOrCollectionPrimitive(resourceAssignment.property!!))
}
private fun getResourceDefinition(name: String): ResourceDefinition {
return resourceDefinitionRepoService.getResourceDefinition(name)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
index c018664e4..042c76805 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/ResourceDefinitionEnhancerService.kt
@@ -20,6 +20,8 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.enhancer
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintTypeEnhancerService
import org.onap.ccsdk.cds.controllerblueprints.core.logger
@@ -28,20 +30,20 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.service.ResourceDefinitionRepoService
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
import org.springframework.stereotype.Service
interface ResourceDefinitionEnhancerService {
@Throws(BluePrintException::class)
- fun enhance(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>): List<ResourceDefinition>
+ fun enhance(
+ bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>
+ ): List<ResourceDefinition>
}
@Service
class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoService: ResourceDefinitionRepoService) :
- ResourceDefinitionEnhancerService {
+ ResourceDefinitionEnhancerService {
private val log = logger(ResourceDefinitionEnhancerService::class)
@@ -54,8 +56,10 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
// 2. Get all the Unique Resource assignments from all mapping files
// 3. Collect the Resource Definition for Resource Assignment names from database.
// 4. Create the Resource Definition under blueprint base path.
- override fun enhance(bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
- bluePrintRuntimeService: BluePrintRuntimeService<*>): List<ResourceDefinition> {
+ override fun enhance(
+ bluePrintTypeEnhancerService: BluePrintTypeEnhancerService,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>
+ ): List<ResourceDefinition> {
var resourceDefinitions: List<ResourceDefinition> = mutableListOf()
@@ -82,7 +86,6 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
}?.mapNotNull { artifactDefinitionMap ->
artifactDefinitionMap.value.file
}
-
}?.flatten()?.distinct()
}
@@ -104,33 +107,34 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
val distinctResourceAssignments = resourceAssignments.distinctBy { it.name }
generateResourceDictionary(blueprintBasePath, distinctResourceAssignments)
- //log.info("distinct Resource assignment ($distinctResourceAssignments)")
+ // log.info("distinct Resource assignment ($distinctResourceAssignments)")
}
-
// Read the Resource Definitions from the Database and write to type file.
- private fun generateResourceDictionary(blueprintBasePath: String, resourceAssignments: List<ResourceAssignment>)
- : List<ResourceDefinition> {
+ private fun generateResourceDictionary(blueprintBasePath: String, resourceAssignments: List<ResourceAssignment>):
+ List<ResourceDefinition> {
val resourceKeys = resourceAssignments.mapNotNull { it.dictionaryName }.distinct().sorted()
log.info("distinct resource keys ($resourceKeys)")
- //TODO("Optimise DB single Query to multiple Query")
+ // TODO("Optimise DB single Query to multiple Query")
return resourceKeys.map { resourceKey ->
getResourceDefinition(resourceKey)
}
}
- private fun enrichResourceDefinitionSources(bluePrintContext: BluePrintContext,
- resourceDefinitions: List<ResourceDefinition>) {
+ private fun enrichResourceDefinitionSources(
+ bluePrintContext: BluePrintContext,
+ resourceDefinitions: List<ResourceDefinition>
+ ) {
val sources = resourceDefinitions
- .map { it.sources }
- .map {
- it.values
- .map { nodeTemplate ->
- nodeTemplate.type
- }
- }
- .flatten().distinct()
+ .map { it.sources }
+ .map {
+ it.values
+ .map { nodeTemplate ->
+ nodeTemplate.type
+ }
+ }
+ .flatten().distinct()
log.info("Enriching Resource Definition sources Node Template: $sources")
sources.forEach {
BluePrintEnhancerUtils.populateNodeType(bluePrintContext, resourceDefinitionRepoService, it)
@@ -141,4 +145,4 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
private fun getResourceDefinition(name: String): ResourceDefinition {
return resourceDefinitionRepoService.getResourceDefinition(name)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
index 5f7eacee8..392fa0bb4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/BluePrintModelHandler.kt
@@ -27,11 +27,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.repository.BlueprintMod
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BootstrapRequest
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.BluePrintDatabaseLoadService
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.BluePrintEnhancerUtils
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintEnhancerService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintCompileCache
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintFileUtils
import org.springframework.core.io.ByteArrayResource
@@ -46,8 +50,7 @@ import org.springframework.http.codec.multipart.FilePart
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import java.io.IOException
-import java.util.*
-
+import java.util.UUID
/**
* BlueprintModelHandler Purpose: Handler service to handle the request from BlurPrintModelRest
@@ -57,21 +60,24 @@ import java.util.*
*/
@Service
-open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BluePrintDatabaseLoadService,
- private val blueprintsProcessorCatalogService: BluePrintCatalogService,
- private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintModelSearchRepository: BlueprintModelSearchRepository,
- private val blueprintModelRepository: BlueprintModelRepository,
- private val blueprintModelContentRepository: BlueprintModelContentRepository,
- private val bluePrintEnhancerService: BluePrintEnhancerService) {
+open class BluePrintModelHandler(
+ private val bluePrintDatabaseLoadService: BluePrintDatabaseLoadService,
+ private val blueprintsProcessorCatalogService: BluePrintCatalogService,
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val blueprintModelSearchRepository: BlueprintModelSearchRepository,
+ private val blueprintModelRepository: BlueprintModelRepository,
+ private val blueprintModelContentRepository: BlueprintModelContentRepository,
+ private val bluePrintEnhancerService: BluePrintEnhancerService
+) {
private val log = logger(BluePrintModelHandler::class)
-
open suspend fun bootstrapBlueprint(bootstrapRequest: BootstrapRequest) {
- log.info("Bootstrap request with type load(${bootstrapRequest.loadModelType}), " +
- "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
- "cba load(${bootstrapRequest.loadCBA})")
+ log.info(
+ "Bootstrap request with type load(${bootstrapRequest.loadModelType}), " +
+ "resource dictionary load(${bootstrapRequest.loadResourceDictionary}) and " +
+ "cba load(${bootstrapRequest.loadCBA})"
+ )
if (bootstrapRequest.loadModelType) {
bluePrintDatabaseLoadService.initModelTypes()
}
@@ -113,12 +119,13 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
try {
return upload(filePart, false)
} catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Save CBA: ${e.message}", e)
+ throw BluePrintException(
+ ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Save CBA: ${e.message}", e
+ )
}
}
-
/**
* This is a searchBlueprintModels method
*
@@ -140,9 +147,10 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
@Throws(BluePrintException::class)
open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch {
return blueprintModelSearchRepository.findByArtifactNameAndArtifactVersion(name, version)
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version))
-
+ ?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
+ )
}
/**
@@ -154,15 +162,19 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
* @throws BluePrintException BluePrintException
</Resource> */
@Throws(BluePrintException::class)
- open fun downloadBlueprintModelFileByNameAndVersion(name: String,
- version: String): ResponseEntity<Resource> {
+ open fun downloadBlueprintModelFileByNameAndVersion(
+ name: String,
+ version: String
+ ): ResponseEntity<Resource> {
try {
val archiveByteArray = download(name, version)
val fileName = "${name}_$version.zip"
return prepareResourceEntity(fileName, archiveByteArray)
} catch (e: BluePrintException) {
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format("Error while " + "downloading the CBA file: %s", e.message), e
+ )
}
}
@@ -183,8 +195,10 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
val fileName = "${blueprintModel.artifactName}_${blueprintModel.artifactVersion}.zip"
val file = blueprintModel.blueprintModelContent?.content
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format("Error while downloading the CBA file: couldn't get model content"))
+ ?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format("Error while downloading the CBA file: couldn't get model content")
+ )
return prepareResourceEntity(fileName, file)
}
@@ -193,9 +207,9 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
</Resource> */
private fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
return ResponseEntity.ok()
- .contentType(MediaType.parseMediaType("text/plain"))
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
- .body(ByteArrayResource(file))
+ .contentType(MediaType.parseMediaType("text/plain"))
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
+ .body(ByteArrayResource(file))
}
/**
@@ -229,7 +243,7 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
@Throws(BluePrintException::class)
open fun getBlueprintModelByNameAndVersion(name: String, version: String): BlueprintModel {
val blueprintModel = blueprintModelRepository
- .findByArtifactNameAndArtifactVersion(name, version)
+ .findByArtifactNameAndArtifactVersion(name, version)
if (blueprintModel != null) {
return blueprintModel
} else {
@@ -248,8 +262,10 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
@Throws(BluePrintException::class)
open fun getBlueprintModelSearch(id: String): BlueprintModelSearch {
return blueprintModelSearchRepository.findById(id)
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id))
+ ?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ )
}
/**
@@ -262,10 +278,10 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
</BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWord(keyWord: String): List<BlueprintModelSearch> {
return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
- keyWord, keyWord, keyWord, keyWord, keyWord)
+ keyWord, keyWord, keyWord, keyWord, keyWord
+ )
}
-
/**
* This is a searchBluePrintModelsByKeyWordPagebale method to retrieve specific BlueprintModel in Database
* where keyword equals updatedBy or tags or artifcat name or artifcat version or artifact type and pageable
@@ -275,7 +291,14 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
* @return List<BlueprintModelSearch> list of the controller blueprint
</BlueprintModelSearch> */
open fun searchBluePrintModelsByKeyWordPaged(keyWord: String, pageRequest: PageRequest): Page<BlueprintModelSearch> {
- return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(keyWord, keyWord, keyWord, keyWord, keyWord, pageRequest)
+ return blueprintModelSearchRepository.findByUpdatedByOrTagsOrOrArtifactNameOrOrArtifactVersionOrArtifactType(
+ keyWord,
+ keyWord,
+ keyWord,
+ keyWord,
+ keyWord,
+ pageRequest
+ )
}
/**
@@ -319,8 +342,10 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
val enhancedByteArray = enrichBlueprintFileSource(filePart)
return BluePrintEnhancerUtils.prepareResourceEntity("enhanced-cba.zip", enhancedByteArray)
} catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Enriching CBA: ${e.message}", e)
+ throw BluePrintException(
+ ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Enriching CBA: ${e.message}", e
+ )
}
}
@@ -336,8 +361,10 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
try {
return upload(filePart, true)
} catch (e: Exception) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Publishing CBA: ${e.message}", e)
+ throw BluePrintException(
+ ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Publishing CBA: ${e.message}", e
+ )
}
}
@@ -357,16 +384,19 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
val blueprintId = blueprintsProcessorCatalogService.saveToDatabase(saveId, compressedFile, validate)
return blueprintModelSearchRepository.findById(blueprintId)
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId))
-
+ ?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, blueprintId)
+ )
} catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Upload CBA: ${e.message}", e)
+ throw BluePrintException(
+ ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Upload CBA: ${e.message}", e
+ )
} finally {
// Clean blueprint script cache
val cacheKey = BluePrintFileUtils
- .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, saveId))
+ .compileCacheKey(normalizedPathName(bluePrintLoadConfiguration.blueprintWorkingPath, saveId))
BluePrintCompileCache.cleanClassLoader(cacheKey)
deleteNBDir(blueprintArchive)
deleteNBDir(blueprintWorking)
@@ -379,11 +409,15 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
try {
val blueprintModel = getBlueprintModelByNameAndVersion(name, version)
return blueprintModel.blueprintModelContent?.content
- ?: throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format("Error while downloading the CBA file: couldn't get model content"))
+ ?: throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format("Error while downloading the CBA file: couldn't get model content")
+ )
} catch (e: BluePrintException) {
- throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
- String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ throw BluePrintException(
+ ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format("Error while " + "downloading the CBA file: %s", e.message), e
+ )
}
}
@@ -396,17 +430,18 @@ open class BluePrintModelHandler(private val bluePrintDatabaseLoadService: BlueP
try {
when (fileSource) {
is FilePart -> BluePrintEnhancerUtils
- .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ .copyFilePartToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
is ByteArray -> BluePrintEnhancerUtils
- .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
- } // Enhance the Blue Prints
+ .copyByteArrayToEnhanceDir(fileSource, blueprintArchive, blueprintWorkingDir)
+ } // Enhance the Blue Prints
bluePrintEnhancerService.enhance(blueprintWorkingDir)
return BluePrintEnhancerUtils.compressEnhanceDirAndReturnByteArray(blueprintWorkingDir, blueprintArchive)
-
} catch (e: IOException) {
- throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
- "Error in Enriching CBA: ${e.message}", e)
+ throw BluePrintException(
+ ErrorCode.IO_FILE_INTERRUPT.value,
+ "Error in Enriching CBA: ${e.message}", e
+ )
} finally {
BluePrintEnhancerUtils.cleanEnhancer(blueprintArchive, blueprintWorkingDir)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
index 5c7ba275d..a364f3678 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeHandler.kt
@@ -17,10 +17,10 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils.ModelTypeValidator
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@@ -46,7 +46,6 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
}
}
-
/**
* This is a searchModelTypes service
*
@@ -66,7 +65,7 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
* @throws BluePrintException BluePrintException
*/
@Throws(BluePrintException::class)
- suspend open fun saveModel(modelType: ModelType): ModelType {
+ open suspend fun saveModel(modelType: ModelType): ModelType {
lateinit var dbModel: ModelType
ModelTypeValidator.validateModelType(modelType)
val dbModelType: ModelType? = modelTypeRepository.findByModelName(modelType.modelName)
@@ -86,16 +85,14 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
return dbModel
}
-
/**
* This is a deleteByModelName service
*
* @param modelName modelName
*/
- suspend open fun deleteByModelName(modelName: String) {
+ open suspend fun deleteByModelName(modelName: String) {
check(modelName.isNotBlank()) { "Model Name Information is missing." }
modelTypeRepository.deleteByModelName(modelName)
-
}
/**
@@ -119,4 +116,4 @@ open class ModelTypeHandler(private val modelTypeRepository: ModelTypeRepository
check(derivedFrom.isNotBlank()) { "Model derivedFrom Information is missing." }
return modelTypeRepository.findByDerivedFrom(derivedFrom)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
index 8ba4c7b38..af40f56ed 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ResourceDictionaryHandler.kt
@@ -31,7 +31,6 @@ import org.springframework.stereotype.Service
@Service
class ResourceDictionaryHandler(private val resourceDictionaryRepository: ResourceDictionaryRepository) {
-
/**
* This is a getDataDictionaryByName service
*
@@ -85,8 +84,8 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
val resourceDefinition = resourceDictionary.definition
Preconditions.checkNotNull(resourceDefinition, "failed to get resource definition from content")
// Validate the Resource Definitions
- //TODO( Save Validator)
- //validate(resourceDefinition)
+ // TODO( Save Validator)
+ // validate(resourceDefinition)
resourceDictionary.tags = resourceDefinition.tags!!
resourceDefinition.updatedBy = resourceDictionary.updatedBy
@@ -137,11 +136,11 @@ class ResourceDictionaryHandler(private val resourceDictionaryRepository: Resour
}
private fun validateResourceDictionary(resourceDictionary: ResourceDictionary): Boolean {
- checkNotEmpty(resourceDictionary.name){ "DataDictionary Definition name is missing."}
+ checkNotEmpty(resourceDictionary.name) { "DataDictionary Definition name is missing." }
checkNotNull(resourceDictionary.definition) { "DataDictionary Definition Information is missing." }
- checkNotEmpty(resourceDictionary.description){ "DataDictionary Definition Information is missing."}
- checkNotEmpty(resourceDictionary.tags){ "DataDictionary Definition tags is missing."}
- checkNotEmpty(resourceDictionary.updatedBy){ "DataDictionary Definition updatedBy is missing."}
+ checkNotEmpty(resourceDictionary.description) { "DataDictionary Definition Information is missing." }
+ checkNotEmpty(resourceDictionary.tags) { "DataDictionary Definition tags is missing." }
+ checkNotEmpty(resourceDictionary.updatedBy) { "DataDictionary Definition updatedBy is missing." }
return true
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt
index 36df06909..8d209449c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintCatalogLoadService.kt
@@ -25,7 +25,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogS
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.io.File
-import java.util.*
+import java.util.UUID
@Service
open class BluePrintCatalogLoadService(private val controllerBlueprintsCatalogService: BluePrintCatalogService) {
@@ -66,5 +66,4 @@ open class BluePrintCatalogLoadService(private val controllerBlueprintsCatalogSe
errorBuilder.appendln("Couldn't load BlueprintModel(${file.name}: ${e.message}")
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt
index 31bd2c953..02d6ad3c1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/BluePrintDatabaseLoadService.kt
@@ -23,10 +23,12 @@ import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@Service
-open class BluePrintDatabaseLoadService(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val modelTypeLoadService: ModelTypeLoadService,
- private val resourceDictionaryLoadService: ResourceDictionaryLoadService,
- private val bluePrintCatalogLoadService: BluePrintCatalogLoadService) {
+open class BluePrintDatabaseLoadService(
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val modelTypeLoadService: ModelTypeLoadService,
+ private val resourceDictionaryLoadService: ResourceDictionaryLoadService,
+ private val bluePrintCatalogLoadService: BluePrintCatalogLoadService
+) {
private val log = LoggerFactory.getLogger(BluePrintDatabaseLoadService::class.java)
@@ -62,4 +64,4 @@ open class BluePrintDatabaseLoadService(private val bluePrintLoadConfiguration:
bluePrintCatalogLoadService.loadPathsBluePrintModelCatalog(paths)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt
index 9f43740aa..e96daf9f0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ModelTypeLoadService.kt
@@ -26,7 +26,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler
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.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.EntityType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.readNBText
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -108,7 +112,7 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler)
val dataKey = FilenameUtils.getBaseName(file.name)
val definitionContent = file.readNBText()
val definition = JacksonUtils.readValue(definitionContent, classType) as EntityType
- //checkNotNull(definition) { "failed to get data type from file : ${file.name}" }
+ // checkNotNull(definition) { "failed to get data type from file : ${file.name}" }
val modelType = ModelType()
val definitionType: String?
@@ -143,4 +147,4 @@ open class ModelTypeLoadService(private val modelTypeHandler: ModelTypeHandler)
errorBuilder.appendln("Couldn't load ${classType.name}(${file.name}: ${e.message}")
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt
index 95073e99d..0350bc731 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/load/ResourceDictionaryLoadService.kt
@@ -66,7 +66,6 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler:
if (!errorBuilder.isEmpty) {
log.error(errorBuilder.toString())
}
-
}
private suspend fun loadResourceDictionary(errorBuilder: StrBuilder, file: File) {
@@ -91,9 +90,8 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler:
resourceDictionary.updatedBy = resourceDefinition.updatedBy
if (StringUtils.isBlank(resourceDefinition.tags)) {
- resourceDictionary.tags = (resourceDefinition.name + ", " + resourceDefinition.updatedBy
- + ", " + resourceDefinition.updatedBy)
-
+ resourceDictionary.tags = (resourceDefinition.name + ", " + resourceDefinition.updatedBy +
+ ", " + resourceDefinition.updatedBy)
} else {
resourceDictionary.tags = resourceDefinition.tags!!
}
@@ -107,5 +105,4 @@ open class ResourceDictionaryLoadService(private val resourceDictionaryHandler:
errorBuilder.appendln("Couldn't load Resource dictionary (${file.name}: ${e.message}")
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepository.kt
index 1d69cd7cc..80aa6b49a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/BluePrintsReactRepository.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepository.kt
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import reactor.core.scheduler.Schedulers
+
// TODO("Convert into coroutines")
/**
* ModelTypeReactRepository.
@@ -40,37 +41,36 @@ open class ModelTypeReactRepository(private val modelTypeRepository: ModelTypeRe
fun findByModelNameIn(modelNames: List<String>): Flux<ModelType> {
return Flux.fromIterable(modelTypeRepository.findByModelNameIn(modelNames))
- .subscribeOn(Schedulers.elastic())
+ .subscribeOn(Schedulers.elastic())
}
fun findByDerivedFrom(derivedFrom: String): Flux<ModelType> {
return Flux.fromIterable(modelTypeRepository.findByDerivedFrom(derivedFrom))
- .subscribeOn(Schedulers.elastic())
+ .subscribeOn(Schedulers.elastic())
}
fun findByDerivedFromIn(derivedFroms: List<String>): Flux<ModelType> {
return Flux.fromIterable(modelTypeRepository.findByDerivedFromIn(derivedFroms))
- .subscribeOn(Schedulers.elastic())
+ .subscribeOn(Schedulers.elastic())
}
fun findByDefinitionType(definitionType: String): Flux<ModelType> {
return Flux.fromIterable(modelTypeRepository.findByDefinitionType(definitionType))
- .subscribeOn(Schedulers.elastic())
+ .subscribeOn(Schedulers.elastic())
}
fun findByDefinitionTypeIn(definitionTypes: List<String>): Flux<ModelType> {
return Flux.fromIterable(modelTypeRepository.findByDefinitionTypeIn(definitionTypes))
- .subscribeOn(Schedulers.elastic())
+ .subscribeOn(Schedulers.elastic())
}
fun findByTagsContainingIgnoreCase(tags: String): Flux<ModelType> {
return Flux.fromIterable(modelTypeRepository.findByTagsContainingIgnoreCase(tags))
- .subscribeOn(Schedulers.elastic())
+ .subscribeOn(Schedulers.elastic())
}
fun deleteByModelName(modelName: String): Mono<Void> {
modelTypeRepository.deleteByModelName(modelName)
return Mono.empty()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt
index 3e36947a4..8beea7161 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeRepository.kt
@@ -23,6 +23,7 @@ import javax.transaction.Transactional
@Repository
interface ModelTypeRepository : JpaRepository<ModelType, String> {
+
/**
* This is a findByModelName method
*
@@ -30,6 +31,7 @@ interface ModelTypeRepository : JpaRepository<ModelType, String> {
* @return Optional<ModelType>
*/
fun findByModelName(modelName: String): ModelType?
+
/**
* This is a findByModelNameIn method
*
@@ -37,19 +39,21 @@ interface ModelTypeRepository : JpaRepository<ModelType, String> {
* @return List<ModelType>
*/
fun findByModelNameIn(modelNames: List<String>): List<ModelType>
+
/**
* This is a findByDerivedFrom method
*
* @param derivedFrom Derived From
* @return List<ModelType>
- */
+ */
fun findByDerivedFrom(derivedFrom: String): List<ModelType>
+
/**
* This is a findByDerivedFromIn method
*
* @param derivedFroms Derived Froms
* @return List<ModelType>
- */
+ */
fun findByDerivedFromIn(derivedFroms: List<String>): List<ModelType>
/**
@@ -59,12 +63,13 @@ interface ModelTypeRepository : JpaRepository<ModelType, String> {
* @return List<ModelType>
*/
fun findByDefinitionType(definitionType: String): List<ModelType>
+
/**
* This is a findByDefinitionTypeIn method
*
* @param definitionTypes Definition Types
* @return List<ModelType>
- */
+ */
fun findByDefinitionTypeIn(definitionTypes: List<String>): List<ModelType>
/**
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
index 68db371c6..da7893861 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepository.kt
@@ -20,7 +20,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictio
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
-
/**
* ResourceMappingRepository.java Purpose: Provide Configuration Generator ResourceMappingRepository
*
@@ -30,7 +29,6 @@ import org.springframework.stereotype.Repository
@Repository
interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, String> {
-
/**
* This is a findByName method
*
@@ -61,6 +59,4 @@ interface ResourceDictionaryRepository : JpaRepository<ResourceDictionary, Strin
* @param name name
*/
fun deleteByName(name: String)
-
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt
index f8e6163a5..420a9fcd7 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/service/BluePrintRepoServiceImpl.kt
@@ -23,7 +23,11 @@ import org.apache.commons.lang3.StringUtils
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ModelTypeRepository
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.repository.ResourceDictionaryRepository
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
@@ -36,37 +40,39 @@ interface ResourceDefinitionRepoService : BluePrintRepoService {
}
@Service
-open class BluePrintRepoFileService(private val modelTypeRepository: ModelTypeRepository,
- private val resourceDictionaryRepository: ResourceDictionaryRepository) : ResourceDefinitionRepoService {
+open class BluePrintRepoFileService(
+ private val modelTypeRepository: ModelTypeRepository,
+ private val resourceDictionaryRepository: ResourceDictionaryRepository
+) : ResourceDefinitionRepoService {
@Throws(BluePrintException::class)
override fun getNodeType(nodeTypeName: String): NodeType {
return getModelType(nodeTypeName, NodeType::class.java)
- ?: throw BluePrintException("couldn't get NodeType($nodeTypeName)")
+ ?: throw BluePrintException("couldn't get NodeType($nodeTypeName)")
}
@Throws(BluePrintException::class)
override fun getDataType(dataTypeName: String): DataType {
return getModelType(dataTypeName, DataType::class.java)
- ?: throw BluePrintException("couldn't get DataType($dataTypeName)")
+ ?: throw BluePrintException("couldn't get DataType($dataTypeName)")
}
@Throws(BluePrintException::class)
override fun getArtifactType(artifactTypeName: String): ArtifactType {
return getModelType(artifactTypeName, ArtifactType::class.java)
- ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName)")
+ ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName)")
}
@Throws(BluePrintException::class)
override fun getRelationshipType(relationshipTypeName: String): RelationshipType {
return getModelType(relationshipTypeName, RelationshipType::class.java)
- ?: throw BluePrintException("couldn't get RelationshipType($relationshipTypeName)")
+ ?: throw BluePrintException("couldn't get RelationshipType($relationshipTypeName)")
}
@Throws(BluePrintException::class)
override fun getCapabilityDefinition(capabilityDefinitionName: String): CapabilityDefinition {
return getModelType(capabilityDefinitionName, CapabilityDefinition::class.java)
- ?: throw BluePrintException("couldn't get CapabilityDefinition($capabilityDefinitionName)")
+ ?: throw BluePrintException("couldn't get CapabilityDefinition($capabilityDefinitionName)")
}
@Throws(BluePrintException::class)
@@ -81,12 +87,16 @@ open class BluePrintRepoFileService(private val modelTypeRepository: ModelTypeRe
@Throws(BluePrintException::class)
private fun <T> getModelType(modelName: String, valueClass: Class<T>): T? {
- Preconditions.checkArgument(StringUtils.isNotBlank(modelName),
- "Failed to get model from repo, model name is missing")
+ Preconditions.checkArgument(
+ StringUtils.isNotBlank(modelName),
+ "Failed to get model from repo, model name is missing"
+ )
val modelDefinition = getModelDefinition(modelName)
- Preconditions.checkNotNull(modelDefinition,
- String.format("Failed to get model content for model name (%s)", modelName))
+ Preconditions.checkNotNull(
+ modelDefinition,
+ String.format("Failed to get model content for model name (%s)", modelName)
+ )
return JacksonUtils.readValue(modelDefinition, valueClass)
}
@@ -102,4 +112,4 @@ open class BluePrintRepoFileService(private val modelTypeRepository: ModelTypeRe
}
return modelDefinition
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
index c79d1b526..4d5ca36cf 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtils.kt
@@ -19,12 +19,18 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
import kotlinx.coroutines.reactive.awaitSingle
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
+import org.onap.ccsdk.cds.controllerblueprints.core.deCompress
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteNBDir
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintRepoService
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.reCreateNBDirs
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BluePrintArchiveUtils
import org.springframework.core.io.ByteArrayResource
@@ -36,47 +42,57 @@ import org.springframework.http.codec.multipart.FilePart
import java.io.File
import java.nio.file.Paths
-
class BluePrintEnhancerUtils {
companion object {
val log = logger(BluePrintEnhancerUtils)
- fun populateDataTypes(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- dataTypeName: String): DataType {
+ fun populateDataTypes(
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
+ dataTypeName: String
+ ): DataType {
val dataType = bluePrintContext.serviceTemplate.dataTypes?.get(dataTypeName)
- ?: bluePrintRepoService.getDataType(dataTypeName)
- ?: throw BluePrintException("couldn't get DataType($dataTypeName) from repo.")
+ ?: bluePrintRepoService.getDataType(dataTypeName)
+ ?: throw BluePrintException("couldn't get DataType($dataTypeName) from repo.")
bluePrintContext.serviceTemplate.dataTypes?.put(dataTypeName, dataType)
return dataType
}
- fun populateRelationshipType(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- relationshipName: String): RelationshipType {
+ fun populateRelationshipType(
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
+ relationshipName: String
+ ): RelationshipType {
val relationshipType = bluePrintContext.serviceTemplate.relationshipTypes?.get(relationshipName)
- ?: bluePrintRepoService.getRelationshipType(relationshipName)
- ?: throw BluePrintException("couldn't get RelationshipType($relationshipName) from repo.")
+ ?: bluePrintRepoService.getRelationshipType(relationshipName)
+ ?: throw BluePrintException("couldn't get RelationshipType($relationshipName) from repo.")
bluePrintContext.serviceTemplate.relationshipTypes?.put(relationshipName, relationshipType)
return relationshipType
}
-
- fun populateNodeType(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- nodeTypeName: String): NodeType {
+ fun populateNodeType(
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
+ nodeTypeName: String
+ ): NodeType {
val nodeType = bluePrintContext.serviceTemplate.nodeTypes?.get(nodeTypeName)
- ?: bluePrintRepoService.getNodeType(nodeTypeName)
- ?: throw BluePrintException("couldn't get NodeType($nodeTypeName) from repo.")
+ ?: bluePrintRepoService.getNodeType(nodeTypeName)
+ ?: throw BluePrintException("couldn't get NodeType($nodeTypeName) from repo.")
bluePrintContext.serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
return nodeType
}
- fun populateArtifactType(bluePrintContext: BluePrintContext, bluePrintRepoService: BluePrintRepoService,
- artifactTypeName: String): ArtifactType {
+ fun populateArtifactType(
+ bluePrintContext: BluePrintContext,
+ bluePrintRepoService: BluePrintRepoService,
+ artifactTypeName: String
+ ): ArtifactType {
val artifactType = bluePrintContext.serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: bluePrintRepoService.getArtifactType(artifactTypeName)
- ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName) from repo.")
+ ?: bluePrintRepoService.getArtifactType(artifactTypeName)
+ ?: throw BluePrintException("couldn't get ArtifactType($artifactTypeName) from repo.")
bluePrintContext.serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
return artifactType
}
@@ -90,17 +106,16 @@ class BluePrintEnhancerUtils {
return targetFile
}
-
suspend fun filePartAsFile(filePart: FilePart, targetFile: File): File {
// Delete the Directory
targetFile.parentFile.reCreateNBDirs()
return filePart.transferTo(targetFile)
- .thenReturn(targetFile)
- .awaitSingle()
+ .thenReturn(targetFile)
+ .awaitSingle()
}
private suspend fun byteArrayAsArchiveFile(byteArray: ByteArray, archiveDir: String, enhanceDir: String): File {
- //Recreate the Base Directories
+ // Recreate the Base Directories
normalizedFile(archiveDir).reCreateNBDirs()
normalizedFile(enhanceDir).reCreateNBDirs()
val archiveFile = normalizedFile(archiveDir, "cba.zip")
@@ -109,7 +124,7 @@ class BluePrintEnhancerUtils {
}
private suspend fun filePartAsArchiveFile(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
- //Recreate the Base Directories
+ // Recreate the Base Directories
normalizedFile(archiveDir).reCreateNBDirs()
normalizedFile(enhanceDir).reCreateNBDirs()
val archiveFile = normalizedFile(archiveDir, "cba.zip")
@@ -132,17 +147,23 @@ class BluePrintEnhancerUtils {
}
/** compress [enhanceDir] to [archiveDir] and return ByteArray */
- suspend fun compressEnhanceDirAndReturnByteArray(enhanceDir: String, archiveDir: String,
- outputFileName: String = "enhanced-cba.zip"): ByteArray {
+ suspend fun compressEnhanceDirAndReturnByteArray(
+ enhanceDir: String,
+ archiveDir: String,
+ outputFileName: String = "enhanced-cba.zip"
+ ): ByteArray {
val compressedFile = normalizedFile(archiveDir, outputFileName)
BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
return compressedFile.readBytes()
}
/** compress [enhanceDir] to [archiveDir] and return ResponseEntity */
- suspend fun compressEnhanceDirAndReturnFilePart(enhanceDir: String, archiveDir: String,
- outputFileName: String = "enhanced-cba.zip")
- : ResponseEntity<Resource> {
+ suspend fun compressEnhanceDirAndReturnFilePart(
+ enhanceDir: String,
+ archiveDir: String,
+ outputFileName: String = "enhanced-cba.zip"
+ ):
+ ResponseEntity<Resource> {
val compressedFile = normalizedFile(archiveDir, outputFileName)
BluePrintArchiveUtils.compress(Paths.get(enhanceDir).toFile(), compressedFile)
return prepareResourceEntity(compressedFile)
@@ -152,12 +173,13 @@ class BluePrintEnhancerUtils {
suspend fun prepareResourceEntity(file: File): ResponseEntity<Resource> {
return prepareResourceEntity(file.name, file.readBytes())
}
+
/** convert [byteArray] to ResourceEntity with [fileName]*/
fun prepareResourceEntity(fileName: String, byteArray: ByteArray): ResponseEntity<Resource> {
return ResponseEntity.ok()
- .contentType(MediaType.parseMediaType("text/plain"))
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
- .body(ByteArrayResource(byteArray))
+ .contentType(MediaType.parseMediaType("text/plain"))
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
+ .body(ByteArrayResource(byteArray))
}
suspend fun cleanEnhancer(archiveLocation: String, enhancementLocation: String) {
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/SortByOptionsEnum.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BlueprintSortByOption.kt
index 6f5636516..92573892a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/SortByOptionsEnum.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BlueprintSortByOption.kt
@@ -3,4 +3,4 @@ package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.utils
enum class BlueprintSortByOption(val columnName: String) {
DATE("createdDate"),
NAME("artifactName")
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
index 8ec0b9bab..6b9ea28f0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/ModelTypeValidator.kt
@@ -21,7 +21,11 @@ import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
+import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.CapabilityDefinition
+import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.RelationshipType
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
class ModelTypeValidator {
@@ -38,23 +42,23 @@ class ModelTypeValidator {
when (definitionType) {
BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE -> {
JacksonUtils.readValue(definitionContent, DataType::class.java)
- ?: throw BluePrintException("Model type definition is not DataType valid content $definitionContent")
+ ?: throw BluePrintException("Model type definition is not DataType valid content $definitionContent")
}
BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE -> {
JacksonUtils.readValue(definitionContent, NodeType::class.java)
- ?: throw BluePrintException("Model type definition is not NodeType valid content $definitionContent")
+ ?: throw BluePrintException("Model type definition is not NodeType valid content $definitionContent")
}
BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE -> {
JacksonUtils.readValue(definitionContent, ArtifactType::class.java)
- ?: throw BluePrintException("Model type definition is not ArtifactType valid content $definitionContent")
+ ?: throw BluePrintException("Model type definition is not ArtifactType valid content $definitionContent")
}
BluePrintConstants.MODEL_DEFINITION_TYPE_CAPABILITY_TYPE -> {
JacksonUtils.readValue(definitionContent, CapabilityDefinition::class.java)
- ?: throw BluePrintException("Model type definition is not CapabilityDefinition valid content $definitionContent")
+ ?: throw BluePrintException("Model type definition is not CapabilityDefinition valid content $definitionContent")
}
BluePrintConstants.MODEL_DEFINITION_TYPE_RELATIONSHIP_TYPE -> {
JacksonUtils.readValue(definitionContent, RelationshipType::class.java)
- ?: throw BluePrintException("Model type definition is not RelationshipType valid content $definitionContent")
+ ?: throw BluePrintException("Model type definition is not RelationshipType valid content $definitionContent")
}
}
return true
@@ -79,5 +83,4 @@ class ModelTypeValidator {
return true
}
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
index 61f515017..582fd9a41 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BluePrintManagementGRPCHandlerTest.kt
@@ -32,20 +32,29 @@ import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
-import org.onap.ccsdk.cds.controllerblueprints.management.api.*
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput
+import org.onap.ccsdk.cds.controllerblueprints.management.api.DownloadAction
+import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk
+import org.onap.ccsdk.cds.controllerblueprints.management.api.RemoveAction
+import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.test.annotation.DirtiesContext
+import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import kotlin.test.*
+import kotlin.test.AfterTest
+import kotlin.test.BeforeTest
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
-@EnableAutoConfiguration
-@DirtiesContext
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintManagementGRPCHandlerTest {
@@ -74,8 +83,10 @@ class BluePrintManagementGRPCHandlerTest {
val req = createBootstrapInputRequest(id)
val bootstrapOutput = blockingStub.bootstrapBlueprint(req)
assertEquals(200, bootstrapOutput.status.code)
- assertTrue(bootstrapOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
- "failed to get success status")
+ assertTrue(
+ bootstrapOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status"
+ )
assertEquals(id, bootstrapOutput.commonHeader.requestId)
}
@@ -87,8 +98,10 @@ class BluePrintManagementGRPCHandlerTest {
val output = blockingStub.uploadBlueprint(req)
assertEquals(200, output.status.code)
- assertTrue(output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
- "failed to get success status")
+ assertTrue(
+ output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status"
+ )
assertEquals(id, output.commonHeader.requestId)
val downloadId = "123_download"
@@ -96,8 +109,10 @@ class BluePrintManagementGRPCHandlerTest {
val downloadOutput = blockingStub.downloadBlueprint(downloadReq)
assertEquals(200, downloadOutput.status.code)
- assertTrue(downloadOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
- "failed to get success status")
+ assertTrue(
+ downloadOutput.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status"
+ )
assertNotNull(downloadOutput.fileChunk?.chunk, "failed to get cba file chunks")
assertEquals(downloadId, downloadOutput.commonHeader.requestId)
}
@@ -110,8 +125,10 @@ class BluePrintManagementGRPCHandlerTest {
var output = blockingStub.uploadBlueprint(req)
assertEquals(200, output.status.code)
- assertTrue(output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
- "failed to get success status")
+ assertTrue(
+ output.status.message.contentEquals(BluePrintConstants.STATUS_SUCCESS),
+ "failed to get success status"
+ )
assertEquals(id, output.commonHeader.requestId)
val removeReq = createRemoveInputRequest(id)
@@ -142,18 +159,18 @@ class BluePrintManagementGRPCHandlerTest {
private fun createBootstrapInputRequest(id: String): BluePrintBootstrapInput {
val commonHeader = CommonHeader
- .newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(id)
- .setSubRequestId("1234-56").build()
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
return BluePrintBootstrapInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setLoadModelType(false)
- .setLoadResourceDictionary(false)
- .setLoadCBA(false)
- .build()
+ .setCommonHeader(commonHeader)
+ .setLoadModelType(false)
+ .setLoadResourceDictionary(false)
+ .setLoadCBA(false)
+ .build()
}
private fun createUploadInputRequest(id: String, action: String): BluePrintUploadInput {
@@ -161,59 +178,63 @@ class BluePrintManagementGRPCHandlerTest {
assertTrue(file.exists(), "couldnt get file ${file.absolutePath}")
val commonHeader = CommonHeader
- .newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(id)
- .setSubRequestId("1234-56").build()
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
val actionIdentifier = ActionIdentifiers.newBuilder()
- .setActionName(action)
- .setBlueprintName("sample")
- .setBlueprintVersion("1.0.0")
- .build()
+ .setActionName(action)
+ .setBlueprintName("sample")
+ .setBlueprintVersion("1.0.0")
+ .build()
val fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(file.inputStream().readBytes()))
- .build()
+ .build()
return BluePrintUploadInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(actionIdentifier)
- .setFileChunk(fileChunk)
- .build()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setFileChunk(fileChunk)
+ .build()
}
private fun createDownloadInputRequest(id: String, action: String): BluePrintDownloadInput {
val commonHeader = CommonHeader
- .newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(id)
- .setSubRequestId("1234-56").build()
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
return BluePrintDownloadInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(ActionIdentifiers.newBuilder()
- .setBlueprintName("baseconfiguration")
- .setBlueprintVersion("1.0.0")
- .setActionName(action).build())
- .build()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(
+ ActionIdentifiers.newBuilder()
+ .setBlueprintName("baseconfiguration")
+ .setBlueprintVersion("1.0.0")
+ .setActionName(action).build()
+ )
+ .build()
}
private fun createRemoveInputRequest(id: String): BluePrintRemoveInput {
val commonHeader = CommonHeader
- .newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(id)
- .setSubRequestId("1234-56").build()
+ .newBuilder()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(id)
+ .setSubRequestId("1234-56").build()
return BluePrintRemoveInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(ActionIdentifiers.newBuilder()
- .setBlueprintName("sample")
- .setBlueprintVersion("1.0.0")
- .setActionName(RemoveAction.DEFAULT.toString()).build())
- .build()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(
+ ActionIdentifiers.newBuilder()
+ .setBlueprintName("sample")
+ .setBlueprintVersion("1.0.0")
+ .setActionName(RemoveAction.DEFAULT.toString()).build()
+ )
+ .build()
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
index 149acb03c..0e33884a0 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/BlueprintModelControllerTest.kt
@@ -26,12 +26,14 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.domain.BlueprintModelSearch
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.compress
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.reCreateDirs
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.core.io.ByteArrayResource
@@ -60,8 +62,9 @@ import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class BlueprintModelControllerTest {
@@ -82,7 +85,6 @@ class BlueprintModelControllerTest {
private var testZipFile: File? = null
-
@Before
fun setUp() {
assertNotNull(webTestClient, " Failed to create WebTestClient")
@@ -121,14 +123,14 @@ class BlueprintModelControllerTest {
}.build()
val saveBP = webTestClient
- .post()
- .uri("/api/v1/blueprint-model")
- .body(BodyInserters.fromMultipartData(body))
- .exchange()
- .expectStatus().isOk
- .returnResult<BlueprintModelSearch>()
- .responseBody
- .awaitSingle()
+ .post()
+ .uri("/api/v1/blueprint-model")
+ .body(BodyInserters.fromMultipartData(body))
+ .exchange()
+ .expectStatus().isOk
+ .returnResult<BlueprintModelSearch>()
+ .responseBody
+ .awaitSingle()
assertNotNull(saveBP, "failed to get response")
assertEquals("baseconfiguration", saveBP.artifactName, "mismatch artifact name")
@@ -141,18 +143,21 @@ class BlueprintModelControllerTest {
@Test
@Throws(JSONException::class)
fun test02_getBluePrintByNameAndVersion() {
- webTestClient(HttpMethod.GET, null,
- "/api/v1/blueprint-model/by-name/${bp!!.artifactName}/version/${bp!!.artifactVersion}",
- HttpStatus.OK, false)
+ webTestClient(
+ HttpMethod.GET, null,
+ "/api/v1/blueprint-model/by-name/${bp!!.artifactName}/version/${bp!!.artifactVersion}",
+ HttpStatus.OK, false
+ )
}
-
@Test
@Throws(JSONException::class)
fun test03_getBlueprintModel() {
- webTestClient(HttpMethod.GET, null,
- "/api/v1/blueprint-model/${bp!!.id}",
- HttpStatus.OK, false)
+ webTestClient(
+ HttpMethod.GET, null,
+ "/api/v1/blueprint-model/${bp!!.id}",
+ HttpStatus.OK, false
+ )
}
@Test
@@ -164,9 +169,11 @@ class BlueprintModelControllerTest {
@Test
@Throws(JSONException::class)
fun test05_downloadBluePrint() {
- webTestClient(HttpMethod.GET, null,
- "/api/v1/blueprint-model/download/${bp!!.id}",
- HttpStatus.OK, false)
+ webTestClient(
+ HttpMethod.GET, null,
+ "/api/v1/blueprint-model/download/${bp!!.id}",
+ HttpStatus.OK, false
+ )
}
@Test
@@ -185,14 +192,14 @@ class BlueprintModelControllerTest {
}.build()
val publishBP = webTestClient
- .post()
- .uri("/api/v1/blueprint-model/publish")
- .body(BodyInserters.fromMultipartData(body))
- .exchange()
- .expectStatus().isOk
- .returnResult<BlueprintModelSearch>()
- .responseBody
- .awaitSingle()
+ .post()
+ .uri("/api/v1/blueprint-model/publish")
+ .body(BodyInserters.fromMultipartData(body))
+ .exchange()
+ .expectStatus().isOk
+ .returnResult<BlueprintModelSearch>()
+ .responseBody
+ .awaitSingle()
assertNotNull(publishBP, "failed to get response")
assertEquals("baseconfiguration", publishBP.artifactName, "mismatch artifact name")
@@ -205,49 +212,60 @@ class BlueprintModelControllerTest {
@Test
@Throws(JSONException::class)
fun test08_searchBlueprintModels() {
- webTestClient(HttpMethod.GET, null,
- "/api/v1/blueprint-model/search/${bp!!.artifactName}",
- HttpStatus.OK, false)
+ webTestClient(
+ HttpMethod.GET, null,
+ "/api/v1/blueprint-model/search/${bp!!.artifactName}",
+ HttpStatus.OK, false
+ )
}
@Test
@Throws(JSONException::class)
fun test09_downloadBlueprintByNameAndVersion() {
- webTestClient(HttpMethod.GET, null,
- "/api/v1/blueprint-model/download/by-name/${bp!!.artifactName}/version/${bp!!.artifactVersion}",
- HttpStatus.OK, false)
+ webTestClient(
+ HttpMethod.GET, null,
+ "/api/v1/blueprint-model/download/by-name/${bp!!.artifactName}/version/${bp!!.artifactVersion}",
+ HttpStatus.OK, false
+ )
}
@Test
fun test10_deleteBluePrint() {
-// webTestClient.delete().uri("/api/v1/blueprint-model/${bp!!.id}")
-// .header("Authorization", "Basic " + Base64Utils
-// .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
-// .exchange()
-// .expectStatus().is2xxSuccessful
+ // webTestClient.delete().uri("/api/v1/blueprint-model/${bp!!.id}")
+ // .header("Authorization", "Basic " + Base64Utils
+ // .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ // .exchange()
+ // .expectStatus().is2xxSuccessful
webTestClient.delete().uri("/api/v1/blueprint-model/name/${bp!!.artifactName}/version/${bp!!.artifactVersion}")
- .header("Authorization", "Basic " + Base64Utils
- .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
- .exchange()
- .expectStatus().is2xxSuccessful
+ .header(
+ "Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8))
+ )
+ .exchange()
+ .expectStatus().is2xxSuccessful
}
@Throws(JSONException::class)
- private fun webTestClient(requestMethod: HttpMethod, body: BodyInserters.MultipartInserter?, uri: String,
- expectedResponceStatus: HttpStatus, setParam: Boolean) {
+ private fun webTestClient(
+ requestMethod: HttpMethod,
+ body: BodyInserters.MultipartInserter?,
+ uri: String,
+ expectedResponceStatus: HttpStatus,
+ setParam: Boolean
+ ) {
log.info("Requesting($uri): Method(${requestMethod.name})")
webTestClient.method(requestMethod).uri(uri)
- .header("Authorization", "Basic " + Base64Utils
- .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
- .body(body)
- .exchange()
- .expectStatus().isEqualTo(expectedResponceStatus)
- .expectBody()
- .returnResult().responseBody!!
-
+ .header(
+ "Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8))
+ )
+ .body(body)
+ .exchange()
+ .expectStatus().isEqualTo(expectedResponceStatus)
+ .expectBody()
+ .returnResult().responseBody!!
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
index 03e016b8e..33a2bd778 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/DesignerApiTestConfiguration.kt
@@ -21,7 +21,10 @@ import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration
@Configuration
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
- "org.onap.ccsdk.cds.blueprintsprocessor"])
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor.designer.api",
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary"]
+)
@EnableAutoConfiguration
open class DesignerApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
index 8871676d2..6b409dbef 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeControllerTest.kt
@@ -21,12 +21,9 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.annotation.Commit
@@ -35,8 +32,9 @@ import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ModelTypeControllerTest {
@@ -62,8 +60,8 @@ class ModelTypeControllerTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
modelType.updatedBy = "xxxxxx@xxx.com"
modelType = modelTypeController!!.saveModelType(modelType)
log.info("Saved Mode {}", modelType.toString())
@@ -71,15 +69,16 @@ class ModelTypeControllerTest {
Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.modelName)
val dbModelType = modelTypeController!!.getModelTypeByName(modelType.modelName)
- Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
- dbModelType)
+ Assert.assertNotNull(
+ "Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
+ dbModelType
+ )
// Model Update
modelType.updatedBy = "bs2796@xxx.com"
modelType = modelTypeController!!.saveModelType(modelType)
Assert.assertNotNull("Failed to get Saved ModelType", modelType)
Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.updatedBy)
-
}
@Test
@@ -92,7 +91,6 @@ class ModelTypeControllerTest {
val dbModelTypes = modelTypeController!!.searchModelTypes(tags)
Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes)
Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.isNotEmpty())
-
}
@Test
@@ -113,7 +111,8 @@ class ModelTypeControllerTest {
@Throws(Exception::class)
fun test04DeleteModelType() {
log.info(
- "************************ test03DeleteModelType ***********************")
+ "************************ test03DeleteModelType ***********************"
+ )
val dbResourceMapping = modelTypeController!!.getModelTypeByName(modelName)
Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping)
Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping!!.modelName)
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt
index b13b1ac08..c4390dbd2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryControllerTest.kt
@@ -20,9 +20,6 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ContextConfiguration
@@ -32,8 +29,9 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ResourceDictionaryControllerTest {
@@ -45,5 +43,4 @@ class ResourceDictionaryControllerTest {
fun testResourceDictionaryControllerPresence() {
assertNotNull(resourceDictionaryController, "failed to initialise ResourceDictionaryController")
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..be012bbc0
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/TestDatabaseConfiguration.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.designer.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.designer.api"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt
index a5a0511f5..2762725fa 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -21,9 +21,6 @@ import kotlinx.coroutines.runBlocking
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ModelTypeLoadService
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.load.ResourceDictionaryLoadService
@@ -37,8 +34,9 @@ import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintEnhancerServiceImplTest {
@@ -54,7 +52,6 @@ class BluePrintEnhancerServiceImplTest {
@Autowired
lateinit var bluePrintValidatorService: BluePrintValidatorService
-
@Test
@Throws(Exception::class)
fun testEnhancementAndValidation() {
@@ -93,7 +90,6 @@ class BluePrintEnhancerServiceImplTest {
fun testRemoteScriptsEnhancementAndValidation() {
val basePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/remote_scripts"
testComponentInvokeEnhancementAndValidation(basePath, "remote_scripts-enhance")
-
}
fun testCapabilityCliEnhancementAndValidation() {
@@ -115,12 +111,10 @@ class BluePrintEnhancerServiceImplTest {
Assert.assertTrue("blueprint($basePath) validation failed ", valid)
// Enable this to get the enhanced zip file
-// val compressFile = normalizedFile("target/blueprints/enrichment", "$targetDirName.zip")
-// normalizedFile(targetPath).compress(compressFile)
+ // val compressFile = normalizedFile("target/blueprints/enrichment", "$targetDirName.zip")
+ // normalizedFile(targetPath).compress(compressFile)
deleteDir(targetPath)
}
}
-
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
index 7ea845dee..c4a77e565 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/handler/ModelTypeServiceTest.kt
@@ -22,13 +22,10 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.annotation.Commit
@@ -36,13 +33,14 @@ import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ModelTypeServiceTest {
+
@Autowired
private val modelTypeHandler: ModelTypeHandler? = null
@@ -65,8 +63,8 @@ class ModelTypeServiceTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
modelType.updatedBy = "xxxxxx@xxx.com"
modelType = modelTypeHandler!!.saveModel(modelType)
log.info("Saved Mode {}", modelType.toString())
@@ -74,8 +72,10 @@ class ModelTypeServiceTest {
Assert.assertNotNull("Failed to get Saved ModelType, Id", modelType.modelName)
val dbModelType = modelTypeHandler.getModelTypeByName(modelType.modelName)
- Assert.assertNotNull("Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
- dbModelType)
+ Assert.assertNotNull(
+ "Failed to query ResourceMapping for ID (" + dbModelType!!.modelName + ")",
+ dbModelType
+ )
// Model Update
modelType.updatedBy = "bs2796@xxx.com"
@@ -83,7 +83,6 @@ class ModelTypeServiceTest {
Assert.assertNotNull("Failed to get Saved ModelType", modelType)
Assert.assertEquals("Failed to get Saved getUpdatedBy ", "bs2796@xxx.com", modelType.updatedBy)
}
-
}
@Test
@@ -98,7 +97,6 @@ class ModelTypeServiceTest {
Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes)
Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size > 0)
}
-
}
@Test
@@ -118,7 +116,6 @@ class ModelTypeServiceTest {
Assert.assertNotNull("Failed to find getModelTypeByDerivedFrom by tags", dbModelTypeByDerivedFroms)
Assert.assertTrue("Failed to find getModelTypeByDerivedFrom by count", dbModelTypeByDerivedFroms.size > 0)
}
-
}
@Test
@@ -126,7 +123,8 @@ class ModelTypeServiceTest {
fun test04DeleteModelType() {
runBlocking {
log.info(
- "************************ test03DeleteModelType ***********************")
+ "************************ test03DeleteModelType ***********************"
+ )
val dbResourceMapping = modelTypeHandler!!.getModelTypeByName(modelName)
Assert.assertNotNull("Failed to get response for api call getModelByName ", dbResourceMapping)
Assert.assertNotNull("Failed to get Id for api call getModelByName ", dbResourceMapping!!.modelName)
@@ -134,5 +132,4 @@ class ModelTypeServiceTest {
modelTypeHandler.deleteByModelName(dbResourceMapping.modelName)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
index 3165a6e2f..27949901c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/mock/MockFilePart.kt
@@ -30,11 +30,11 @@ import java.nio.file.Path
class MockFilePart(private val fileName: String) : FilePart {
val log = LoggerFactory.getLogger(MockFilePart::class.java)!!
override fun content(): Flux<DataBuffer> {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun headers(): HttpHeaders {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ TODO("not implemented") // To change body of created functions use File | Settings | File Templates.
}
override fun filename(): String {
@@ -46,8 +46,8 @@ class MockFilePart(private val fileName: String) : FilePart {
}
override fun transferTo(path: Path): Mono<Void> {
- log.info("Copying file($fileName to ${path}")
+ log.info("Copying file($fileName to $path")
FileCopyUtils.copy(File(fileName), path.toFile())
return Mono.empty()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
index 3dfed1ccb..4c05f6009 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ModelTypeReactRepositoryTest.kt
@@ -21,21 +21,18 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.annotation.Commit
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import java.nio.charset.Charset
-import java.util.*
+import java.util.Arrays
/**
* ModelTypeReactRepositoryTest.
@@ -44,8 +41,9 @@ import java.util.*
*/
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ModelTypeReactRepositoryTest {
@@ -59,7 +57,7 @@ class ModelTypeReactRepositoryTest {
@Commit
fun test01Save() {
val content = normalizedFile("./src/test/resources/model_type/data_type/datatype-property.json")
- .readText(Charset.defaultCharset())
+ .readText(Charset.defaultCharset())
val modelType = ModelType()
modelType.definitionType = BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE
modelType.derivedFrom = BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT
@@ -67,8 +65,8 @@ class ModelTypeReactRepositoryTest {
modelType.definition = JacksonUtils.jsonNode(content)
modelType.modelName = modelName
modelType.version = "1.0.0"
- modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
+ modelType.tags = ("test-datatype ," + BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT + "," +
+ BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
modelType.updatedBy = "xxxxxx@xxx.com"
val dbModelType = modelTypeReactRepository!!.save(modelType).block()
@@ -80,7 +78,8 @@ class ModelTypeReactRepositoryTest {
val dbFindByModelName = modelTypeReactRepository!!.findByModelName(modelName).block()
Assert.assertNotNull("Failed to findByModelName ", dbFindByModelName)
- val dbFindByDefinitionType = modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block()
+ val dbFindByDefinitionType =
+ modelTypeReactRepository.findByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE).collectList().block()
Assert.assertNotNull("Failed to findByDefinitionType ", dbFindByDefinitionType)
Assert.assertTrue("Failed to findByDefinitionType count", dbFindByDefinitionType!!.size > 0)
@@ -92,11 +91,13 @@ class ModelTypeReactRepositoryTest {
Assert.assertNotNull("Failed to findByModelNameIn ", dbFindByModelNameIn)
Assert.assertTrue("Failed to findByModelNameIn by count", dbFindByModelNameIn!!.size > 0)
- val dbFindByDefinitionTypeIn = modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block()
+ val dbFindByDefinitionTypeIn =
+ modelTypeReactRepository.findByDefinitionTypeIn(Arrays.asList(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)).collectList().block()
Assert.assertNotNull("Failed to findByDefinitionTypeIn", dbFindByDefinitionTypeIn)
Assert.assertTrue("Failed to findByDefinitionTypeIn by count", dbFindByDefinitionTypeIn!!.size > 0)
- val dbFindByDerivedFromIn = modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block()
+ val dbFindByDerivedFromIn =
+ modelTypeReactRepository.findByDerivedFromIn(Arrays.asList(BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT)).collectList().block()
Assert.assertNotNull("Failed to find findByDerivedFromIn", dbFindByDerivedFromIn)
Assert.assertTrue("Failed to find findByDerivedFromIn by count", dbFindByDerivedFromIn!!.size > 0)
}
@@ -106,5 +107,4 @@ class ModelTypeReactRepositoryTest {
fun test03Delete() {
modelTypeReactRepository!!.deleteByModelName(modelName).block()
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryReactRepositoryTest.kt
index 6351f6aa0..988fa4d73 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryRepositoryTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/repository/ResourceDictionaryReactRepositoryTest.kt
@@ -21,9 +21,6 @@ import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertiesService
-import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintPropertyConfiguration
-import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.DesignerApiTestConfiguration
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -36,8 +33,9 @@ import org.springframework.test.context.junit4.SpringRunner
import org.springframework.transaction.annotation.Transactional
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [DesignerApiTestConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class, BluePrintDBLibConfiguration::class])
+@ContextConfiguration(
+ classes = [DesignerApiTestConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class ResourceDictionaryReactRepositoryTest {
@@ -51,8 +49,10 @@ class ResourceDictionaryReactRepositoryTest {
@Commit
fun test01Save() {
val resourceDefinition = JacksonUtils
- .readValueFromFile("./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
- ResourceDefinition::class.java)
+ .readValueFromFile(
+ "./../../../../../components/model-catalog/resource-dictionary/starter-dictionary/sample-db-source.json",
+ ResourceDefinition::class.java
+ )
Assert.assertNotNull("Failed to get resourceDefinition from content", resourceDefinition)
resourceDefinition!!.name = sourceName
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
index 10bf887f6..c644aeedd 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/utils/BluePrintEnhancerUtilsTest.kt
@@ -21,8 +21,12 @@ import org.junit.After
import org.junit.Before
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.mock.MockFilePart
-import org.onap.ccsdk.cds.controllerblueprints.core.*
-import java.util.*
+import org.onap.ccsdk.cds.controllerblueprints.core.compress
+import org.onap.ccsdk.cds.controllerblueprints.core.deleteDir
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
+import org.onap.ccsdk.cds.controllerblueprints.core.reCreateDirs
+import java.util.UUID
import kotlin.test.assertTrue
class BluePrintEnhancerUtilsTest {
@@ -30,7 +34,7 @@ class BluePrintEnhancerUtilsTest {
private val blueprintDir = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
private val blueprintArchivePath: String = "./target/blueprints/archive"
private val blueprintEnrichmentPath: String = "./target/blueprints/enrichment"
- private var zipBlueprintFileName = normalizedPathName(blueprintArchivePath, "test.zip")
+ private var zipBlueprintFileName = normalizedPathName(blueprintArchivePath, "test.zip")
@Before
fun setUp() {
@@ -62,4 +66,3 @@ class BluePrintEnhancerUtilsTest {
}
}
}
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/pom.xml b/ms/blueprintsprocessor/modules/inbounds/health-api-common/pom.xml
index 2bd6782a7..3b3fec4d1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/pom.xml
@@ -27,7 +27,7 @@
<artifactId>health-api-common</artifactId>
<packaging>jar</packaging>
- <name>Blueprints Processor Health API common </name>
+ <name>Blueprints Processor Health API common</name>
<description>checking system check health endpoints</description>
<dependencies>
@@ -36,7 +36,6 @@
<artifactId>rest-lib</artifactId>
</dependency>
-
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt
index 0c6099a1a..ead1f3b78 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/BasicAuthRestClientServiceConfiguration.kt
@@ -45,5 +45,4 @@ open class BasicAuthRestClientServiceConfiguration(private val securityConfigura
open fun getBasicAuthRestClientService(): BasicAuthRestClientService {
return BasicAuthRestClientService(getBasicAuthRestClientProperties())
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt
index c63952d80..f64cba88b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/HealthCheckProperties.kt
@@ -26,16 +26,16 @@ import org.springframework.context.annotation.PropertySource
@PropertySource("classpath:application.properties")
open class HealthCheckProperties {
- @Value("\${blueprintprocessor.healthcheck.baseUrl}")
+ @Value("\${blueprintprocessor.healthcheck.baseUrl:}")
private val bluePrintProcessorBaseURL: String? = null
- @Value("#{'\${blueprintprocessor.healthcheck.mapping-service-name-with-service-link}'.split(']')}")
+ @Value("#{'\${blueprintprocessor.healthcheck.mapping-service-name-with-service-link:}'.split(']')}")
private val blueprintprocessorServiceMapping: List<String>? = null
- @Value("\${cdslistener.healthcheck.baseUrl}")
+ @Value("\${cdslistener.healthcheck.baseUrl:}")
private val cdsListenerBaseURL: String? = null
- @Value("#{'\${cdslistener.healthcheck.mapping-service-name-with-service-link}'.split(']')}")
+ @Value("#{'\${cdslistener.healthcheck.mapping-service-name-with-service-link:}'.split(']')}")
private val cdsListenerServiceMapping: List<String>? = null
open fun getBluePrintBaseURL(): String? {
@@ -54,7 +54,6 @@ open class HealthCheckProperties {
open fun getCDSListenerServiceInformation(): List<ServiceEndpoint> {
val serviceName = ServiceName.BLUEPRINT
return getListOfServiceEndPoints(cdsListenerServiceMapping, serviceName)
-
}
private fun getListOfServiceEndPoints(serviceMapping: List<String>?, serviceName: ServiceName): MutableList<ServiceEndpoint> {
@@ -67,7 +66,7 @@ open class HealthCheckProperties {
return serviceEndpoints
}
- private fun fillListOfService(serviceName: ServiceName , element: String, listOfCDSListenerServiceEndpoint: MutableList<ServiceEndpoint>) {
+ private fun fillListOfService(serviceName: ServiceName, element: String, listOfCDSListenerServiceEndpoint: MutableList<ServiceEndpoint>) {
val serviceEndpointInfo = element.split(",/")
val serviceEndpoint = getServiceEndpoint(serviceEndpointInfo)
if (serviceName.equals(ServiceName.CDSLISTENER))
@@ -77,16 +76,15 @@ open class HealthCheckProperties {
listOfCDSListenerServiceEndpoint.add(serviceEndpoint)
}
-
private fun getServiceEndpoint(serviceEndpointInfo: List<String>): ServiceEndpoint {
- return ServiceEndpoint(removeSpecialCharacter(serviceEndpointInfo.get(0))
- , removeSpecialCharacter(serviceEndpointInfo.get(1))
+ return ServiceEndpoint(
+ removeSpecialCharacter(serviceEndpointInfo.get(0)), removeSpecialCharacter(serviceEndpointInfo.get(1))
)
}
- private fun removeSpecialCharacter(value:String):String{
- return value.replaceFirst(",[","")
- .replace("[","")
- .replace("]","")
+ private fun removeSpecialCharacter(value: String): String {
+ return value.replaceFirst(",[", "")
+ .replace("[", "")
+ .replace("]", "")
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/SecurityEncryptionConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/SecurityEncryptionConfiguration.kt
index 94021207a..8b319fc43 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/SecurityEncryptionConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/configuration/SecurityEncryptionConfiguration.kt
@@ -16,17 +16,15 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.configuration
-
import org.apache.commons.net.util.Base64
import org.springframework.stereotype.Component
-import org.springframework.stereotype.Service
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
-
@Component
class SecurityEncryptionConfiguration {
+
private val key = "aesEncryptionKey"
private val initVector = "encryptionIntVec"
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ApplicationHealth.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ApplicationHealth.kt
index f66e8774c..f6ce829c1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ApplicationHealth.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ApplicationHealth.kt
@@ -21,5 +21,3 @@ import org.springframework.boot.actuate.health.Status
data class ApplicationHealth(val status: Status?, val details: Map<String, Any>?) {
constructor() : this(null, HashMap())
}
-
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt
index 61d8120d4..285dc0878 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/HealthApiResponse.kt
@@ -16,8 +16,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
-
-data class HealthApiResponse(val status: HealthCheckStatus, val checks: List<ServicesCheckResponse>
+data class HealthApiResponse(
+ val status: HealthCheckStatus,
+ val checks: List<ServicesCheckResponse>
)
-
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/Metrics.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/Metrics.kt
index d9f1c79d4..ceb92d1b4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/Metrics.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/Metrics.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
-
data class Metrics(val names: ArrayList<Any>?) {
constructor() : this(ArrayList())
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/MetricsResponse.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/MetricsResponse.kt
index b3796c91a..f58a31e8c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/MetricsResponse.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/MetricsResponse.kt
@@ -16,6 +16,4 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
-data class MetricsResponse(val maps: HashMap<String, String>) {
-
-}
+data class MetricsResponse(val maps: HashMap<String, String>)
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt
index ce95a5c0c..badd772c4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceEndpoint.kt
@@ -15,5 +15,4 @@
*/
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
-
data class ServiceEndpoint(val serviceName: String, var serviceLink: String)
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceName.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceName.kt
index 1a78a5d10..3e984b3b6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceName.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServiceName.kt
@@ -17,5 +17,5 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
enum class ServiceName(s: String) {
- BLUEPRINT("Blue Print service"),CDSLISTENER("CDS Listener service")
+ BLUEPRINT("Blue Print service"), CDSLISTENER("CDS Listener service")
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServicesCheckResponse.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServicesCheckResponse.kt
index 391d7f38a..908007523 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServicesCheckResponse.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/ServicesCheckResponse.kt
@@ -16,7 +16,4 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
-
data class ServicesCheckResponse(val name: String, val status: HealthCheckStatus)
-
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/WebClientEnpointResponse.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/WebClientEnpointResponse.kt
index 03e864a9d..1e7e670b5 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/WebClientEnpointResponse.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/domain/WebClientEnpointResponse.kt
@@ -18,5 +18,4 @@ package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-data class WebClientEnpointResponse (val response:BlueprintWebClientService.WebClientResponse<String>?) {
-}
+data class WebClientEnpointResponse(val response: BlueprintWebClientService.WebClientResponse<String>?)
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/EndPointExecution.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/EndPointExecution.kt
index 72fa6c849..9f526251e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/EndPointExecution.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/EndPointExecution.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service
-
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ApplicationHealth
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServiceEndpoint
@@ -35,8 +34,10 @@ import org.springframework.stereotype.Service
* @version 1.0
*/
@Service
-open class EndPointExecution(private val basicAuthRestClientService: BasicAuthRestClientService
- , private val restClientProperties: BasicAuthRestClientProperties) {
+open class EndPointExecution(
+ private val basicAuthRestClientService: BasicAuthRestClientService,
+ private val restClientProperties: BasicAuthRestClientProperties
+) {
private var logger = LoggerFactory.getLogger(EndPointExecution::class.java)
@@ -46,25 +47,21 @@ open class EndPointExecution(private val basicAuthRestClientService: BasicAuthRe
val result = basicAuthRestClientService.exchangeResource(HttpMethod.GET.name, "", "")
if (result.status == 200)
return WebClientEnpointResponse(result)
-
} catch (e: Exception) {
logger.error("service name ${serviceEndpoint.serviceName} is down ${e.message}")
}
- return WebClientEnpointResponse(BlueprintWebClientService.WebClientResponse(500,""))
+ return WebClientEnpointResponse(BlueprintWebClientService.WebClientResponse(500, ""))
}
private fun addClientPropertiesConfiguration(serviceEndpoint: ServiceEndpoint) {
restClientProperties.url = serviceEndpoint.serviceLink
}
-
open fun getHealthFromWebClientEnpointResponse(webClientEnpointResponse: WebClientEnpointResponse): ApplicationHealth? {
return mappingMetricsToDTO(webClientEnpointResponse?.response?.body.toString())
-
}
private fun mappingMetricsToDTO(body: String): ApplicationHealth {
return ObjectMapper().readValue(body, ApplicationHealth::class.java)
}
}
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/AbstractHealthCheck.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/AbstractHealthCheck.kt
index f793754e3..6d49ebe65 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/AbstractHealthCheck.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/AbstractHealthCheck.kt
@@ -16,7 +16,11 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health
-import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.*
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServiceEndpoint
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServicesCheckResponse
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.WebClientEnpointResponse
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.EndPointExecution
import org.slf4j.LoggerFactory
@@ -27,7 +31,7 @@ import org.slf4j.LoggerFactory
* @author Shaaban Ebrahim
* @version 1.0
*/
-abstract class AbstractHealthCheck (private val endPointExecution: EndPointExecution) {
+abstract class AbstractHealthCheck(private val endPointExecution: EndPointExecution) {
private var logger = LoggerFactory.getLogger(BluePrintProcessorHealthCheck::class.java)
@@ -45,10 +49,8 @@ abstract class AbstractHealthCheck (private val endPointExecution: EndPointExec
}
healthApiResponse = HealthApiResponse(systemStatus, listOfResponse)
return healthApiResponse
-
}
-
private fun retrieveServiceStatus(serviceEndpoint: ServiceEndpoint): HealthCheckStatus {
var serviceStatus: HealthCheckStatus = HealthCheckStatus.UP
try {
@@ -59,16 +61,13 @@ abstract class AbstractHealthCheck (private val endPointExecution: EndPointExec
} catch (e: Exception) {
logger.error("service name ${serviceEndpoint.serviceName} is down ${e.message}")
serviceStatus = HealthCheckStatus.DOWN
-
}
return serviceStatus
}
-
open fun retrieveEndpointExecutionStatus(): HealthApiResponse {
return retrieveSystemStatus(setupServiceEndpoint())
}
abstract fun setupServiceEndpoint(): List<ServiceEndpoint>
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/BluePrintProcessorHealthCheck.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/BluePrintProcessorHealthCheck.kt
index d661b32b5..dddad52e2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/BluePrintProcessorHealthCheck.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/BluePrintProcessorHealthCheck.kt
@@ -28,9 +28,11 @@ import org.springframework.stereotype.Service
* @version 1.0
*/
@Service
-open class BluePrintProcessorHealthCheck(private val endPointExecution: EndPointExecution
- , private val healthCheckProperties: HealthCheckProperties)
- : AbstractHealthCheck(endPointExecution) {
+open class BluePrintProcessorHealthCheck(
+ private val endPointExecution: EndPointExecution,
+ private val healthCheckProperties: HealthCheckProperties
+) :
+ AbstractHealthCheck(endPointExecution) {
override fun setupServiceEndpoint(): List<ServiceEndpoint> {
return healthCheckProperties.getBluePrintServiceInformation()
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/SDCListenerHealthCheck.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/SDCListenerHealthCheck.kt
index 0a7c5e092..aa0d4d5f2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/SDCListenerHealthCheck.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/health/SDCListenerHealthCheck.kt
@@ -17,14 +17,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.configuration.HealthCheckProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
-import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServiceEndpoint
-import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServicesCheckResponse
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.EndPointExecution
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.slf4j.LoggerFactory
-import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
/**
@@ -34,13 +28,13 @@ import org.springframework.stereotype.Service
* @version 1.0
*/
@Service
-open class SDCListenerHealthCheck (private val endPointExecution: EndPointExecution
- ,private val healthCheckProperties: HealthCheckProperties)
- : AbstractHealthCheck(endPointExecution) {
+open class SDCListenerHealthCheck(
+ private val endPointExecution: EndPointExecution,
+ private val healthCheckProperties: HealthCheckProperties
+) :
+ AbstractHealthCheck(endPointExecution) {
override fun setupServiceEndpoint(): List<ServiceEndpoint> {
return healthCheckProperties.getCDSListenerServiceInformation()
}
-
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.kt
index c4a8d1235..e3ba72428 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckServiceTest.kt
@@ -16,25 +16,18 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi
+import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
-import org.mockito.ArgumentMatchers.any
-import org.mockito.ArgumentMatchers.eq
-import org.mockito.Mockito.anyString
-import org.mockito.Mockito.mock
-
-import java.util.Arrays
-import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
-import org.mockito.ArgumentMatchers
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito
+import org.mockito.Mockito.anyString
import org.mockito.junit.MockitoJUnitRunner
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.configuration.HealthCheckProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServiceEndpoint
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.EndPointExecution
@@ -42,8 +35,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BluePrint
import org.onap.ccsdk.cds.blueprintsprocessor.rest.BasicAuthRestClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BasicAuthRestClientService
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
-import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService.WebClientResponse
-import org.springframework.http.HttpMethod
+import java.util.Arrays
@RunWith(MockitoJUnitRunner::class)
class HealthCheckServiceTest {
@@ -62,106 +54,113 @@ class HealthCheckServiceTest {
private var bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck? = null
-
@Before
fun setup() {
endPointExecution = Mockito.spy(endPointExecution!!)
- Mockito.`when`(healthCheckProperties!!.getBluePrintServiceInformation()).thenReturn(Arrays.asList(
+ Mockito.`when`(healthCheckProperties!!.getBluePrintServiceInformation()).thenReturn(
+ Arrays.asList(
ServiceEndpoint("Execution service ", "http://cds-blueprints-processor-http:8080/api/v1/execution-service/health-check"),
- ServiceEndpoint("Resources service", "http://cds-blueprints-processor-http:8080/api/v1/resources/health-check"), ServiceEndpoint("Template service", "http://cds-blueprints-processor-http:8080/api/v1/template/health-check")
- ))
+ ServiceEndpoint("Resources service", "http://cds-blueprints-processor-http:8080/api/v1/resources/health-check"),
+ ServiceEndpoint("Template service", "http://cds-blueprints-processor-http:8080/api/v1/template/health-check")
+ )
+ )
bluePrintProcessorHealthCheck = BluePrintProcessorHealthCheck(endPointExecution!!, healthCheckProperties)
}
- @Test
+ @Test
fun testSystemIsCompletelyDown() {
- Mockito.`when`(basicAuthRestClientService!!.exchangeResource(
- anyString(),
- anyString(),
- anyString())).thenThrow(RuntimeException())
+ Mockito.`when`(
+ basicAuthRestClientService!!.exchangeResource(
+ anyString(),
+ anyString(),
+ anyString()
+ )
+ ).thenThrow(RuntimeException())
val healthApiResponse = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
assertNotNull(healthApiResponse)
Assert.assertEquals(HealthCheckStatus.DOWN, healthApiResponse.status)
healthApiResponse.checks.forEach { serviceEndpoint ->
assertNotNull(serviceEndpoint)
assertEquals(HealthCheckStatus.DOWN, serviceEndpoint.status)
-
}
-
}
@Test
fun testSystemIsUPAndRunning() {
- Mockito.`when`(basicAuthRestClientService!!
- .exchangeResource(
- anyString(),
- anyString(),
- anyString())).thenReturn(BlueprintWebClientService.WebClientResponse(200, "Success"))
+ Mockito.`when`(
+ basicAuthRestClientService!!
+ .exchangeResource(
+ anyString(),
+ anyString(),
+ anyString()
+ )
+ ).thenReturn(BlueprintWebClientService.WebClientResponse(200, "Success"))
val healthApiResponse = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
assertNotNull(healthApiResponse)
assertEquals(HealthCheckStatus.UP, healthApiResponse.status)
healthApiResponse.checks.forEach { serviceEndpoint ->
assertNotNull(serviceEndpoint)
assertEquals(HealthCheckStatus.UP, serviceEndpoint.status)
-
}
-
}
@Test
fun testServiceIsNotFound() {
- Mockito.`when`(basicAuthRestClientService!!.exchangeResource(
- anyString(),
- anyString(),
- anyString())).thenReturn(BlueprintWebClientService.WebClientResponse(404, "failure"))
+ Mockito.`when`(
+ basicAuthRestClientService!!.exchangeResource(
+ anyString(),
+ anyString(),
+ anyString()
+ )
+ ).thenReturn(BlueprintWebClientService.WebClientResponse(404, "failure"))
val healthApiResponse = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
assertNotNull(healthApiResponse)
assertEquals(HealthCheckStatus.DOWN, healthApiResponse.status)
healthApiResponse.checks.forEach { serviceEndpoint ->
assertNotNull(serviceEndpoint)
assertEquals(HealthCheckStatus.DOWN, serviceEndpoint.status)
-
}
-
}
-
@Test
fun testServiceInternalServerError() {
- Mockito.`when`(basicAuthRestClientService!!.exchangeResource(
- anyString(),
- anyString(),
- anyString()))
- .thenReturn(BlueprintWebClientService.WebClientResponse(500, "failure"))
+ Mockito.`when`(
+ basicAuthRestClientService!!.exchangeResource(
+ anyString(),
+ anyString(),
+ anyString()
+ )
+ )
+ .thenReturn(BlueprintWebClientService.WebClientResponse(500, "failure"))
val healthApiResponse = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
assertNotNull(healthApiResponse)
assertEquals(HealthCheckStatus.DOWN, healthApiResponse.status)
healthApiResponse.checks.forEach { serviceEndpoint ->
assertNotNull(serviceEndpoint)
assertEquals(HealthCheckStatus.DOWN, serviceEndpoint.status)
-
}
-
}
@Test
fun testServiceIsRedirected() {
- Mockito.`when`(basicAuthRestClientService!!.
- exchangeResource(
- anyString(),
- anyString(),
- anyString()))
- .thenReturn(BlueprintWebClientService.WebClientResponse(300, "failure"))
+ Mockito.`when`(
+ basicAuthRestClientService!!
+ .exchangeResource(
+ anyString(),
+ anyString(),
+ anyString()
+ )
+ )
+ .thenReturn(BlueprintWebClientService.WebClientResponse(300, "failure"))
val healthApiResponse = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
assertNotNull(healthApiResponse)
assertEquals(HealthCheckStatus.DOWN, healthApiResponse.status)
healthApiResponse.checks.forEach { serviceEndpoint ->
assertNotNull(serviceEndpoint)
assertEquals(HealthCheckStatus.DOWN, serviceEndpoint.status)
-
}
}
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/SecurityConfigurationTest.kt b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/SecurityConfigurationTest.kt
index e1f7abdb7..54becbadf 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/SecurityConfigurationTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api-common/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/SecurityConfigurationTest.kt
@@ -20,7 +20,6 @@ import org.junit.Assert
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.configuration.SecurityEncryptionConfiguration
-
class SecurityConfigurationTest {
@Test
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedHealth.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedHealth.kt
index 54c85a0fc..531a275fa 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedHealth.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedHealth.kt
@@ -35,18 +35,20 @@ import org.springframework.web.bind.annotation.RestController
*/
@RestController
@RequestMapping("/api/v1/combinedHealth")
-@Api(value = "/api/v1/combinedHealth",
- description = "gather all HealthCheckResponses for HealthChecks known to the runtime")
+@Api(
+ value = "/api/v1/combinedHealth",
+ description = "gather all HealthCheckResponses for HealthChecks known to the runtime"
+)
open class CombinedHealth(private val combinedHealthService: CombinedHealthService) {
- @RequestMapping(path = [""],
- method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ @RequestMapping(
+ path = [""],
+ method = [RequestMethod.GET],
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
@ApiOperation(value = "Health Check", hidden = true)
fun getSystemHealthCheckResponse(): ResponseEntity<List<ApplicationHealth?>> {
return ResponseEntity.ok().body(combinedHealthService.getCombinedHealthCheck())
-
}
}
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedMetrics.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedMetrics.kt
index 785def524..d2f02028c 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedMetrics.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/controller/CombinedMetrics.kt
@@ -35,18 +35,20 @@ import org.springframework.web.bind.annotation.RestController
*/
@RestController
@RequestMapping("/api/v1/combinedMetrics")
-@Api(value = "/api/v1/combinedMetrics",
- description = "gather all Metrics info from BluePrint and CDSListener")
+@Api(
+ value = "/api/v1/combinedMetrics",
+ description = "gather all Metrics info from BluePrint and CDSListener"
+)
open class CombinedMetrics(private val combinedMetricsService: CombinedMetricsService) {
- @RequestMapping(path = [""],
- method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ @RequestMapping(
+ path = [""],
+ method = [RequestMethod.GET],
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
@ApiOperation(value = " Metrics Check", hidden = true)
fun getMetricsHealthCheckResponse(): ResponseEntity<MetricsInfo?> {
return ResponseEntity.ok().body(combinedMetricsService.metricsInfo)
-
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedHealthService.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedHealthService.kt
index 786048ce4..f4c3e93bf 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedHealthService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedHealthService.kt
@@ -22,7 +22,6 @@ import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.WebClientEnpointR
import org.springframework.boot.actuate.health.Status
import org.springframework.stereotype.Service
-
/**
*Service for combined health (BluePrintProcessor and CDSListener)
*
@@ -30,13 +29,15 @@ import org.springframework.stereotype.Service
* @version 1.0
*/
@Service
-open class CombinedHealthService(private val endPointExecution: EndPointExecution
- , private val healthCheckProperties: HealthCheckProperties) {
+open class CombinedHealthService(
+ private val endPointExecution: EndPointExecution,
+ private val healthCheckProperties: HealthCheckProperties
+) {
private fun setupServiceEndpoint(): List<ServiceEndpoint> {
return listOf(
- ServiceEndpoint("BluePrintProcessor Health Check ", healthCheckProperties.getBluePrintBaseURL() + "actuator/health")
- , ServiceEndpoint("CDSListener Health Check", healthCheckProperties.getCDSListenerBaseURL() + "actuator/health")
+ ServiceEndpoint("BluePrintProcessor Health Check ", healthCheckProperties.getBluePrintBaseURL() + "actuator/health"),
+ ServiceEndpoint("CDSListener Health Check", healthCheckProperties.getCDSListenerBaseURL() + "actuator/health")
)
}
@@ -45,14 +46,18 @@ open class CombinedHealthService(private val endPointExecution: EndPointExecutio
for (serviceEndpoint in setupServiceEndpoint().parallelStream()) {
val result: WebClientEnpointResponse? = endPointExecution?.retrieveWebClientResponse(serviceEndpoint)
if (result?.response != null &&
- result.response!!.status?.equals(200)!!) {
+ result.response!!.status?.equals(200)!!
+ ) {
listOfResponse.add(endPointExecution?.getHealthFromWebClientEnpointResponse(result))
} else {
- listOfResponse.add(ApplicationHealth(Status.DOWN,
- hashMapOf(serviceEndpoint.serviceLink to serviceEndpoint.serviceLink)))
+ listOfResponse.add(
+ ApplicationHealth(
+ Status.DOWN,
+ hashMapOf(serviceEndpoint.serviceLink to serviceEndpoint.serviceLink)
+ )
+ )
}
}
return listOfResponse
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedMetricsService.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedMetricsService.kt
index a23c9925b..0a2e7ae24 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedMetricsService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/service/CombinedMetricsService.kt
@@ -16,7 +16,12 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.configuration.HealthCheckProperties
-import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.*
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ActuatorCheckResponse
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.Metrics
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.MetricsInfo
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.MetricsResponse
+import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.ServiceEndpoint
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.utils.ObjectMappingUtils
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
import org.springframework.stereotype.Service
@@ -28,14 +33,16 @@ import org.springframework.stereotype.Service
* @version 1.0
*/
@Service
-open class CombinedMetricsService(private val endPointExecution: EndPointExecution
- , private val healthCheckProperties: HealthCheckProperties
- , private val objectMappingUtils: ObjectMappingUtils<Metrics>) {
+open class CombinedMetricsService(
+ private val endPointExecution: EndPointExecution,
+ private val healthCheckProperties: HealthCheckProperties,
+ private val objectMappingUtils: ObjectMappingUtils<Metrics>
+) {
private fun setupServiceEndpoint(): List<ServiceEndpoint> {
return listOf(
- ServiceEndpoint("BluePrintProcessor metrics", healthCheckProperties.getBluePrintBaseURL() + "/actuator/metrics")
- , ServiceEndpoint("CDS Listener metrics", healthCheckProperties.getCDSListenerBaseURL() + "/actuator/metrics")
+ ServiceEndpoint("BluePrintProcessor metrics", healthCheckProperties.getBluePrintBaseURL() + "/actuator/metrics"),
+ ServiceEndpoint("CDS Listener metrics", healthCheckProperties.getCDSListenerBaseURL() + "/actuator/metrics")
)
}
@@ -46,7 +53,8 @@ open class CombinedMetricsService(private val endPointExecution: EndPointExecuti
val webClientResponse = endPointExecution?.retrieveWebClientResponse(serviceEndpoint)
var actuatorsHealthResponse: ActuatorCheckResponse? = null
actuatorsHealthResponse = if (webClientResponse?.response != null &&
- webClientResponse.response!!.status?.equals(200)!!) {
+ webClientResponse.response!!.status?.equals(200)!!
+ ) {
var body = gettingCustomizedBody(serviceEndpoint, webClientResponse.response!!)
ActuatorCheckResponse(serviceEndpoint.serviceName, body)
} else {
@@ -57,7 +65,10 @@ open class CombinedMetricsService(private val endPointExecution: EndPointExecuti
return MetricsInfo(containerHealthChecks)
}
- private fun gettingCustomizedBody(serviceEndpoint: ServiceEndpoint?, webClientResponse: BlueprintWebClientService.WebClientResponse<String>): Any {
+ private fun gettingCustomizedBody(
+ serviceEndpoint: ServiceEndpoint?,
+ webClientResponse: BlueprintWebClientService.WebClientResponse<String>
+ ): Any {
var body: Any
val metrics: Metrics = objectMappingUtils.getObjectFromBody(webClientResponse.body, Metrics::class.java)
val mapOfMetricsInfo = HashMap<String, String>()
@@ -69,4 +80,3 @@ open class CombinedMetricsService(private val endPointExecution: EndPointExecuti
return body
}
}
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt
index b1d629da7..5a1999ec1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/health-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/healthapi/HealthCheckApplicationTests.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.healthapi
-
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
@@ -40,8 +39,10 @@ import org.springframework.test.web.reactive.server.WebTestClient
*/
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [BluePrintRuntimeService::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class, ComponentScriptExecutor::class])
+@ContextConfiguration(
+ classes = [BluePrintRuntimeService::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SecurityProperties::class, ComponentScriptExecutor::class]
+)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class HealthCheckApplicationTests {
@@ -52,17 +53,14 @@ class HealthCheckApplicationTests {
@Test
fun testHealthApiUp() {
webTestClient.get().uri("/api/v1/combinedHealth")
- .exchange()
- .expectStatus().is2xxSuccessful
-
+ .exchange()
+ .expectStatus().is2xxSuccessful
}
@Test
fun testMetricsApiUp() {
webTestClient.get().uri("/api/v1/combinedMetrics")
- .exchange()
- .expectStatus().is2xxSuccessful
+ .exchange()
+ .expectStatus().is2xxSuccessful
}
-
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml
index 6dc39a7ff..81fe3af4e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml
@@ -53,7 +53,6 @@
<artifactId>resource-resolution</artifactId>
</dependency>
-
<!-- Test Dependencies -->
<dependency>
<groupId>io.mockk</groupId>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
index 32324bf6d..8c468feed 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/pom.xml
@@ -35,8 +35,8 @@
<artifactId>spring-security-core</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt
index 3a708a973..b49ca68ed 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceController.kt
@@ -27,31 +27,43 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestMethod
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/api/v1/resources")
-@Api(value = "/api/v1/resources",
- description = "Interaction with resolved resources.")
+@Api(
+ value = "/api/v1/resources",
+ description = "Interaction with resolved resources."
+)
open class ResourceController(private var resourceResolutionDBService: ResourceResolutionDBService) {
- @RequestMapping(path = ["/health-check"],
+ @RequestMapping(
+ path = ["/health-check"],
method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
@ApiOperation(value = "Health Check", hidden = true)
fun resourceControllerHealthCheck(): JsonNode = runBlocking {
JacksonUtils.getJsonNode("Success")
}
- @RequestMapping(path = [""],
- method = [RequestMethod.GET], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Get all resolved resources using the resolution key. ",
+ @RequestMapping(
+ path = [""],
+ method = [RequestMethod.GET], produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
+ @ApiOperation(
+ value = "Get all resolved resources using the resolution key. ",
notes = "Retrieve all stored resolved resources using the blueprint name, blueprint version, " +
"artifact name and the resolution-key.",
response = ResourceResolution::class,
responseContainer = "List",
- produces = MediaType.APPLICATION_JSON_VALUE)
+ produces = MediaType.APPLICATION_JSON_VALUE
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun getAllFromResolutionKeyOrFromResourceTypeAndId(
@@ -66,8 +78,9 @@ open class ResourceController(private var resourceResolutionDBService: ResourceR
@ApiParam(value = "Resource Type associated with the resolution.", required = false)
@RequestParam(value = "resourceType", required = false, defaultValue = "") resourceType: String,
@ApiParam(value = "Resource Id associated with the resolution.", required = false)
- @RequestParam(value = "resourceId", required = false, defaultValue = "") resourceId: String)
- : ResponseEntity<List<ResourceResolution>> = runBlocking {
+ @RequestParam(value = "resourceId", required = false, defaultValue = "") resourceId: String
+ ):
+ ResponseEntity<List<ResourceResolution>> = runBlocking {
if ((resolutionKey.isNotEmpty() || artifactName.isNotEmpty()) && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
throw ResolutionException("Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.")
@@ -76,36 +89,46 @@ open class ResourceController(private var resourceResolutionDBService: ResourceR
.body(resourceResolutionDBService.readWithResolutionKey(bpName, bpVersion, artifactName, resolutionKey))
} else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
ResponseEntity.ok()
- .body(resourceResolutionDBService.readWithResourceIdAndResourceType(bpName,
- bpVersion,
- resourceId,
- resourceType))
+ .body(
+ resourceResolutionDBService.readWithResourceIdAndResourceType(
+ bpName,
+ bpVersion,
+ resourceId,
+ resourceType
+ )
+ )
} else {
throw ResolutionException("Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.")
}
}
- @RequestMapping(path = ["/resource"],
+ @RequestMapping(
+ path = ["/resource"],
method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Fetch a resource value using resolution key.",
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
+ @ApiOperation(
+ value = "Fetch a resource value using resolution key.",
notes = "Retrieve a stored resource value using the blueprint metadata, artifact name, resolution-key along with the name of the resource value to retrieve.",
- produces = MediaType.APPLICATION_JSON_VALUE)
+ produces = MediaType.APPLICATION_JSON_VALUE
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
- fun getOneFromResolutionKey(@ApiParam(value = "Name of the CBA.", required = true)
- @RequestParam(value = "bpName", required = true) bpName: String,
- @ApiParam(value = "Version of the CBA.", required = true)
- @RequestParam(value = "bpVersion", required = true) bpVersion: String,
- @ApiParam(value = "Artifact name for which to retrieve a resolved resource.", required = true)
- @RequestParam(value = "artifactName", required = true) artifactName: String,
- @ApiParam(value = "Resolution Key associated with the resolution.", required = true)
- @RequestParam(value = "resolutionKey", required = true) resolutionKey: String,
- @ApiParam(value = "Name of the resource to retrieve.", required = true)
- @RequestParam(value = "name", required = true) name: String)
- : ResponseEntity<ResourceResolution> = runBlocking {
+ fun getOneFromResolutionKey(
+ @ApiParam(value = "Name of the CBA.", required = true)
+ @RequestParam(value = "bpName", required = true) bpName: String,
+ @ApiParam(value = "Version of the CBA.", required = true)
+ @RequestParam(value = "bpVersion", required = true) bpVersion: String,
+ @ApiParam(value = "Artifact name for which to retrieve a resolved resource.", required = true)
+ @RequestParam(value = "artifactName", required = true) artifactName: String,
+ @ApiParam(value = "Resolution Key associated with the resolution.", required = true)
+ @RequestParam(value = "resolutionKey", required = true) resolutionKey: String,
+ @ApiParam(value = "Name of the resource to retrieve.", required = true)
+ @RequestParam(value = "name", required = true) name: String
+ ):
+ ResponseEntity<ResourceResolution> = runBlocking {
ResponseEntity.ok()
.body(resourceResolutionDBService.readValue(bpName, bpVersion, artifactName, resolutionKey, name))
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt
index 42ff8016c..5d5623d4f 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceExceptionHandler.kt
@@ -23,16 +23,16 @@ import com.fasterxml.jackson.annotation.JsonTypeName
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.data.ErrorCode
import org.slf4j.LoggerFactory
+import org.springframework.dao.EmptyResultDataAccessException
+import org.springframework.dao.IncorrectResultSizeDataAccessException
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.orm.jpa.JpaObjectRetrievalFailureException
-import org.springframework.dao.EmptyResultDataAccessException
-import org.springframework.dao.IncorrectResultSizeDataAccessException
-import org.springframework.web.server.ServerWebInputException
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.RestControllerAdvice
+import org.springframework.web.server.ServerWebInputException
import java.io.Serializable
-import java.util.*
+import java.util.Date
/**
* Handle exceptions in Resolution API and provide relevant HTTP status codes and messages
@@ -86,9 +86,11 @@ open class ResourceExceptionHandler {
fun returnError(e: Exception, errorCode: ErrorCode): ResponseEntity<ErrorMessage> {
log.error(e.message, e)
val errorMessage =
- ErrorMessage(errorCode.message(e.message!!),
+ ErrorMessage(
+ errorCode.message(e.message!!),
errorCode.value,
- debugMsg)
+ debugMsg
+ )
return ResponseEntity(errorMessage, HttpStatus.resolve(errorCode.httpCode)!!)
}
@@ -103,6 +105,7 @@ open class ResourceExceptionHandler {
@JsonTypeName("errorMessage")
@JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
class ErrorMessage(var message: String?, var code: Int?, var debugMessage: String?) : Serializable {
+
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
var timestamp = Date()
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
index 93253a554..5913bde1d 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
@@ -27,7 +27,14 @@ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.PathVariable
+import org.springframework.web.bind.annotation.PostMapping
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestMethod
+import org.springframework.web.bind.annotation.RequestParam
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
/**
* Exposes Template Resolution API to store and retrieve rendered template results.
@@ -37,26 +44,34 @@ import org.springframework.web.bind.annotation.*
*/
@RestController
@RequestMapping("/api/v1/template")
-@Api(value = "/api/v1/template",
- description = "Interaction with resolved template.")
+@Api(
+ value = "/api/v1/template",
+ description = "Interaction with resolved template."
+)
open class TemplateController(private val templateResolutionService: TemplateResolutionService) {
- @RequestMapping(path = ["/health-check"],
+ @RequestMapping(
+ path = ["/health-check"],
method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
@ApiOperation(value = "Health Check", hidden = true)
fun templateControllerHealthCheck(): JsonNode = runBlocking {
JacksonUtils.getJsonNode("Success")
}
- @RequestMapping(path = [""],
+ @RequestMapping(
+ path = [""],
method = [RequestMethod.GET],
- produces = [MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE])
- @ApiOperation(value = "Retrieve a resolved template.",
+ produces = [MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE]
+ )
+ @ApiOperation(
+ value = "Retrieve a resolved template.",
notes = "Retrieve a config template for a given CBA's action, identified by its blueprint name, blueprint version, " +
"artifact name and resolution key. An extra 'format' parameter can be passed to tell what content-type" +
- " to expect in return")
+ " to expect in return"
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun get(
@@ -72,11 +87,14 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@RequestParam(value = "resourceType", required = false, defaultValue = "") resourceType: String,
@ApiParam(value = "Resource Id associated with the resolution.", required = false)
@RequestParam(value = "resourceId", required = false, defaultValue = "") resourceId: String,
- @ApiParam(value = "Expected format of the template being retrieved.",
+ @ApiParam(
+ value = "Expected format of the template being retrieved.",
defaultValue = MediaType.TEXT_PLAIN_VALUE,
- required = true)
- @RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String)
- : ResponseEntity<String> = runBlocking {
+ required = true
+ )
+ @RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String
+ ):
+ ResponseEntity<String> = runBlocking {
var result = ""
@@ -87,7 +105,8 @@ open class TemplateController(private val templateResolutionService: TemplateRes
bpName,
bpVersion,
artifactName,
- resolutionKey)
+ resolutionKey
+ )
} else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
result =
templateResolutionService.findByResoureIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactName(
@@ -95,12 +114,12 @@ open class TemplateController(private val templateResolutionService: TemplateRes
bpVersion,
artifactName,
resourceId,
- resourceType)
+ resourceType
+ )
} else {
throw ResolutionException("Missing param. Either retrieve resolved template using artifact name and resolution-key OR using resource-id and resource-type.")
}
-
var expectedContentType = format
if (expectedContentType.indexOf('/') < 0) {
expectedContentType = "application/$expectedContentType"
@@ -110,13 +129,14 @@ open class TemplateController(private val templateResolutionService: TemplateRes
ResponseEntity.ok().contentType(expectedMediaType).body(result)
}
-
@PostMapping("/{bpName}/{bpVersion}/{artifactName}/{resolutionKey}", produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Store a resolved template w/ resolution-key",
+ @ApiOperation(
+ value = "Store a resolved template w/ resolution-key",
notes = "Store a template for a given CBA's action, identified by its blueprint name, blueprint version, " +
"artifact name and resolution key.",
response = TemplateResolution::class,
- produces = MediaType.APPLICATION_JSON_VALUE)
+ produces = MediaType.APPLICATION_JSON_VALUE
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun postWithResolutionKey(
@@ -129,7 +149,8 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@ApiParam(value = "Resolution Key associated with the resolution.", required = true)
@PathVariable(value = "resolutionKey") resolutionKey: String,
@ApiParam(value = "Template to store.", required = true)
- @RequestBody result: String): ResponseEntity<TemplateResolution> = runBlocking {
+ @RequestBody result: String
+ ): ResponseEntity<TemplateResolution> = runBlocking {
val resultStored =
templateResolutionService.write(bpName, bpVersion, artifactName, result, resolutionKey = resolutionKey)
@@ -137,13 +158,17 @@ open class TemplateController(private val templateResolutionService: TemplateRes
ResponseEntity.ok().body(resultStored)
}
- @PostMapping("/{bpName}/{bpVersion}/{artifactName}/{resourceType}/{resourceId}",
- produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Store a resolved template w/ resourceId and resourceType",
+ @PostMapping(
+ "/{bpName}/{bpVersion}/{artifactName}/{resourceType}/{resourceId}",
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
+ @ApiOperation(
+ value = "Store a resolved template w/ resourceId and resourceType",
notes = "Store a template for a given CBA's action, identified by its blueprint name, blueprint version, " +
"artifact name, resourceId and resourceType.",
response = TemplateResolution::class,
- produces = MediaType.APPLICATION_JSON_VALUE)
+ produces = MediaType.APPLICATION_JSON_VALUE
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun postWithResourceIdAndResourceType(
@@ -158,7 +183,8 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@ApiParam(value = "Resource Id associated with the resolution.", required = false)
@PathVariable(value = "resourceId", required = true) resourceId: String,
@ApiParam(value = "Template to store.", required = true)
- @RequestBody result: String): ResponseEntity<TemplateResolution> = runBlocking {
+ @RequestBody result: String
+ ): ResponseEntity<TemplateResolution> = runBlocking {
val resultStored =
templateResolutionService.write(bpName, bpVersion, artifactName, result, resourceId = resourceId, resourceType = resourceType)
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
index 85ac7bddd..39ff32d75 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/ResourceControllerTest.kt
@@ -22,6 +22,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolution
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionDBService
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
@@ -35,13 +36,18 @@ import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [ResourceController::class, ResourceResolutionDBService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(
+ classes = [TestDatabaseConfiguration::class,
+ ResourceController::class, ResourceResolutionDBService::class, SecurityProperties::class]
+)
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.controllerblueprints.core.service",
+ "org.onap.ccsdk.cds.blueprintsprocessor.resource.api",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ResourceControllerTest {
@@ -88,8 +94,10 @@ class ResourceControllerTest {
.consumeWith {
val json = String(it.responseBody!!)
val typeFactory = JacksonUtils.objectMapper.typeFactory
- val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(json,
- typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java))
+ val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(
+ json,
+ typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java)
+ )
Assert.assertEquals(2, list.size)
assertEqual(ra1, list[0])
assertEqual(ra1, list[0])
@@ -119,8 +127,10 @@ class ResourceControllerTest {
.consumeWith {
val json = String(it.responseBody!!)
val typeFactory = JacksonUtils.objectMapper.typeFactory
- val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(json,
- typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java))
+ val list: List<ResourceResolution> = JacksonUtils.objectMapper.readValue(
+ json,
+ typeFactory.constructCollectionType(List::class.java, ResourceResolution::class.java)
+ )
Assert.assertEquals(2, list.size)
assertEqual(ra1, list[0])
assertEqual(ra1, list[0])
@@ -128,7 +138,6 @@ class ResourceControllerTest {
}
}
-
@Test
fun getAllFromMissingParamTest() {
runBlocking {
@@ -140,8 +149,10 @@ class ResourceControllerTest {
.expectBody()
.consumeWith {
val r = JacksonUtils.objectMapper.readValue(it.responseBody, ErrorMessage::class.java)
- Assert.assertEquals("Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
- r.message)
+ Assert.assertEquals(
+ "Missing param. Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
+ r.message
+ )
}
}
}
@@ -157,8 +168,10 @@ class ResourceControllerTest {
.expectBody()
.consumeWith {
val r = JacksonUtils.objectMapper.readValue(it.responseBody, ErrorMessage::class.java)
- Assert.assertEquals("Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
- r.message)
+ Assert.assertEquals(
+ "Either retrieve resolved value using artifact name and resolution-key OR using resource-id and resource-type.",
+ r.message
+ )
}
}
}
@@ -195,15 +208,21 @@ class ResourceControllerTest {
}
}
- private suspend fun store(resourceAssignment: ResourceAssignment, resKey: String = "", resId: String = "",
- resType: String = "") {
- resourceResolutionDBService.write(blueprintName,
+ private suspend fun store(
+ resourceAssignment: ResourceAssignment,
+ resKey: String = "",
+ resId: String = "",
+ resType: String = ""
+ ) {
+ resourceResolutionDBService.write(
+ blueprintName,
blueprintVersion,
resKey,
resId,
resType,
templatePrefix,
- resourceAssignment)
+ resourceAssignment
+ )
}
private fun createRA(prefix: String): ResourceAssignment {
@@ -221,8 +240,10 @@ class ResourceControllerTest {
}
private fun assertEqual(resourceAssignment: ResourceAssignment, resourceResolution: ResourceResolution) {
- Assert.assertEquals(JacksonUtils.getValue(resourceAssignment.property?.value!!).toString(),
- resourceResolution.value)
+ Assert.assertEquals(
+ JacksonUtils.getValue(resourceAssignment.property?.value!!).toString(),
+ resourceResolution.value
+ )
Assert.assertEquals(resourceAssignment.status, resourceResolution.status)
Assert.assertEquals(resourceAssignment.dictionarySource, resourceResolution.dictionarySource)
Assert.assertEquals(resourceAssignment.dictionaryName, resourceResolution.dictionaryName)
@@ -230,6 +251,5 @@ class ResourceControllerTest {
Assert.assertEquals(resourceAssignment.name, resourceResolution.name)
Assert.assertEquals(blueprintVersion, resourceResolution.blueprintVersion)
Assert.assertEquals(blueprintName, resourceResolution.blueprintName)
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
index c3a718e11..d91792d01 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateControllerTest.kt
@@ -37,8 +37,10 @@ import kotlin.test.AfterTest
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class])
+@ContextConfiguration(
+ classes = [TestDatabaseConfiguration::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SecurityProperties::class]
+)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class TemplateControllerTest {
@@ -55,7 +57,7 @@ class TemplateControllerTest {
val payloadDummyTemplateData = "PAYLOAD DATA"
var requestArguments = "bpName=$blueprintName&bpVersion=$blueprintVersion" +
- "&artifactName=$templatePrefix&resolutionKey=$resolutionKey"
+ "&artifactName=$templatePrefix&resolutionKey=$resolutionKey"
@AfterTest
fun cleanDir() {
@@ -113,9 +115,9 @@ class TemplateControllerTest {
fun `get returns 400 error if missing arg`() {
runBlocking {
val arguments = "bpBADName=$blueprintName" +
- "&bpBADVersion=$blueprintVersion" +
- "&artifactName=$templatePrefix" +
- "&resolutionKey=$resolutionKey"
+ "&bpBADVersion=$blueprintVersion" +
+ "&artifactName=$templatePrefix" +
+ "&resolutionKey=$resolutionKey"
webTestClient.get().uri("/api/v1/template?$arguments")
.exchange()
@@ -129,8 +131,10 @@ class TemplateControllerTest {
webTestClient
.get()
- .uri("/api/v1/template?bpName=$blueprintName&bpVersion=$blueprintVersion" +
- "&artifactName=$templatePrefix&resolutionKey=notFound")
+ .uri(
+ "/api/v1/template?bpName=$blueprintName&bpVersion=$blueprintVersion" +
+ "&artifactName=$templatePrefix&resolutionKey=notFound"
+ )
.exchange()
.expectStatus().isNotFound
}
@@ -151,7 +155,7 @@ class TemplateControllerTest {
private fun get(expectedType: String, resKey: String) {
var requestArguments = "bpName=$blueprintName&bpVersion=$blueprintVersion" +
- "&artifactName=$templatePrefix&resolutionKey=$resKey"
+ "&artifactName=$templatePrefix&resolutionKey=$resKey"
if (expectedType.isNotEmpty()) {
requestArguments = "$requestArguments&format=$expectedType"
@@ -172,4 +176,4 @@ class TemplateControllerTest {
.expectBody().equals(payloadDummyTemplateData)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..0ab3b5b21
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TestDatabaseConfiguration.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.resource.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
index 9f45c0f35..16995247f 100755
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/pom.xml
@@ -34,12 +34,12 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-validation</artifactId>
</dependency>
<!-- For Message libraries -->
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
index b25acd148..305437923 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
@@ -31,16 +31,20 @@ import java.util.concurrent.Phaser
import javax.annotation.PreDestroy
@Service
-open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
- private val executionServiceHandler: ExecutionServiceHandler)
- : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
+open class BluePrintProcessingGRPCHandler(
+ private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
+ private val executionServiceHandler: ExecutionServiceHandler
+) :
+ BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
+
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java)
private val ph = Phaser(1)
@PreAuthorize("hasRole('USER')")
override fun process(
- responseObserver: StreamObserver<ExecutionServiceOutput>): StreamObserver<ExecutionServiceInput> {
+ responseObserver: StreamObserver<ExecutionServiceOutput>
+ ): StreamObserver<ExecutionServiceInput> {
return object : StreamObserver<ExecutionServiceInput> {
override fun onNext(executionServiceInput: ExecutionServiceInput) {
@@ -51,17 +55,18 @@ open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration
}
} catch (e: Exception) {
onError(e)
- }
- finally {
+ } finally {
ph.arriveAndDeregister()
}
}
override fun onError(error: Throwable) {
log.debug("Fail to process message", error)
- responseObserver.onError(io.grpc.Status.INTERNAL
+ responseObserver.onError(
+ io.grpc.Status.INTERNAL
.withDescription(error.message)
- .asException())
+ .asException()
+ )
}
override fun onCompleted() {
@@ -77,4 +82,4 @@ open class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration
ph.arriveAndAwaitAdvance()
log.info("Done waiting in $name")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt
index a9dda7e0c..6293f48f4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumer.kt
@@ -32,12 +32,15 @@ import org.springframework.stereotype.Service
import java.util.concurrent.Phaser
import javax.annotation.PreDestroy
-@ConditionalOnProperty(name = ["blueprintsprocessor.messageconsumer.self-service-api.kafkaEnable"],
- havingValue = "true")
+@ConditionalOnProperty(
+ name = ["blueprintsprocessor.messageconsumer.self-service-api.kafkaEnable"],
+ havingValue = "true"
+)
@Service
open class BluePrintProcessingKafkaConsumer(
- private val bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService,
- private val executionServiceHandler: ExecutionServiceHandler) {
+ private val bluePrintMessageLibPropertyService: BluePrintMessageLibPropertyService,
+ private val executionServiceHandler: ExecutionServiceHandler
+) {
val log = logger(BluePrintProcessingKafkaConsumer::class)
@@ -53,13 +56,15 @@ open class BluePrintProcessingKafkaConsumer(
@EventListener(ApplicationReadyEvent::class)
fun setupMessageListener() = runBlocking {
try {
- log.info("Setting up message consumer($CONSUMER_SELECTOR) and " +
- "message producer($PRODUCER_SELECTOR)...")
+ log.info(
+ "Setting up message consumer($CONSUMER_SELECTOR) and " +
+ "message producer($PRODUCER_SELECTOR)..."
+ )
/** Get the Message Consumer Service **/
blueprintMessageConsumerService = try {
bluePrintMessageLibPropertyService
- .blueprintMessageConsumerService(CONSUMER_SELECTOR)
+ .blueprintMessageConsumerService(CONSUMER_SELECTOR)
} catch (e: Exception) {
throw BluePrintProcessorException("failed to create consumer service ${e.message}")
}
@@ -67,7 +72,7 @@ open class BluePrintProcessingKafkaConsumer(
/** Get the Message Producer Service **/
val blueprintMessageProducerService = try {
bluePrintMessageLibPropertyService
- .blueprintMessageProducerService(PRODUCER_SELECTOR)
+ .blueprintMessageProducerService(PRODUCER_SELECTOR)
} catch (e: Exception) {
throw BluePrintProcessorException("failed to create producer service ${e.message}")
}
@@ -83,34 +88,36 @@ open class BluePrintProcessingKafkaConsumer(
log.trace("Consumed Message : $message")
val executionServiceInput = message.jsonAsType<ExecutionServiceInput>()
val executionServiceOutput = executionServiceHandler.doProcess(executionServiceInput)
- //TODO("In future, Message publisher configuration vary with respect to request")
+ // TODO("In future, Message publisher configuration vary with respect to request")
/** Send the response message */
blueprintMessageProducerService.sendMessage(executionServiceOutput)
} catch (e: Exception) {
log.error("failed in processing the consumed message : $message", e)
- }
- finally {
+ } finally {
ph.arriveAndDeregister()
}
}
}
}
} catch (e: Exception) {
- log.error("failed to start message consumer($CONSUMER_SELECTOR) and " +
- "message producer($PRODUCER_SELECTOR) ", e)
+ log.error(
+ "failed to start message consumer($CONSUMER_SELECTOR) and " +
+ "message producer($PRODUCER_SELECTOR) ", e
+ )
}
}
@PreDestroy
fun shutdownMessageListener() = runBlocking {
try {
- log.info("Shutting down message consumer($CONSUMER_SELECTOR) and " +
- "message producer($PRODUCER_SELECTOR)...")
+ log.info(
+ "Shutting down message consumer($CONSUMER_SELECTOR) and " +
+ "message producer($PRODUCER_SELECTOR)..."
+ )
blueprintMessageConsumerService.shutDown()
ph.arriveAndAwaitAdvance()
} catch (e: Exception) {
log.error("failed to shutdown message listener($CONSUMER_SELECTOR)", e)
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
index 130e23ecc..02d3f2026 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -32,16 +32,23 @@ import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.security.access.prepost.PreAuthorize
-import org.springframework.web.bind.annotation.*
+import org.springframework.web.bind.annotation.RequestBody
+import org.springframework.web.bind.annotation.RequestMapping
+import org.springframework.web.bind.annotation.RequestMethod
+import org.springframework.web.bind.annotation.ResponseBody
+import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Mono
import java.util.concurrent.Phaser
import javax.annotation.PreDestroy
@RestController
@RequestMapping("/api/v1/execution-service")
-@Api(value = "/api/v1/execution-service",
- description = "Interaction with CBA.")
+@Api(
+ value = "/api/v1/execution-service",
+ description = "Interaction with CBA."
+)
open class ExecutionServiceController {
+
val log = logger(ExecutionServiceController::class)
private val ph = Phaser(1)
@@ -49,9 +56,11 @@ open class ExecutionServiceController {
@Autowired
lateinit var executionServiceHandler: ExecutionServiceHandler
- @RequestMapping(path = ["/health-check"],
- method = [RequestMethod.GET],
- produces = [MediaType.APPLICATION_JSON_VALUE])
+ @RequestMapping(
+ path = ["/health-check"],
+ method = [RequestMethod.GET],
+ produces = [MediaType.APPLICATION_JSON_VALUE]
+ )
@ResponseBody
@ApiOperation(value = "Health Check", hidden = true)
fun executionServiceControllerHealthCheck() = monoMdc(Dispatchers.IO) {
@@ -59,15 +68,19 @@ open class ExecutionServiceController {
}
@RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE])
- @ApiOperation(value = "Execute a CBA workflow (action)",
- notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.",
- produces = MediaType.APPLICATION_JSON_VALUE,
- response = ExecutionServiceOutput::class)
+ @ApiOperation(
+ value = "Execute a CBA workflow (action)",
+ notes = "Execute the appropriate CBA's action based on the ExecutionServiceInput object passed as input.",
+ produces = MediaType.APPLICATION_JSON_VALUE,
+ response = ExecutionServiceOutput::class
+ )
@ResponseBody
@PreAuthorize("hasRole('USER')")
- fun process(@ApiParam(value = "ExecutionServiceInput payload.", required = true)
- @RequestBody executionServiceInput: ExecutionServiceInput)
- : Mono<ResponseEntity<ExecutionServiceOutput>> = monoMdc(Dispatchers.IO) {
+ fun process(
+ @ApiParam(value = "ExecutionServiceInput payload.", required = true)
+ @RequestBody executionServiceInput: ExecutionServiceInput
+ ):
+ Mono<ResponseEntity<ExecutionServiceOutput>> = monoMdc(Dispatchers.IO) {
if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) {
throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.")
@@ -87,4 +100,3 @@ open class ExecutionServiceController {
log.info("Done waiting in $name")
}
}
-
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
index 356f0f7ee..9524e375e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
@@ -21,7 +21,11 @@ import io.grpc.stub.StreamObserver
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_SYNC
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.toProto
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractServiceFunction
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
@@ -36,15 +40,19 @@ import org.springframework.stereotype.Service
import java.util.stream.Collectors
@Service
-class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
- private val blueprintsProcessorCatalogService: BluePrintCatalogService,
- private val bluePrintWorkflowExecutionService
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>) {
+class ExecutionServiceHandler(
+ private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val blueprintsProcessorCatalogService: BluePrintCatalogService,
+ private val bluePrintWorkflowExecutionService:
+ BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput>
+) {
private val log = LoggerFactory.getLogger(ExecutionServiceHandler::class.toString())
- suspend fun process(executionServiceInput: ExecutionServiceInput,
- responseObserver: StreamObserver<org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>) {
+ suspend fun process(
+ executionServiceInput: ExecutionServiceInput,
+ responseObserver: StreamObserver<org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>
+ ) {
when {
executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC -> {
GlobalScope.launch(Dispatchers.Default) {
@@ -59,9 +67,13 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
responseObserver.onNext(executionServiceOutput.toProto())
responseObserver.onCompleted()
}
- else -> responseObserver.onNext(response(executionServiceInput,
+ else -> responseObserver.onNext(
+ response(
+ executionServiceInput,
"Failed to process request, 'actionIdentifiers.mode' not specified. Valid value are: 'sync' or 'async'.",
- true).toProto());
+ true
+ ).toProto()
+ )
}
}
@@ -81,8 +93,10 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath.toString())
- val output = bluePrintWorkflowExecutionService.executeBluePrintWorkflow(blueprintRuntimeService,
- executionServiceInput, hashMapOf())
+ val output = bluePrintWorkflowExecutionService.executeBluePrintWorkflow(
+ blueprintRuntimeService,
+ executionServiceInput, hashMapOf()
+ )
val errors = blueprintRuntimeService.getBluePrintError().errors
if (errors.isNotEmpty()) {
@@ -118,8 +132,11 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
status.message = BluePrintConstants.STATUS_FAILURE
}
- private fun response(executionServiceInput: ExecutionServiceInput, errorMessage: String = "",
- failure: Boolean = false): ExecutionServiceOutput {
+ private fun response(
+ executionServiceInput: ExecutionServiceInput,
+ errorMessage: String = "",
+ failure: Boolean = false
+ ): ExecutionServiceOutput {
val executionServiceOutput = ExecutionServiceOutput()
executionServiceOutput.commonHeader = executionServiceInput.commonHeader
executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
@@ -138,5 +155,4 @@ class ExecutionServiceHandler(private val bluePrintLoadConfiguration: BluePrintL
return executionServiceOutput
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
index 16fe36cfe..66cdbef3e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
@@ -22,7 +22,7 @@ import org.springframework.util.StringUtils
import java.io.File
import java.io.IOException
import java.nio.file.Path
-import java.util.*
+import java.util.UUID
const val INTERNAL_SERVER_ERROR_HTTP_STATUS_CODE = 500
@@ -55,8 +55,8 @@ fun determineHttpStatusCode(statusCode: Int): HttpStatus {
try {
return HttpStatus.valueOf(statusCode)
} catch (exception: Exception) {
- //if statusCode cannot be converted to a proper HttpStatus, the resource still needs to assign a HTTP status
+ // if statusCode cannot be converted to a proper HttpStatus, the resource still needs to assign a HTTP status
// code to the response. In this case, a 500 Internal Server Error will be returned as default.
return HttpStatus.valueOf(INTERNAL_SERVER_ERROR_HTTP_STATUS_CODE)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
index ab0d4256c..ff615536b 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorService.kt
@@ -22,6 +22,8 @@ import org.onap.ccsdk.cds.controllerblueprints.validation.extension.ResourceDefi
import org.springframework.stereotype.Service
@Service("bluePrintRuntimeValidatorService")
-open class BluePrintRuntimeValidatorService(bluePrintTypeValidatorService: BluePrintTypeValidatorService,
- resourceDefinitionValidator: ResourceDefinitionValidator)
- : BluePrintDesignTimeValidatorService(bluePrintTypeValidatorService, resourceDefinitionValidator)
+open class BluePrintRuntimeValidatorService(
+ bluePrintTypeValidatorService: BluePrintTypeValidatorService,
+ resourceDefinitionValidator: ResourceDefinitionValidator
+) :
+ BluePrintDesignTimeValidatorService(bluePrintTypeValidatorService, resourceDefinitionValidator)
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index 8bedc9628..af23e7902 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -18,7 +18,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api
-
import com.google.protobuf.util.JsonFormat
import io.grpc.stub.StreamObserver
import io.grpc.testing.GrpcServerRule
@@ -34,20 +33,20 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceIn
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
-import org.springframework.context.annotation.ComponentScan
import org.springframework.test.annotation.DirtiesContext
+import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.BeforeTest
@RunWith(SpringRunner::class)
@DirtiesContext
-@EnableAutoConfiguration
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(
+ classes = [SelfServiceApiTestConfiguration::class, TestDatabaseConfiguration::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {
+
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandlerTest::class.java)
@get:Rule
@@ -67,8 +66,11 @@ class BluePrintProcessingGRPCHandlerTest {
requestObs = blockingStub.process(object : StreamObserver<ExecutionServiceOutput> {
override fun onNext(executionServiceOuput: ExecutionServiceOutput) {
log.debug("onNext {}", executionServiceOuput)
- if ("1234".equals(executionServiceOuput.commonHeader.requestId)) {
- Assert.assertEquals("Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.", executionServiceOuput.status.errorMessage)
+ if ("1234" == executionServiceOuput.commonHeader.requestId) {
+ Assert.assertEquals(
+ "Failed to process request, \'actionIdentifiers.mode\' not specified. Valid value are: \'sync\' or \'async\'.",
+ executionServiceOuput.status.errorMessage
+ )
}
}
@@ -86,39 +88,38 @@ class BluePrintProcessingGRPCHandlerTest {
@Test
fun testSelfServiceGRPCHandler() {
val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("1234")
- .setSubRequestId("1234-56").build()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId("1234")
+ .setSubRequestId("1234-56").build()
val jsonContent = JacksonUtils.getClassPathFileContent("execution-input/sample-payload.json")
val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
JsonFormat.parser().merge(jsonContent, payloadBuilder)
val input = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setPayload(payloadBuilder.build())
- .build()
+ .setCommonHeader(commonHeader)
+ .setPayload(payloadBuilder.build())
+ .build()
requestObs.onNext(input)
val commonHeader2 = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("2345")
- .setSubRequestId("1234-56").build()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId("2345")
+ .setSubRequestId("1234-56").build()
val actionIdentifier = ActionIdentifiers.newBuilder().setMode("sync").build()
val input2 = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader2)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
+ .setCommonHeader(commonHeader2)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
requestObs.onNext(input2)
requestObs.onCompleted()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
index 8971ebde2..b26781ad2 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingIntegrationTest.kt
@@ -36,7 +36,7 @@ class BluePrintProcessingIntegrationTest {
private val log = logger(BluePrintProcessingIntegrationTest::class)
/** This is Integration test sample, Do not enable this test case in server build, this is for local desktop testing*/
- //@Test
+ // @Test
fun integrationTestGrpcManagement() {
runBlocking {
val tokenAuthGrpcClientProperties = TokenAuthGrpcClientProperties().apply {
@@ -65,26 +65,26 @@ class BluePrintProcessingIntegrationTest {
})
val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId("1234-$it")
- .setSubRequestId("1234-56").build()
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId("1234-$it")
+ .setSubRequestId("1234-56").build()
val jsonContent = JacksonUtils.getClassPathFileContent("execution-input/sample-payload.json")
val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
JsonFormat.parser().merge(jsonContent, payloadBuilder)
val actionIdentifier = ActionIdentifiers.newBuilder()
- .setActionName("SampleScript")
- .setBlueprintName("sample-cba")
- .setBlueprintVersion("1.0.0")
- .build()
+ .setActionName("SampleScript")
+ .setBlueprintName("sample-cba")
+ .setBlueprintVersion("1.0.0")
+ .build()
val input = ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
requestObs.onNext(input)
requestObs.onCompleted()
@@ -93,4 +93,4 @@ class BluePrintProcessingIntegrationTest {
channel.shutdownNow()
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
index 01199c131..f71d1b444 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintProcessingKafkaConsumerTest.kt
@@ -34,8 +34,10 @@ import kotlin.test.Test
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintMessageLibConfiguration::class,
- BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class])
+@ContextConfiguration(
+ classes = [BluePrintMessageLibConfiguration::class,
+ BluePrintPropertyConfiguration::class, BluePrintPropertiesService::class]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingKafkaConsumerTest {
@@ -45,15 +47,19 @@ class BluePrintProcessingKafkaConsumerTest {
@Test
fun testExecutionInputMessageConsumer() {
runBlocking {
- assertNotNull(bluePrintMessageLibPropertyService,
- "failed to initialise bluePrintMessageLibPropertyService")
+ assertNotNull(
+ bluePrintMessageLibPropertyService,
+ "failed to initialise bluePrintMessageLibPropertyService"
+ )
val executionServiceHandle = mockk<ExecutionServiceHandler>()
coEvery { executionServiceHandle.doProcess(any()) } returns mockk()
- val bluePrintProcessingKafkaConsumer = BluePrintProcessingKafkaConsumer(bluePrintMessageLibPropertyService,
- executionServiceHandle)
+ val bluePrintProcessingKafkaConsumer = BluePrintProcessingKafkaConsumer(
+ bluePrintMessageLibPropertyService,
+ executionServiceHandle
+ )
launch {
bluePrintProcessingKafkaConsumer.setupMessageListener()
@@ -62,5 +68,4 @@ class BluePrintProcessingKafkaConsumerTest {
bluePrintProcessingKafkaConsumer.shutdownMessageListener()
}
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
index e1a498a6f..a6ebe9c3e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceControllerTest.kt
@@ -36,17 +36,21 @@ import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient
import org.springframework.web.reactive.function.BodyInserters
import java.io.File
-import java.util.*
+import java.util.UUID
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
import kotlin.test.assertTrue
@RunWith(SpringRunner::class)
@WebFluxTest
-@ContextConfiguration(classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
- BluePrintCatalogService::class, SecurityProperties::class])
-@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
- "org.onap.ccsdk.cds.controllerblueprints"])
+@ContextConfiguration(
+ classes = [ExecutionServiceHandler::class, BluePrintCoreConfiguration::class,
+ BluePrintCatalogService::class, SecurityProperties::class]
+)
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor",
+ "org.onap.ccsdk.cds.controllerblueprints"]
+)
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ExecutionServiceControllerTest {
@@ -71,15 +75,17 @@ class ExecutionServiceControllerTest {
blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile("execution-input/default-input.json",
- ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile(
+ "execution-input/default-input.json",
+ ExecutionServiceInput::class.java
+ )!!
webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().isOk
+ .post()
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
+ .exchange()
+ .expectStatus().isOk
}
}
@@ -89,15 +95,17 @@ class ExecutionServiceControllerTest {
blueprintsProcessorCatalogService.saveToDatabase(UUID.randomUUID().toString(), loadTestCbaFile())
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile("execution-input/faulty-input.json",
- ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile(
+ "execution-input/faulty-input.json",
+ ExecutionServiceInput::class.java
+ )!!
webTestClient
- .post()
- .uri("/api/v1/execution-service/process")
- .body(BodyInserters.fromObject(executionServiceInput))
- .exchange()
- .expectStatus().is5xxServerError
+ .post()
+ .uri("/api/v1/execution-service/process")
+ .body(BodyInserters.fromObject(executionServiceInput))
+ .exchange()
+ .expectStatus().is5xxServerError
}
}
@@ -106,4 +114,4 @@ class ExecutionServiceControllerTest {
assertTrue(testCbaFile.exists(), "couldn't get file ${testCbaFile.absolutePath}")
return testCbaFile
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
index 293da0da6..5a44403e1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
@@ -73,12 +73,12 @@ class ExecutionServiceHandlerTest {
@Service("mock-service-action")
class MockServiceAction : AbstractServiceFunction() {
+
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val responsePayload = """{"answer" : "correct"}""".jsonAsJsonType()
setResponsePayloadForAction(responsePayload)
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt
new file mode 100644
index 000000000..98b882934
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/SelfServiceApiTestConfiguration.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.selfservice.api
+
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan(
+ basePackages = ["org.onap.ccsdk.cds.controllerblueprints",
+ "org.onap.ccsdk.cds.blueprintsprocessor"]
+)
+@EnableAutoConfiguration
+open class SelfServiceApiTestConfiguration
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt
new file mode 100644
index 000000000..94da0f574
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/TestDatabaseConfiguration.kt
@@ -0,0 +1,60 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.selfservice.api
+
+import org.onap.ccsdk.cds.blueprintsprocessor.db.BluePrintDBLibConfiguration
+import org.onap.ccsdk.cds.blueprintsprocessor.db.PrimaryDataSourceProperties
+import org.onap.ccsdk.cds.blueprintsprocessor.db.primary.PrimaryDatabaseConfiguration
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Import
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
+import org.springframework.transaction.PlatformTransactionManager
+import javax.sql.DataSource
+
+@Configuration
+@Import(BluePrintDBLibConfiguration::class)
+@EnableJpaRepositories(
+ basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"],
+ entityManagerFactoryRef = "primaryEntityManager",
+ transactionManagerRef = "primaryTransactionManager"
+)
+@EnableJpaAuditing
+open class TestDatabaseConfiguration(primaryDataSourceProperties: PrimaryDataSourceProperties) :
+ PrimaryDatabaseConfiguration(primaryDataSourceProperties) {
+
+ @Bean("primaryEntityManager")
+ open fun primaryEntityManager(): LocalContainerEntityManagerFactoryBean {
+ return primaryEntityManager(
+ "org.onap.ccsdk.cds.blueprintsprocessor.db.primary",
+ "org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution"
+ )
+ }
+
+ @Bean("primaryDataSource")
+ override fun primaryDataSource(): DataSource {
+ return super.primaryDataSource()
+ }
+
+ @Bean("primaryTransactionManager")
+ override fun primaryTransactionManager(): PlatformTransactionManager {
+ return super.primaryTransactionManager()
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
index 27130a7bc..9f5cc6097 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/mock/Mock.kt
@@ -41,8 +41,10 @@ class MockComponentFunction : AbstractComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
log.info("Processing component : $operationInputs")
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- "assignment-params", "params".asJsonPrimitive())
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ nodeTemplateName,
+ "assignment-params", "params".asJsonPrimitive()
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
@@ -51,13 +53,14 @@ class MockComponentFunction : AbstractComponentFunction() {
}
open class MockResourceSource {
- @Bean(name = [
- "rr-processor-source-input",
- "rr-processor-source-default",
- "rr-processor-source-db",
- "rr-processor-source-rest"])
+ @Bean(
+ name = [
+ "rr-processor-source-input",
+ "rr-processor-source-default",
+ "rr-processor-source-db",
+ "rr-processor-source-rest"]
+ )
open fun sourceInstance(): ResourceAssignmentProcessor {
return mockk<ResourceAssignmentProcessor>()
}
-
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/UtilsTest.kt
index 07d8ca4e1..db2791101 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/Utils.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/utils/UtilsTest.kt
@@ -23,5 +23,4 @@ class UtilsTest {
val nonExistentHttpStatusCode = determineHttpStatusCode(999999)
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, nonExistentHttpStatusCode)
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
index 08da9dc28..75d9f487a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/validation/BluePrintRuntimeValidatorServiceTest.kt
@@ -26,8 +26,10 @@ import org.springframework.test.context.junit4.SpringRunner
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintRuntimeValidatorService::class,
- BluePrintValidationConfiguration::class, MockResourceSource::class])
+@ContextConfiguration(
+ classes = [BluePrintRuntimeValidatorService::class,
+ BluePrintValidationConfiguration::class, MockResourceSource::class]
+)
class BluePrintRuntimeValidatorServiceTest {
@Autowired
@@ -35,10 +37,10 @@ class BluePrintRuntimeValidatorServiceTest {
@Test
fun testBlueprintRuntimeValidation() {
- val blueprintBasePath = "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ val blueprintBasePath =
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
assertNotNull(bluePrintRuntimeValidatorService, " failed to initilize bluePrintRuntimeValidatorService")
bluePrintRuntimeValidatorService.validateBluePrints(blueprintBasePath)
-
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/pom.xml b/ms/blueprintsprocessor/modules/pom.xml
index 87dfb5652..821465aa2 100644
--- a/ms/blueprintsprocessor/modules/pom.xml
+++ b/ms/blueprintsprocessor/modules/pom.xml
@@ -33,6 +33,7 @@
<description>Blueprints Processor Modules</description>
<modules>
+ <module>blueprints</module>
<module>commons</module>
<module>outbounds</module>
<module>services</module>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
index f3044c8bb..6ca0bbc04 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/execution-service/pom.xml
@@ -36,8 +36,8 @@
<artifactId>jython-standalone</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
@@ -56,8 +56,8 @@
<artifactId>grpc-lib</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>resource-dict</artifactId>
</dependency>
<dependency>
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index bee919249..e2a594b08 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -17,7 +17,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution
-
import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.withTimeout
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
@@ -25,8 +24,15 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutp
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.getAsString
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonPathParse
+import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.readNBLines
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
import org.slf4j.LoggerFactory
@@ -36,19 +42,20 @@ import org.slf4j.LoggerFactory
* @author Brinda Santh
*/
abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServiceInput, ExecutionServiceOutput> {
+
@Transient
private val log = LoggerFactory.getLogger(AbstractComponentFunction::class.java)
lateinit var executionServiceInput: ExecutionServiceInput
var executionServiceOutput = ExecutionServiceOutput()
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
+ lateinit var implementation: Implementation
lateinit var processId: String
lateinit var workflowName: String
lateinit var stepName: String
lateinit var interfaceName: String
lateinit var operationName: String
lateinit var nodeTemplateName: String
- var timeout: Int = 180
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
override fun getName(): String {
@@ -56,7 +63,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
override suspend fun prepareRequestNB(executionRequest: ExecutionServiceInput): ExecutionServiceInput {
- checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" }
+ check(this::bluePrintRuntimeService.isInitialized) { "failed to prepare blueprint runtime" }
checkNotNull(executionRequest.stepData) { "failed to get step info" }
// Get the Step Name and Step Inputs
@@ -84,14 +91,17 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)
check(operationName.isNotEmpty()) { "couldn't get Operation name for step($stepName)" }
+ /** Get the Implementation Details */
+ implementation = bluePrintRuntimeService.bluePrintContext()
+ .nodeTemplateOperationImplementation(nodeTemplateName, interfaceName, operationName)
+ ?: Implementation()
+ check(this::implementation.isInitialized) { "failed to prepare implementation" }
+
val operationResolvedProperties = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+ .resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
this.operationInputs.putAll(operationResolvedProperties)
- val timeout = this.operationInputs.getOptionalAsInt(BluePrintConstants.PROPERTY_CURRENT_TIMEOUT)
- timeout?.let { this.timeout = timeout }
-
return executionRequest
}
@@ -99,11 +109,11 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
log.info("Preparing Response...")
executionServiceOutput.commonHeader = executionServiceInput.commonHeader
executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
- var status = Status()
+ val status = Status()
try {
// Resolve the Output Expression
val stepOutputs = bluePrintRuntimeService
- .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
+ .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
val stepOutputData = StepData().apply {
name = stepName
@@ -123,7 +133,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
override suspend fun applyNB(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
try {
prepareRequestNB(executionServiceInput)
- withTimeout((timeout * 1000).toLong()) {
+ withTimeout((implementation.timeout * 1000).toLong()) {
processNB(executionServiceInput)
}
} catch (runtimeException: RuntimeException) {
@@ -135,7 +145,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
fun getOperationInput(key: String): JsonNode {
return operationInputs[key]
- ?: throw BluePrintProcessorException("couldn't get the operation input($key) value.")
+ ?: throw BluePrintProcessorException("couldn't get the operation input($key) value.")
}
fun getOptionalOperationInput(key: String): JsonNode? {
@@ -184,9 +194,9 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
suspend fun readLinesFromArtifact(artifactName: String): List<String> {
- val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
+ val artifactDefinition =
+ bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val file = normalizedFile(bluePrintRuntimeService.bluePrintContext().rootPath, artifactDefinition.file)
return file.readNBLines()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
index f17085ef1..041588616 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractScriptComponentFunction.kt
@@ -45,7 +45,7 @@ abstract class AbstractScriptComponentFunction : AbstractComponentFunction() {
@Deprecated("Dependencies will be resolved dynamically")
open fun <T> functionDependencyInstanceAsType(name: String): T {
return functionDependencyInstances[name] as? T
- ?: throw BluePrintProcessorException("couldn't get script property instance ($name)")
+ ?: throw BluePrintProcessorException("couldn't get script property instance ($name)")
}
fun checkDynamicProperties(key: String): Boolean {
@@ -125,4 +125,4 @@ abstract class AbstractScriptComponentFunction : AbstractComponentFunction() {
override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
throw BluePrintException("Not Implemented, child class will implement this")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractServiceFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractServiceFunction.kt
index 67ab9c4de..e573afd7a 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractServiceFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractServiceFunction.kt
@@ -109,4 +109,4 @@ abstract class AbstractServiceFunction : BlueprintFunctionNode<ExecutionServiceI
}
return executionServiceInput.payload.jsonPathParse(".$requestExpression")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
index 062d370bc..4c7d5d0ec 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentFunctionScriptingService.kt
@@ -28,21 +28,29 @@ import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
@Service
-class ComponentFunctionScriptingService(private val applicationContext: ApplicationContext,
- private val blueprintJythonService: BlueprintJythonService) {
+class ComponentFunctionScriptingService(
+ private val applicationContext: ApplicationContext,
+ private val blueprintJythonService: BlueprintJythonService
+) {
private val log = LoggerFactory.getLogger(ComponentFunctionScriptingService::class.java)
- suspend fun <T : AbstractScriptComponentFunction> scriptInstance(componentFunction: AbstractComponentFunction,
- scriptType: String,
- scriptClassReference: String,
- instanceDependencies: List<String>): T {
+ suspend fun <T : AbstractScriptComponentFunction> scriptInstance(
+ componentFunction: AbstractComponentFunction,
+ scriptType: String,
+ scriptClassReference: String,
+ instanceDependencies: List<String>
+ ): T {
- log.info("creating component function of script type($scriptType), reference name($scriptClassReference) and " +
- "instanceDependencies($instanceDependencies)")
+ log.info(
+ "creating component function of script type($scriptType), reference name($scriptClassReference) and " +
+ "instanceDependencies($instanceDependencies)"
+ )
- val scriptComponent: T = scriptInstance(componentFunction.bluePrintRuntimeService.bluePrintContext(),
- scriptType, scriptClassReference)
+ val scriptComponent: T = scriptInstance(
+ componentFunction.bluePrintRuntimeService.bluePrintContext(),
+ scriptType, scriptClassReference
+ )
checkNotNull(scriptComponent) { "failed to initialize script component" }
@@ -60,14 +68,16 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat
// Populate Instance Properties
instanceDependencies.forEach { instanceDependency ->
scriptComponent.functionDependencyInstances[instanceDependency] = applicationContext
- .getBean(instanceDependency)
+ .getBean(instanceDependency)
}
return scriptComponent
}
-
- suspend fun <T : BlueprintFunctionNode<*, *>> scriptInstance(bluePrintContext: BluePrintContext, scriptType: String,
- scriptClassReference: String): T {
+ suspend fun <T : BlueprintFunctionNode<*, *>> scriptInstance(
+ bluePrintContext: BluePrintContext,
+ scriptType: String,
+ scriptClassReference: String
+ ): T {
var scriptComponent: T? = null
when (scriptType) {
@@ -77,8 +87,10 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat
}
BluePrintConstants.SCRIPT_KOTLIN -> {
val bluePrintScriptsService: BluePrintScriptsService = BluePrintScriptsServiceImpl()
- scriptComponent = bluePrintScriptsService.scriptInstance<T>(bluePrintContext.rootPath,
- bluePrintContext.name(), bluePrintContext.version(), scriptClassReference, false)
+ scriptComponent = bluePrintScriptsService.scriptInstance<T>(
+ bluePrintContext.rootPath,
+ bluePrintContext.name(), bluePrintContext.version(), scriptClassReference, false
+ )
}
BluePrintConstants.SCRIPT_JYTHON -> {
scriptComponent = blueprintJythonService.jythonComponentInstance(bluePrintContext, scriptClassReference) as T
@@ -89,5 +101,4 @@ class ComponentFunctionScriptingService(private val applicationContext: Applicat
}
return scriptComponent
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
new file mode 100644
index 000000000..6003cceab
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
@@ -0,0 +1,106 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.services.execution
+
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.asJsonType
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.PayloadUtils
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.createActionIdentifiersProto
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.createCommonHeaderProto
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.createExecutionServiceInputProto
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.springframework.beans.factory.config.ConfigurableBeanFactory
+import org.springframework.context.annotation.Scope
+import org.springframework.stereotype.Component
+import java.util.UUID
+
+/**
+ * This is generic Remote Script Component Executor function
+ * @author Brinda Santh
+ */
+@Component("component-remote-script-executor")
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+open class ComponentRemoteScriptExecutor(
+ private var streamingRemoteExecutionService: StreamingRemoteExecutionService<
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>
+) : AbstractComponentFunction() {
+
+ companion object {
+ const val INPUT_SELECTOR = "selector"
+ const val INPUT_BLUEPRINT_NAME = "blueprint-name"
+ const val INPUT_BLUEPRINT_VERSION = "blueprint-version"
+ const val INPUT_BLUEPRINT_ACTION = "blueprint-action"
+ const val INPUT_TIMEOUT = "timeout"
+ const val INPUT_REQUEST_DATA = "request-data"
+
+ const val ATTRIBUTE_RESPONSE_DATA = "response-data"
+ const val ATTRIBUTE_STATUS = "status"
+
+ const val OUTPUT_STATUS = "status"
+ }
+
+ override suspend fun processNB(executionRequest: ExecutionServiceInput) {
+ val selector = getOperationInput(INPUT_SELECTOR)
+ val blueprintName = getOperationInput(INPUT_BLUEPRINT_NAME).asText()
+ val blueprintVersion = getOperationInput(INPUT_BLUEPRINT_VERSION).asText()
+ val blueprintAction = getOperationInput(INPUT_BLUEPRINT_ACTION).asText()
+ val requestData = getOperationInput(INPUT_REQUEST_DATA)
+ val timeout = getOperationInput(INPUT_TIMEOUT).asLong()
+
+ val requestPayload = PayloadUtils.prepareRequestPayloadStr(blueprintAction, requestData)
+
+ val txId = UUID.randomUUID().toString()
+ val commonHeader = createCommonHeaderProto(
+ executionRequest.commonHeader.subRequestId,
+ txId, BluePrintConstants.APP_NAME
+ )
+ val actionIdentifier = createActionIdentifiersProto(blueprintName, blueprintVersion, blueprintAction)
+
+ val executionServiceInputProto =
+ createExecutionServiceInputProto(commonHeader, actionIdentifier, requestPayload)
+
+ /** Invoke remote implementation using GRPC */
+ val executionServiceOutputProto =
+ streamingRemoteExecutionService.sendNonInteractive(selector, txId, executionServiceInputProto, timeout)
+
+ /** Set the response data */
+ if (executionServiceOutputProto.payload != null) {
+ val outputData = PayloadUtils.getResponseDataFromPayload(
+ blueprintAction,
+ executionServiceOutputProto.payload.asJsonType()
+ )
+ setAttribute(ATTRIBUTE_RESPONSE_DATA, outputData)
+ }
+
+ /** set node template attribute */
+ val statusMessage = executionServiceOutputProto.status.message
+ if (statusMessage == BluePrintConstants.STATUS_SUCCESS) {
+ setAttribute(ATTRIBUTE_STATUS, BluePrintConstants.STATUS_SUCCESS.asJsonPrimitive())
+ } else {
+ val errorMessage = executionServiceOutputProto.status.errorMessage ?: "failed in remote execution"
+ throw BluePrintProcessorException(errorMessage)
+ }
+ }
+
+ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ bluePrintRuntimeService.getBluePrintError()
+ .addError("Failed in ComponentCliExecutor : ${runtimeException.message}")
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt
new file mode 100644
index 000000000..0210e88ea
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt
@@ -0,0 +1,148 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.services.execution
+
+import com.fasterxml.jackson.databind.JsonNode
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
+import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplateOperationImplBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
+
+/** Component Extensions **/
+
+fun BluePrintTypes.nodeTypeComponentRemoteScriptExecutor(): NodeType {
+ return nodeType(
+ id = "component-remote-script-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ description = "Generic Remote Script Component Executor"
+ ) {
+ /** Attribute definitions */
+ attribute(
+ ComponentRemoteScriptExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false,
+ "Remote executed response data."
+ )
+ attribute(
+ ComponentRemoteScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING, true,
+ "Remote execution status."
+ )
+
+ /** Operation definitions */
+ operation("ComponentRemoteScriptExecutor", "ComponentRemoteScriptExecutor Operation") {
+ inputs {
+ property(
+ ComponentRemoteScriptExecutor.INPUT_SELECTOR, BluePrintConstants.DATA_TYPE_JSON,
+ true, "Remote GRPC selector or DSL reference or GRPC Json config."
+ )
+ property(
+ ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_NAME, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Blueprint name."
+ )
+ property(
+ ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_VERSION, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Blueprint version."
+ )
+ property(
+ ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_ACTION, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Blueprint action name."
+ )
+ property(
+ ComponentRemoteScriptExecutor.INPUT_TIMEOUT, BluePrintConstants.DATA_TYPE_INTEGER,
+ true, "Remote execution timeout in sec."
+ ) {
+ defaultValue(180)
+ }
+ property(
+ ComponentRemoteScriptExecutor.INPUT_REQUEST_DATA, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Dynamic Json Content or DSL Json reference."
+ )
+ }
+ outputs {
+ property(
+ ComponentRemoteScriptExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Status of the Component Execution ( success or failure )"
+ )
+ }
+ }
+ }
+}
+
+/** Component Builder */
+fun BluePrintTypes.nodeTemplateComponentRemoteScriptExecutor(
+ id: String,
+ description: String,
+ block: ComponentRemoteScriptExecutorNodeTemplateBuilder.() -> Unit
+):
+ NodeTemplate {
+ return ComponentRemoteScriptExecutorNodeTemplateBuilder(id, description).apply(block).build()
+}
+
+class ComponentRemoteScriptExecutorNodeTemplateBuilder(id: String, description: String) :
+ AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
+ ComponentRemoteScriptExecutorNodeTemplateBuilder.InputsBuilder,
+ ComponentRemoteScriptExecutorNodeTemplateBuilder.OutputsBuilder>(
+ id, "component-remote-script-executor",
+ "ComponentRemoteScriptExecutor",
+ description
+ ) {
+
+ class InputsBuilder : PropertiesAssignmentBuilder() {
+
+ fun selector(selector: String) = selector(selector.asJsonPrimitive())
+
+ fun selector(selector: JsonNode) = property(ComponentRemoteScriptExecutor.INPUT_SELECTOR, selector)
+
+ fun blueprintName(blueprintName: String) = property(
+ ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_NAME,
+ blueprintName.asJsonPrimitive()
+ )
+
+ fun blueprintVersion(blueprintVersion: String) = property(
+ ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_VERSION,
+ blueprintVersion.asJsonPrimitive()
+ )
+
+ fun blueprintAction(blueprintAction: String) = property(
+ ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_ACTION,
+ blueprintAction.asJsonPrimitive()
+ )
+
+ fun timeout(timeout: Int) = property(
+ ComponentRemoteScriptExecutor.INPUT_TIMEOUT,
+ timeout.asJsonPrimitive()
+ )
+
+ fun requestData(requestData: String) = requestData(requestData.asJsonType())
+
+ fun requestData(requestData: JsonNode) {
+ property(ComponentRemoteScriptExecutor.INPUT_REQUEST_DATA, requestData)
+ }
+ }
+
+ class OutputsBuilder : PropertiesAssignmentBuilder() {
+
+ fun status(status: String) = status(status.asJsonPrimitive())
+
+ fun status(status: JsonNode) {
+ property(ComponentRemoteScriptExecutor.OUTPUT_STATUS, status)
+ }
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index c66c3e913..09eee6717 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -28,8 +28,8 @@ import org.springframework.stereotype.Component
*/
@Component("component-script-executor")
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ComponentScriptExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService)
- : AbstractComponentFunction() {
+open class ComponentScriptExecutor(private var componentFunctionScriptingService: ComponentFunctionScriptingService) :
+ AbstractComponentFunction() {
companion object {
const val INPUT_SCRIPT_TYPE = "script-type"
@@ -53,8 +53,10 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
val scriptDependencies: MutableList<String> = arrayListOf()
populateScriptDependencies(scriptDependencies)
- scriptComponentFunction = componentFunctionScriptingService.scriptInstance(this, scriptType,
- scriptClassReference, scriptDependencies)
+ scriptComponentFunction = componentFunctionScriptingService.scriptInstance(
+ this, scriptType,
+ scriptClassReference, scriptDependencies
+ )
// Handles both script processing and error handling
scriptComponentFunction.executeScript(executionServiceInput)
@@ -62,11 +64,10 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
bluePrintRuntimeService.getBluePrintError()
- .addError("Failed in ComponentCliExecutor : ${runtimeException.message}")
-
+ .addError("Failed in ComponentCliExecutor : ${runtimeException.message}")
}
open fun populateScriptDependencies(scriptDependencies: MutableList<String>) {
/** Place holder for Child to add extra dependencies */
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt
index 89338b781..d4ca0f487 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutorDSL.kt
@@ -31,52 +31,72 @@ import kotlin.reflect.KClass
/** Component Extensions **/
fun BluePrintTypes.nodeTypeComponentScriptExecutor(): NodeType {
- return nodeType(id = "component-script-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- description = "Generic Script Component Executor") {
+ return nodeType(
+ id = "component-script-executor", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ description = "Generic Script Component Executor"
+ ) {
attribute(ComponentScriptExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false)
attribute(ComponentScriptExecutor.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING, true)
operation("ComponentScriptExecutor", "ComponentScriptExecutor Operation") {
inputs {
- property(ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING,
- true, "Script Type") {
+ property(
+ ComponentScriptExecutor.INPUT_SCRIPT_TYPE, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Script Type"
+ ) {
defaultValue(BluePrintConstants.SCRIPT_INTERNAL)
constrain {
- validValues(listOf(BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(),
+ validValues(
+ listOf(
+ BluePrintConstants.SCRIPT_INTERNAL.asJsonPrimitive(),
BluePrintConstants.SCRIPT_JYTHON.asJsonPrimitive(),
- BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive()))
+ BluePrintConstants.SCRIPT_KOTLIN.asJsonPrimitive()
+ )
+ )
}
}
- property(ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
- true, "Kotlin Script class name or jython script name.")
- property(ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
- false, "Dynamic Json Content or DSL Json reference.")
+ property(
+ ComponentScriptExecutor.INPUT_SCRIPT_CLASS_REFERENCE, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Kotlin Script class name or jython script name."
+ )
+ property(
+ ComponentScriptExecutor.INPUT_DYNAMIC_PROPERTIES, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Dynamic Json Content or DSL Json reference."
+ )
}
outputs {
- property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
- false, "Output Response")
- property(ComponentScriptExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
- true, "Status of the Component Execution ( success or failure )")
+ property(
+ ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON,
+ false, "Output Response"
+ )
+ property(
+ ComponentScriptExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
+ true, "Status of the Component Execution ( success or failure )"
+ )
}
}
}
}
/** Component Builder */
-fun BluePrintTypes.nodeTemplateComponentScriptExecutor(id: String,
- description: String,
- block: ComponentScriptExecutorNodeTemplateBuilder.() -> Unit)
- : NodeTemplate {
+fun BluePrintTypes.nodeTemplateComponentScriptExecutor(
+ id: String,
+ description: String,
+ block: ComponentScriptExecutorNodeTemplateBuilder.() -> Unit
+):
+ NodeTemplate {
return ComponentScriptExecutorNodeTemplateBuilder(id, description).apply(block).build()
}
class ComponentScriptExecutorNodeTemplateBuilder(id: String, description: String) :
- AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
- ComponentScriptExecutorNodeTemplateBuilder.InputsBuilder,
- ComponentScriptExecutorNodeTemplateBuilder.OutputsBuilder>(id, "component-script-executor",
- "ComponentScriptExecutor",
- description) {
+ AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
+ ComponentScriptExecutorNodeTemplateBuilder.InputsBuilder,
+ ComponentScriptExecutorNodeTemplateBuilder.OutputsBuilder>(
+ id, "component-script-executor",
+ "ComponentScriptExecutor",
+ description
+ ) {
class InputsBuilder : PropertiesAssignmentBuilder() {
@@ -117,4 +137,4 @@ class ComponentScriptExecutorNodeTemplateBuilder(id: String, description: String
property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, responseData)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
index 806c33039..3ff54076d 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ExecutionServiceConfiguration.kt
@@ -23,7 +23,6 @@ import org.springframework.context.annotation.Configuration
@ComponentScan
open class ExecutionServiceConfiguration
-
object ExecutionServiceConstant {
const val SERVICE_GRPC_REMOTE_SCRIPT_EXECUTION = "grpc-remote-script-execution-service"
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
index d6146e111..3b83261e5 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt
@@ -21,10 +21,19 @@ import com.google.protobuf.Struct
import com.google.protobuf.Timestamp
import com.google.protobuf.util.JsonFormat
import io.grpc.ManagedChannel
-import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.PrepareRemoteEnvInput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteIdentifier
+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.grpc.service.BluePrintGrpcClientService
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcLibPropertyService
-import org.onap.ccsdk.cds.controllerblueprints.command.api.*
+import org.onap.ccsdk.cds.controllerblueprints.command.api.CommandExecutorServiceGrpc
+import org.onap.ccsdk.cds.controllerblueprints.command.api.ExecutionInput
+import org.onap.ccsdk.cds.controllerblueprints.command.api.ExecutionOutput
+import org.onap.ccsdk.cds.controllerblueprints.command.api.Identifiers
+import org.onap.ccsdk.cds.controllerblueprints.command.api.Packages
+import org.onap.ccsdk.cds.controllerblueprints.command.api.PrepareEnvInput
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
@@ -41,11 +50,13 @@ interface RemoteScriptExecutionService {
}
@Service(ExecutionServiceConstant.SERVICE_GRPC_REMOTE_SCRIPT_EXECUTION)
-@ConditionalOnProperty(prefix = "blueprintprocessor.remoteScriptCommand", name = arrayOf("enabled"),
- havingValue = "true", matchIfMissing = false)
+@ConditionalOnProperty(
+ prefix = "blueprintprocessor.remoteScriptCommand", name = arrayOf("enabled"),
+ havingValue = "true", matchIfMissing = false
+)
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService)
- : RemoteScriptExecutionService {
+class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService) :
+ RemoteScriptExecutionService {
private val log = LoggerFactory.getLogger(GrpcRemoteScriptExecutionService::class.java)!!
@@ -70,8 +81,8 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
}
}
- override suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput)
- : RemoteScriptExecutionOutput {
+ override suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput):
+ RemoteScriptExecutionOutput {
val grpResponse = commandExecutorServiceGrpc.prepareEnv(prepareEnvInput.asGrpcData())
checkNotNull(grpResponse.status) {
@@ -84,8 +95,8 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
return remoteScriptExecutionOutput
}
- override suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput)
- : RemoteScriptExecutionOutput {
+ override suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput):
+ RemoteScriptExecutionOutput {
val grpResponse = commandExecutorServiceGrpc.executeCommand(remoteExecutionInput.asGrpcData())
@@ -103,7 +114,6 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
channel?.shutdownNow()
}
-
fun PrepareRemoteEnvInput.asGrpcData(): PrepareEnvInput {
val correlationId = this.correlationId ?: this.requestId
@@ -116,33 +126,33 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
}
return PrepareEnvInput.newBuilder()
- .setIdentifiers(this.remoteIdentifier!!.asGrpcData())
- .setRequestId(this.requestId)
- .setCorrelationId(correlationId)
- .setTimeOut(this.timeOut.toInt())
- .addAllPackages(packageList)
- .setProperties(this.properties.asGrpcData())
- .build()
+ .setIdentifiers(this.remoteIdentifier!!.asGrpcData())
+ .setRequestId(this.requestId)
+ .setCorrelationId(correlationId)
+ .setTimeOut(this.timeOut.toInt())
+ .addAllPackages(packageList)
+ .setProperties(this.properties.asGrpcData())
+ .build()
}
fun RemoteScriptExecutionInput.asGrpcData(): ExecutionInput {
val correlationId = this.correlationId ?: this.requestId
return ExecutionInput.newBuilder()
- .setRequestId(this.requestId)
- .setCorrelationId(correlationId)
- .setIdentifiers(this.remoteIdentifier!!.asGrpcData())
- .setCommand(this.command)
- .setTimeOut(this.timeOut.toInt())
- .setProperties(this.properties.asGrpcData())
- .setTimestamp(Timestamp.getDefaultInstance())
- .build()
+ .setRequestId(this.requestId)
+ .setCorrelationId(correlationId)
+ .setIdentifiers(this.remoteIdentifier!!.asGrpcData())
+ .setCommand(this.command)
+ .setTimeOut(this.timeOut.toInt())
+ .setProperties(this.properties.asGrpcData())
+ .setTimestamp(Timestamp.getDefaultInstance())
+ .build()
}
fun RemoteIdentifier.asGrpcData(): Identifiers? {
return Identifiers.newBuilder()
- .setBlueprintName(this.blueprintName)
- .setBlueprintVersion(this.blueprintVersion)
- .build()
+ .setBlueprintName(this.blueprintName)
+ .setBlueprintVersion(this.blueprintVersion)
+ .build()
}
fun Map<String, JsonNode>.asGrpcData(): Struct {
@@ -153,11 +163,10 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi
fun ExecutionOutput.asJavaData(): RemoteScriptExecutionOutput {
return RemoteScriptExecutionOutput(
- requestId = this.requestId,
- response = this.responseList,
- status = StatusType.valueOf(this.status.name),
- payload = payload.jsonAsJsonType()
+ requestId = this.requestId,
+ response = this.responseList,
+ status = StatusType.valueOf(this.status.name),
+ payload = payload.jsonAsJsonType()
)
}
-
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
index adb1d67d2..239ff00c5 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionService.kt
@@ -20,10 +20,14 @@ import com.fasterxml.jackson.databind.JsonNode
import com.github.marcoferrer.krotoplus.coroutines.client.ClientBidiCallChannel
import com.github.marcoferrer.krotoplus.coroutines.client.clientCallBidiStreaming
import io.grpc.ManagedChannel
-import kotlinx.coroutines.*
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.FlowPreview
+import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.consumeAsFlow
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withTimeout
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.GrpcClientProperties
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcClientService
import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcLibPropertyService
@@ -50,10 +54,12 @@ interface StreamingRemoteExecutionService<ReqT, ResT> {
}
@Service
-@ConditionalOnProperty(prefix = "blueprintsprocessor.streamingRemoteExecution", name = ["enabled"],
- havingValue = "true", matchIfMissing = false)
-class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService)
- : StreamingRemoteExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
+@ConditionalOnProperty(
+ prefix = "blueprintsprocessor.streamingRemoteExecution", name = ["enabled"],
+ havingValue = "true", matchIfMissing = false
+)
+class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertyService: BluePrintGrpcLibPropertyService) :
+ StreamingRemoteExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
private val log = logger(StreamingRemoteExecutionServiceImpl::class)
@@ -62,7 +68,6 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
private val commChannels: MutableMap<String,
ClientBidiCallChannel<ExecutionServiceInput, ExecutionServiceOutput>> = hashMapOf()
-
/**
* Open new channel to send and receive for grpc properties [selector] for [txId],
* Create the only one GRPC channel per host port and reuse for further communication.
@@ -84,7 +89,7 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
}
val commChannel = commChannels[txId]
- ?: throw BluePrintException("failed to create response subscription for transactionId($txId) channel")
+ ?: throw BluePrintException("failed to create response subscription for transactionId($txId) channel")
log.info("created subscription for transactionId($txId)")
@@ -97,7 +102,7 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
*/
override suspend fun send(txId: String, input: ExecutionServiceInput) {
val sendChannel = commChannels[txId]?.requestChannel
- ?: throw BluePrintException("failed to get transactionId($txId) send channel")
+ ?: throw BluePrintException("failed to get transactionId($txId) send channel")
coroutineScope {
launch {
sendChannel.send(input)
@@ -114,15 +119,15 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
* so the correlation is sub request id to receive the response.
*/
@ExperimentalCoroutinesApi
- override suspend fun sendNonInteractive(selector: Any, txId: String, input: ExecutionServiceInput, timeOutMill: Long)
- : ExecutionServiceOutput {
+ override suspend fun sendNonInteractive(selector: Any, txId: String, input: ExecutionServiceInput, timeOutMill: Long):
+ ExecutionServiceOutput {
var output: ExecutionServiceOutput? = null
val flow = openSubscription(selector, txId)
/** Send the request */
val sendChannel = commChannels[txId]?.requestChannel
- ?: throw BluePrintException("failed to get transactionId($txId) send channel")
+ ?: throw BluePrintException("failed to get transactionId($txId) send channel")
sendChannel.send(input)
/** Receive the response with timeout */
@@ -145,7 +150,7 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
if (!it.requestChannel.isClosedForSend)
it.requestChannel.close()
/** If receive channel has to close immediately, once the subscription has cancelled, then enable this */
- //it.responseChannel.cancel(CancellationException("subscription cancelled"))
+ // it.responseChannel.cancel(CancellationException("subscription cancelled"))
commChannels.remove(txId)
log.info("closed subscription for transactionId($txId)")
}
@@ -182,7 +187,7 @@ class StreamingRemoteExecutionServiceImpl(private val bluePrintGrpcLibPropertySe
suspend fun createGrpcChannel(grpcProperties: GrpcClientProperties): ManagedChannel {
val grpcClientService: BluePrintGrpcClientService = bluePrintGrpcLibPropertyService
- .blueprintGrpcClientService(grpcProperties)
+ .blueprintGrpcClientService(grpcProperties)
return grpcClientService.channel()
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
index 814054804..dd4c0ec99 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt
@@ -32,13 +32,19 @@ import org.springframework.stereotype.Service
import java.io.File
@Service
-class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty,
- private val applicationContext: ApplicationContext) {
+class BlueprintJythonService(
+ val pythonExecutorProperty: PythonExecutorProperty,
+ private val applicationContext: ApplicationContext
+) {
val log: Logger = LoggerFactory.getLogger(BlueprintJythonService::class.java)
- inline fun <reified T> jythonInstance(blueprintContext: BluePrintContext, pythonClassName: String, content: String,
- dependencyInstanceNames: MutableMap<String, Any>?): T {
+ inline fun <reified T> jythonInstance(
+ blueprintContext: BluePrintContext,
+ pythonClassName: String,
+ content: String,
+ dependencyInstanceNames: MutableMap<String, Any>?
+ ): T {
val blueprintBasePath: String = blueprintContext.rootPath
val pythonPath: MutableList<String> = arrayListOf()
@@ -59,8 +65,8 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty,
BlueprintFunctionNode<*, *> {
val pythonFileName = bluePrintContext.rootPath
- .plus(File.separator)
- .plus(scriptClassReference)
+ .plus(File.separator)
+ .plus(scriptClassReference)
val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
log.info("Getting Jython Script Class($pythonClassName)")
@@ -70,8 +76,10 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty,
val jythonInstances: MutableMap<String, Any> = hashMapOf()
jythonInstances["log"] = LoggerFactory.getLogger(pythonClassName)
- return jythonInstance<BlueprintFunctionNode<*, *>>(bluePrintContext, pythonClassName,
- content, jythonInstances)
+ return jythonInstance<BlueprintFunctionNode<*, *>>(
+ bluePrintContext, pythonClassName,
+ content, jythonInstances
+ )
}
fun jythonComponentInstance(abstractComponentFunction: AbstractComponentFunction): AbstractComponentFunction {
@@ -82,25 +90,27 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty,
val operationInputs: MutableMap<String, JsonNode> = abstractComponentFunction.operationInputs
val operationAssignment: OperationAssignment = bluePrintContext
- .nodeTemplateInterfaceOperation(abstractComponentFunction.nodeTemplateName,
- abstractComponentFunction.interfaceName, abstractComponentFunction.operationName)
+ .nodeTemplateInterfaceOperation(
+ abstractComponentFunction.nodeTemplateName,
+ abstractComponentFunction.interfaceName, abstractComponentFunction.operationName
+ )
val blueprintBasePath: String = bluePrintContext.rootPath
val artifactName: String = operationAssignment.implementation?.primary
- ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
+ ?: throw BluePrintProcessorException("missing primary field to get artifact name for node template ($nodeTemplateName)")
val artifactDefinition = bluePrintRuntimeService.resolveNodeTemplateArtifactDefinition(nodeTemplateName, artifactName)
val pythonFileName = artifactDefinition.file
- ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
+ ?: throw BluePrintProcessorException("missing file name for node template ($nodeTemplateName)'s artifactName($artifactName)")
val pythonClassName = FilenameUtils.getBaseName(pythonFileName)
log.info("Getting Jython Script Class($pythonClassName)")
val content: String? = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName)
- checkNotEmpty(content){ "artifact ($artifactName) content is empty"}
+ checkNotEmpty(content) { "artifact ($artifactName) content is empty" }
val pythonPath: MutableList<String> = operationAssignment.implementation?.dependencies ?: arrayListOf()
pythonPath.add(blueprintBasePath)
@@ -110,17 +120,17 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty,
jythonInstances["log"] = LoggerFactory.getLogger(nodeTemplateName)
val instanceDependenciesNode: ArrayNode = operationInputs[PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES] as? ArrayNode
- ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
+ ?: throw BluePrintProcessorException("Failed to get property(${PythonExecutorConstants.INPUT_INSTANCE_DEPENDENCIES})")
instanceDependenciesNode.forEach { instanceName ->
jythonInstances[instanceName.textValue()] = applicationContext.getBean(instanceName.textValue())
}
- val scriptComponentFunction = jythonInstance<AbstractComponentFunction>(bluePrintContext, pythonClassName,
- content!!, jythonInstances)
+ val scriptComponentFunction = jythonInstance<AbstractComponentFunction>(
+ bluePrintContext, pythonClassName,
+ content!!, jythonInstances
+ )
return scriptComponentFunction
-
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt
index 78b7556f3..b348a9bef 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHost.kt
@@ -19,7 +19,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.python.core.PyObject
import org.python.util.PythonInterpreter
-open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython){
+open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython) {
private val blueprintPythonInterpreterProxy: BlueprintPythonInterpreterProxy
init {
@@ -42,9 +42,9 @@ open class BlueprintPythonHost(private val bluePrintPython: BluePrintPython){
try {
return blueprintPythonInterpreterProxy.getPythonInstance(properties)
} catch (e: Exception) {
- throw BluePrintProcessorException("Failed to execute Jython component ${e.toString()}", e)
+ throw BluePrintProcessorException("Failed to execute Jython component $e", e)
}
}
- //TODO Check potential errors in python scripts
+ // TODO Check potential errors in python scripts
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt
index 6e514de49..6f311bcd2 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonInterpreterProxy.kt
@@ -33,12 +33,13 @@ open class BlueprintPythonInterpreterProxy(private val bluePrintPython: BluePrin
try {
this.exec(bluePrintPython.content)
} catch (e: PySyntaxError) {
- throw BluePrintProcessorException("Error executing Jython code! Python error: '${e.toString()}'", e)
+ throw BluePrintProcessorException("Error executing Jython code! Python error: '$e'", e)
}
}
val initCommand = bluePrintPython.pythonClassName.plus(" = ").plus(
- bluePrintPython.pythonClassName).plus("()")
+ bluePrintPython.pythonClassName
+ ).plus("()")
this.exec(initCommand)
return this.get(bluePrintPython.pythonClassName)
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt
index 658b0c291..0a220948d 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/PythonExecutorConfiguration.kt
@@ -32,6 +32,7 @@ open class PythonExecutorConfiguration
@Configuration
open class PythonExecutorProperty {
+
@Value("\${blueprints.processor.functions.python.executor.executionPath}")
lateinit var executionPath: String
@Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
@@ -44,8 +45,12 @@ class PythonExecutorConstants {
}
}
-open class BluePrintPython(executablePath: String, blueprintPythonPlatform: MutableList<String>,
- val argv: MutableList<String>){
+open class BluePrintPython(
+ executablePath: String,
+ blueprintPythonPlatform: MutableList<String>,
+ val argv: MutableList<String>
+) {
+
lateinit var moduleName: String
lateinit var pythonClassName: String
lateinit var content: String
@@ -65,4 +70,4 @@ open class BluePrintPython(executablePath: String, blueprintPythonPlatform: Muta
props.setProperty("python.verbose", "error")
props.setProperty("python.executable", executablePath)
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
new file mode 100644
index 000000000..2091e0366
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorTest.kt
@@ -0,0 +1,196 @@
+/*
+ * Copyright © 2018-2019 AT&T Intellectual Property.
+ *
+ * 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.blueprintsprocessor.services.execution
+
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.node.ObjectNode
+import io.mockk.coEvery
+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.ACTION_MODE_SYNC
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers
+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.core.utils.createExecutionServiceOutputProto
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.createStatus
+import org.onap.ccsdk.cds.blueprintsprocessor.core.utils.toProto
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
+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.processing.api.ExecutionServiceOutput
+import kotlin.test.assertNotNull
+
+class ComponentRemoteScriptExecutorTest {
+
+ @Test
+ fun testNodeComponentRemoteScriptExecutorType() {
+ val nodeType = BluePrintTypes.nodeTypeComponentRemoteScriptExecutor()
+ assertNotNull(nodeType, "failed to generate nodeType Component Remote Script Executor")
+ }
+
+ @Test
+ fun testNodeTemplateComponentRemoteScriptExecutor() {
+
+ val nodeTemplate = BluePrintTypes.nodeTemplateComponentRemoteScriptExecutor(
+ "remote-sample",
+ "This is sample node template"
+ ) {
+ definedOperation(" Sample Operation") {
+ implementation(180, "SELF")
+ inputs {
+ selector("remote-script-executor")
+ blueprintName("sample")
+ blueprintVersion("1.0.0")
+ blueprintAction("sample-action")
+ timeout(120)
+ requestData("""{"key" :"value"}""")
+ }
+ outputs {
+ status("success")
+ }
+ }
+ }
+ assertNotNull(nodeTemplate, "failed to generate nodeTemplate Component Remote Script Executor")
+ }
+
+ @Test
+ fun testComponentRemoteScriptExecutor() {
+ runBlocking {
+ /** Mock blueprint context */
+ val blueprintContext = mockk<BluePrintContext>()
+ every { blueprintContext.rootPath } returns normalizedPathName("target")
+ every {
+ blueprintContext.nodeTemplateOperationImplementation(
+ "remote-execute", "ComponentRemoteScriptExecutor", "process"
+ )
+ } returns Implementation()
+
+ val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234")
+ every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
+
+ val mockExecutionServiceInput = mockExecutionServiceInput(bluePrintRuntime)
+
+ val mockStreamingRemoteExecutionService = mockk<StreamingRemoteExecutionService<
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput,
+ org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>>()
+
+ coEvery {
+ mockStreamingRemoteExecutionService.sendNonInteractive(
+ any(),
+ any(),
+ any(),
+ any()
+ )
+ } returns mockExecutionServiceOutput(mockExecutionServiceInput)
+
+ val componentRemoteScriptExecutor = ComponentRemoteScriptExecutor(mockStreamingRemoteExecutionService)
+ componentRemoteScriptExecutor.bluePrintRuntimeService = bluePrintRuntime
+ componentRemoteScriptExecutor.implementation = Implementation()
+ val componentRemoteScriptExecutorOutput = componentRemoteScriptExecutor.applyNB(mockExecutionServiceInput)
+ assertNotNull(componentRemoteScriptExecutorOutput, "failed to get executor output")
+ }
+ }
+
+ private fun mockExecutionServiceInput(bluePrintRuntime: DefaultBluePrintRuntimeService): ExecutionServiceInput {
+
+ val mapper = ObjectMapper()
+ val requestNode = mapper.createObjectNode()
+ requestNode.put("ip-address", "0.0.0.0")
+ requestNode.put("type", "grpc")
+
+ val operationInputs = hashMapOf<String, JsonNode>()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = "remote-execute".asJsonPrimitive()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] =
+ "ComponentRemoteScriptExecutor".asJsonPrimitive()
+ operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = "process".asJsonPrimitive()
+
+ operationInputs[ComponentRemoteScriptExecutor.INPUT_SELECTOR] = "remote-script-executor".asJsonPrimitive()
+ operationInputs[ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_NAME] = "sample-blueprint".asJsonPrimitive()
+ operationInputs[ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_VERSION] = "1.0.0".asJsonPrimitive()
+ operationInputs[ComponentRemoteScriptExecutor.INPUT_BLUEPRINT_ACTION] = "remote-activate".asJsonPrimitive()
+ operationInputs[ComponentRemoteScriptExecutor.INPUT_TIMEOUT] = 120.asJsonPrimitive()
+ operationInputs[ComponentRemoteScriptExecutor.INPUT_REQUEST_DATA] = requestNode
+
+ val stepInputData = StepData().apply {
+ name = "remote-execute"
+ properties = operationInputs
+ }
+ val executionServiceInput = ExecutionServiceInput().apply {
+ commonHeader = CommonHeader().apply {
+ requestId = "1234"
+ subRequestId = "1234-123"
+ originatorId = "test-client"
+ }
+ actionIdentifiers = ActionIdentifiers().apply {
+ blueprintName = "sample-blueprint"
+ blueprintVersion = "1.0.0"
+ actionName = "remote-activate"
+ mode = ACTION_MODE_SYNC
+ }
+ payload = """{}""".jsonAsJsonType() as ObjectNode
+ }
+ executionServiceInput.stepData = stepInputData
+
+ every {
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
+ "remote-execute", "ComponentRemoteScriptExecutor", "process"
+ )
+ } returns operationInputs
+
+ /** Mock Set Attributes */
+ every {
+ bluePrintRuntime.setNodeTemplateAttributeValue(
+ "remote-execute", any(), any()
+ )
+ } returns Unit
+
+ val operationOutputs = hashMapOf<String, JsonNode>()
+ every {
+ bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
+ "remote-execute", "ComponentRemoteScriptExecutor", "process"
+ )
+ } returns operationOutputs
+
+ return executionServiceInput
+ }
+
+ private fun mockExecutionServiceOutput(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+ val actionName = executionServiceInput.actionIdentifiers.actionName
+ val responsePayload = """
+ {
+ "$actionName-response" :{
+ "key" : "value"
+ }
+ }
+ """.trimIndent()
+ return createExecutionServiceOutputProto(
+ executionServiceInput.commonHeader.toProto(),
+ executionServiceInput.actionIdentifiers.toProto(),
+ createStatus(BluePrintConstants.STATUS_SUCCESS, 200),
+ responsePayload
+ )
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
index 6bffffdb5..a0eaeca5f 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/MockBluePrintProcessingServer.kt
@@ -31,15 +31,16 @@ import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOu
private val log = logger(MockBluePrintProcessingServer::class)
-
class MockBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
override fun process(responseObserver: StreamObserver<ExecutionServiceOutput>): StreamObserver<ExecutionServiceInput> {
return object : StreamObserver<ExecutionServiceInput> {
override fun onNext(executionServiceInput: ExecutionServiceInput) {
- log.info("Received requestId(${executionServiceInput.commonHeader.requestId}) " +
- "subRequestId(${executionServiceInput.commonHeader.subRequestId})")
+ log.info(
+ "Received requestId(${executionServiceInput.commonHeader.requestId}) " +
+ "subRequestId(${executionServiceInput.commonHeader.subRequestId})"
+ )
runBlocking {
launch(MDCContext()) {
responseObserver.onNext(buildNotification(executionServiceInput))
@@ -52,9 +53,11 @@ class MockBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintPr
override fun onError(error: Throwable) {
log.debug("Fail to process message", error)
- responseObserver.onError(io.grpc.Status.INTERNAL
+ responseObserver.onError(
+ io.grpc.Status.INTERNAL
.withDescription(error.message)
- .asException())
+ .asException()
+ )
}
override fun onCompleted() {
@@ -63,29 +66,27 @@ class MockBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintPr
}
}
-
private fun buildNotification(input: ExecutionServiceInput): ExecutionServiceOutput {
val status = Status.newBuilder()
- .setEventType(EventType.EVENT_COMPONENT_NOTIFICATION)
- .build()
+ .setEventType(EventType.EVENT_COMPONENT_NOTIFICATION)
+ .build()
return ExecutionServiceOutput.newBuilder()
- .setCommonHeader(input.commonHeader)
- .setActionIdentifiers(input.actionIdentifiers)
- .setStatus(status)
- .build()
+ .setCommonHeader(input.commonHeader)
+ .setActionIdentifiers(input.actionIdentifiers)
+ .setStatus(status)
+ .build()
}
private fun buildResponse(input: ExecutionServiceInput): ExecutionServiceOutput {
val status = Status.newBuilder().setCode(200)
- .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
- .build()
+ .setEventType(EventType.EVENT_COMPONENT_EXECUTED)
+ .build()
return ExecutionServiceOutput.newBuilder()
- .setCommonHeader(input.commonHeader)
- .setActionIdentifiers(input.actionIdentifiers)
- .setStatus(status)
- .build()
-
+ .setCommonHeader(input.commonHeader)
+ .setActionIdentifiers(input.actionIdentifiers)
+ .setStatus(status)
+ .build()
}
}
@@ -93,15 +94,14 @@ class MockBluePrintProcessingServer : BluePrintProcessingServiceGrpc.BluePrintPr
fun main() {
try {
val server = ServerBuilder
- .forPort(50052)
- .intercept(GrpcServerLoggingInterceptor())
- .addService(MockBluePrintProcessingServer())
- .build()
+ .forPort(50052)
+ .intercept(GrpcServerLoggingInterceptor())
+ .addService(MockBluePrintProcessingServer())
+ .build()
server.start()
log.info("GRPC Serve started(${server.isShutdown}) on port(${server.port})...")
server.awaitTermination()
} catch (e: Exception) {
e.printStackTrace()
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionServiceTest.kt
index 9a5be0151..28e2b11b2 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/StreamingRemoteExecutionServiceTest.kt
@@ -23,8 +23,13 @@ import io.grpc.testing.GrpcCleanupRule
import io.mockk.coEvery
import io.mockk.mockk
import io.mockk.spyk
-import kotlinx.coroutines.*
+import kotlinx.coroutines.Deferred
+import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.FlowPreview
+import kotlinx.coroutines.async
+import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.runBlocking
import org.junit.Rule
import org.junit.Test
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_SYNC
@@ -37,11 +42,10 @@ import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
import org.onap.ccsdk.cds.controllerblueprints.core.logger
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput
-import java.util.*
+import java.util.UUID
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
-
class StreamingRemoteExecutionServiceTest {
val log = logger(StreamingRemoteExecutionServiceTest::class)
@@ -72,7 +76,7 @@ class StreamingRemoteExecutionServiceTest {
val streamingRemoteExecutionService = StreamingRemoteExecutionServiceImpl(bluePrintGrpcLibPropertyService)
val spyStreamingRemoteExecutionService = spyk(streamingRemoteExecutionService)
- /** To test with real server, uncomment below line */
+ /** To test with real server, comment below line */
coEvery() { spyStreamingRemoteExecutionService.createGrpcChannel(any()) } returns channel
/** Test Send and Receive non interactive transaction */
@@ -82,16 +86,21 @@ class StreamingRemoteExecutionServiceTest {
val request = getRequest(requestId)
val invocationId = request.commonHeader.subRequestId
val deferred = async {
- val response = spyStreamingRemoteExecutionService.sendNonInteractive(tokenAuthGrpcClientProperties,
- invocationId, request, 1000L)
+ val response = spyStreamingRemoteExecutionService.sendNonInteractive(
+ tokenAuthGrpcClientProperties,
+ invocationId, request, 1000L
+ )
assertNotNull(response, "failed to get non interactive response")
- assertEquals(response.commonHeader.requestId, requestId,
- "failed to match non interactive response id")
- assertEquals(response.status.eventType, EventType.EVENT_COMPONENT_EXECUTED,
- "failed to match non interactive response type")
+ assertEquals(
+ response.commonHeader.requestId, requestId,
+ "failed to match non interactive response id"
+ )
+ assertEquals(
+ response.status.eventType, EventType.EVENT_COMPONENT_EXECUTED,
+ "failed to match non interactive response type"
+ )
}
nonInteractiveDeferred.add(deferred)
-
}
nonInteractiveDeferred.awaitAll()
@@ -102,7 +111,7 @@ class StreamingRemoteExecutionServiceTest {
val request = getRequest(requestId)
val invocationId = request.commonHeader.requestId
val responseFlow = spyStreamingRemoteExecutionService
- .openSubscription(tokenAuthGrpcClientProperties, invocationId)
+ .openSubscription(tokenAuthGrpcClientProperties, invocationId)
val deferred = async {
responseFlow.collect {
@@ -119,33 +128,30 @@ class StreamingRemoteExecutionServiceTest {
responseFlowsDeferred.awaitAll()
streamingRemoteExecutionService.closeChannel(tokenAuthGrpcClientProperties)
}
-
}
private fun getRequest(requestId: String): ExecutionServiceInput {
val commonHeader = CommonHeader.newBuilder()
- .setTimestamp("2012-04-23T18:25:43.511Z")
- .setOriginatorId("System")
- .setRequestId(requestId)
- .setSubRequestId("$requestId-" + UUID.randomUUID().toString()).build()
-
+ .setTimestamp("2012-04-23T18:25:43.511Z")
+ .setOriginatorId("System")
+ .setRequestId(requestId)
+ .setSubRequestId("$requestId-" + UUID.randomUUID().toString()).build()
val actionIdentifier = ActionIdentifiers.newBuilder()
- .setActionName("SampleScript")
- .setBlueprintName("sample-cba")
- .setBlueprintVersion("1.0.0")
- .setMode(ACTION_MODE_SYNC)
- .build()
+ .setActionName("SampleScript")
+ .setBlueprintName("sample-cba")
+ .setBlueprintVersion("1.0.0")
+ .setMode(ACTION_MODE_SYNC)
+ .build()
val jsonContent = """{ "key1" : "value1" }"""
val payloadBuilder = ExecutionServiceInput.newBuilder().payloadBuilder
JsonFormat.parser().merge(jsonContent, payloadBuilder)
return ExecutionServiceInput.newBuilder()
- .setCommonHeader(commonHeader)
- .setActionIdentifiers(actionIdentifier)
- .setPayload(payloadBuilder.build())
- .build()
-
+ .setCommonHeader(commonHeader)
+ .setActionIdentifiers(actionIdentifier)
+ .setPayload(payloadBuilder.build())
+ .build()
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
index 2fc9a993b..e013fa889 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts;
+package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
@@ -38,6 +38,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeCompone
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.scripts.BluePrintScriptsServiceImpl
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext
@@ -54,9 +55,11 @@ import kotlin.test.assertNotNull
* Unit test cases for abstract component function.
*/
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [ComponentFunctionScriptingService::class,
- BluePrintScriptsServiceImpl::class, PythonExecutorProperty::class,
- BlueprintJythonService::class])
+@ContextConfiguration(
+ classes = [ComponentFunctionScriptingService::class,
+ BluePrintScriptsServiceImpl::class, PythonExecutorProperty::class,
+ BlueprintJythonService::class]
+)
class AbstractComponentFunctionTest {
lateinit var blueprintContext: BluePrintContext
@@ -68,6 +71,11 @@ class AbstractComponentFunctionTest {
fun init() {
blueprintContext = mockk<BluePrintContext>()
every { blueprintContext.rootPath } returns normalizedPathName("target")
+ every {
+ blueprintContext.nodeTemplateOperationImplementation(
+ any(), any(), any()
+ )
+ } returns Implementation()
}
@Test
@@ -97,7 +105,8 @@ class AbstractComponentFunctionTest {
val sampleComponent = SampleComponent()
sampleComponent.workflowName = "sample-action"
sampleComponent.executionServiceInput = JacksonUtils.readValueFromClassPathFile(
- "payload/requests/sample-execution-request.json", ExecutionServiceInput::class.java)!!
+ "payload/requests/sample-execution-request.json", ExecutionServiceInput::class.java
+ )!!
val payload = sampleComponent.requestPayload()
assertNotNull(payload, "failed to get payload")
val data = sampleComponent.requestPayloadActionProperty("data")?.first()
@@ -144,7 +153,7 @@ class AbstractComponentFunctionTest {
* Mocked input for abstract function test.
*/
private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService):
- ExecutionServiceInput {
+ ExecutionServiceInput {
val mapper = ObjectMapper()
val rootNode = mapper.createObjectNode()
@@ -153,14 +162,13 @@ class AbstractComponentFunctionTest {
val operationInputs = hashMapOf<String, JsonNode>()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] =
- "activate-restconf".asJsonPrimitive()
+ "activate-restconf".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] =
- "interfaceName".asJsonPrimitive()
+ "interfaceName".asJsonPrimitive()
operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] =
- "operationName".asJsonPrimitive()
+ "operationName".asJsonPrimitive()
operationInputs["dynamic-properties"] = rootNode
-
val stepInputData = StepData().apply {
name = "activate-restconf"
properties = operationInputs
@@ -178,13 +186,15 @@ class AbstractComponentFunctionTest {
every {
bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs(
- "activate-restconf", "interfaceName", "operationName")
+ "activate-restconf", "interfaceName", "operationName"
+ )
} returns operationInputs
val operationOutputs = hashMapOf<String, JsonNode>()
every {
bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs(
- "activate-restconf", "interfaceName", "operationName")
+ "activate-restconf", "interfaceName", "operationName"
+ )
} returns operationOutputs
every { bluePrintRuntime.bluePrintContext() } returns blueprintContext
@@ -196,6 +206,4 @@ class AbstractComponentFunctionTest {
val componentScriptExecutor = BluePrintTypes.nodeTypeComponentScriptExecutor()
assertNotNull(componentScriptExecutor.interfaces, "failed to get interface operations")
}
-
}
-
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
index fd18baf52..a34794a85 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonServiceTest.kt
@@ -33,9 +33,11 @@ import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [BlueprintJythonService::class, PythonExecutorProperty::class])
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"])
+@TestPropertySource(
+ properties =
+ ["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"]
+)
class BlueprintJythonServiceTest {
lateinit var blueprintContext: BluePrintContext
@@ -47,26 +49,27 @@ class BlueprintJythonServiceTest {
blueprintContext = mockk<BluePrintContext>()
every { blueprintContext.rootPath } returns normalizedPathName("target")
}
-
+
@Test
fun testGetAbstractPythonPlugin() {
- val content = JacksonUtils.getClassPathFileContent("scripts/SamplePythonComponentNode.py")
- val dependencies: MutableMap<String, Any> = hashMapOf()
+ val content = JacksonUtils.getClassPathFileContent("scripts/SamplePythonComponentNode.py")
+ val dependencies: MutableMap<String, Any> = hashMapOf()
- val abstractPythonPlugin = blueprintJythonService
- .jythonInstance<AbstractComponentFunction>(blueprintContext, "SamplePythonComponentNode",
- content, dependencies)
+ val abstractPythonPlugin = blueprintJythonService
+ .jythonInstance<AbstractComponentFunction>(
+ blueprintContext, "SamplePythonComponentNode",
+ content, dependencies
+ )
- assertNotNull(abstractPythonPlugin, "failed to get python component")
+ assertNotNull(abstractPythonPlugin, "failed to get python component")
}
@Test
fun testGetAbstractJythonComponent() {
- val scriptInstance = "test-classes/scripts/SamplePythonComponentNode.py"
-
- val abstractJythonComponent = blueprintJythonService.jythonComponentInstance(blueprintContext, scriptInstance)
+ val scriptInstance = "test-classes/scripts/SamplePythonComponentNode.py"
- assertNotNull(abstractJythonComponent, "failed to get Jython component")
+ val abstractJythonComponent = blueprintJythonService.jythonComponentInstance(blueprintContext, scriptInstance)
+ assertNotNull(abstractJythonComponent, "failed to get Jython component")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHostTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHostTest.kt
index 3c3efa252..9a93abe0c 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHostTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintPythonHostTest.kt
@@ -16,21 +16,22 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
import org.junit.Test
-
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
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 = [BluePrintPython::class, PythonExecutorProperty::class, String::class])
-@TestPropertySource(properties =
-["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
- "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"])
+@TestPropertySource(
+ properties =
+ ["blueprints.processor.functions.python.executor.modulePaths=./../../../../../components/scripts/python/ccsdk_blueprints",
+ "blueprints.processor.functions.python.executor.executionPath=./../../../../../components/scripts/python/ccsdk_blueprints"]
+)
class BlueprintPythonHostTest {
lateinit var blueprintPythonHost: BlueprintPythonHost
@@ -59,4 +60,4 @@ class BlueprintPythonHostTest {
assertNotNull(pythonObject, "failed to get python object")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
index 000d8c09b..31b1a59c8 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt
@@ -18,21 +18,18 @@
* ============LICENSE_END=========================================================
*/
-
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() {
val log = LoggerFactory.getLogger(SampleComponent::class.java)!!
-
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
}
@@ -40,20 +37,21 @@ open class SampleComponent : AbstractComponentFunction() {
}
}
-open class SampleRestconfComponent (private var componentFunctionScriptingService: ComponentFunctionScriptingService)
- : 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())
+ .scriptInstance<AbstractScriptComponentFunction>(
+ this,
+ "internal",
+ "org.onap.ccsdk.cds.blueprintsprocessor.services" +
+ ".execution.scripts.SampleTest",
+ mutableListOf()
+ )
scriptComponent.executeScript(executionServiceInput)
}
@@ -65,11 +63,9 @@ 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) {
}
-} \ No newline at end of file
+}
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
index 6a95e29e7..b10f08dd4 100644
--- 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
@@ -29,7 +29,6 @@ open class SampleTest : AbstractScriptComponentFunction() {
val log = LoggerFactory.getLogger(SampleTest::class.java)!!
-
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val isPresent = checkDynamicProperties("type")
assertTrue(isPresent)
@@ -39,4 +38,4 @@ open class SampleTest : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
index fe7dde994..582475dd6 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -31,8 +31,8 @@
<dependencies>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
index cde919ce8..492b0ba44 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImpl.kt
@@ -29,23 +29,25 @@ import org.springframework.stereotype.Service
@Service("bluePrintWorkflowExecutionService")
open class BluePrintWorkflowExecutionServiceImpl(
- private val componentWorkflowExecutionService: ComponentWorkflowExecutionService,
- private val dgWorkflowExecutionService: DGWorkflowExecutionService,
- private val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService
+ private val componentWorkflowExecutionService: ComponentWorkflowExecutionService,
+ private val dgWorkflowExecutionService: DGWorkflowExecutionService,
+ private val imperativeWorkflowExecutionService: ImperativeWorkflowExecutionService
) : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
private val log = LoggerFactory.getLogger(BluePrintWorkflowExecutionServiceImpl::class.java)!!
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
+ override suspend fun executeBluePrintWorkflow(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ executionServiceInput: ExecutionServiceInput,
+ properties: MutableMap<String, Any>
+ ): ExecutionServiceOutput {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
val workflowName = executionServiceInput.actionIdentifiers.actionName
// Assign Workflow inputs
- //check if request structure exists
+ // check if request structure exists
if (!executionServiceInput.payload.has("$workflowName-request")) {
throw BluePrintProcessorException("Input request missing the expected '$workflowName-request' block!")
}
@@ -59,7 +61,7 @@ open class BluePrintWorkflowExecutionServiceImpl(
/** If workflow has multiple steps, then it is imperative workflow */
val executionServiceOutput: ExecutionServiceOutput = if (steps.size > 1) {
imperativeWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
} else {
// Get the DG Node Template
val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
@@ -71,15 +73,17 @@ open class BluePrintWorkflowExecutionServiceImpl(
when {
derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> {
componentWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
}
derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW, true) -> {
dgWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, properties)
}
else -> {
- throw BluePrintProcessorException("couldn't execute workflow($workflowName) step mapped " +
- "to node template($nodeTemplateName) derived from($derivedFrom)")
+ throw BluePrintProcessorException(
+ "couldn't execute workflow($workflowName) step mapped " +
+ "to node template($nodeTemplateName) derived from($derivedFrom)"
+ )
}
}
}
@@ -93,5 +97,4 @@ open class BluePrintWorkflowExecutionServiceImpl(
executionServiceOutput.payload.set("$workflowName-response", workflowOutputs.asObjectNode())
return executionServiceOutput
}
-
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
index a2db8aab7..044e8cf53 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
@@ -48,5 +48,4 @@ class BlueprintSvcLogicContext : SvcLogicContext() {
fun getResponse(): Any {
return this.response!!
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
index df250ae98..9cc325d94 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
@@ -18,14 +18,25 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
-import org.onap.ccsdk.sli.core.sli.*
-import org.onap.ccsdk.sli.core.sli.provider.base.*
+import org.onap.ccsdk.sli.core.sli.ExitNodeException
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext
+import org.onap.ccsdk.sli.core.sli.SvcLogicException
+import org.onap.ccsdk.sli.core.sli.SvcLogicGraph
+import org.onap.ccsdk.sli.core.sli.SvcLogicNode
+import org.onap.ccsdk.sli.core.sli.SvcLogicStore
+import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.BlockNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.BreakNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.ExitNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.ReturnNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase
import org.slf4j.LoggerFactory
import org.slf4j.MDC
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.stereotype.Service
-import java.util.*
+import java.util.Properties
import javax.annotation.PostConstruct
interface BlueprintSvcLogicService : SvcLogicServiceBase {
@@ -54,7 +65,6 @@ interface BlueprintSvcLogicService : SvcLogicServiceBase {
}
}
-
@Service
class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
@@ -88,9 +98,12 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
}
}
- override suspend fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- input: Any): Any {
- //Initialise BlueprintSvcLogic Context with Blueprint Runtime Service and Input Request
+ override suspend fun execute(
+ graph: SvcLogicGraph,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ input: Any
+ ): Any {
+ // Initialise BlueprintSvcLogic Context with Blueprint Runtime Service and Input Request
val blueprintSvcLogicContext = BlueprintSvcLogicContext()
blueprintSvcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
blueprintSvcLogicContext.setRequest(input)
@@ -140,4 +153,4 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
MDC.remove("currentGraph")
return svcLogicContext
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
index 3c474de37..70910e15c 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow
-
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
@@ -24,12 +23,14 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.springframework.stereotype.Service
@Service("componentWorkflowExecutionService")
-open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionService: NodeTemplateExecutionService)
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
+open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionService: NodeTemplateExecutionService) :
+ BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
+ override suspend fun executeBluePrintWorkflow(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ executionServiceInput: ExecutionServiceInput,
+ properties: MutableMap<String, Any>
+ ): ExecutionServiceOutput {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
@@ -38,8 +39,9 @@ open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionSe
// Get the DG Node Template
val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
- return nodeTemplateExecutionService.executeNodeTemplate(bluePrintRuntimeService,
- nodeTemplateName, executionServiceInput)
+ return nodeTemplateExecutionService.executeNodeTemplate(
+ bluePrintRuntimeService,
+ nodeTemplateName, executionServiceInput
+ )
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
index 4485800ff..b1847df43 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
@@ -26,16 +26,17 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
-
@Service("dgWorkflowExecutionService")
-open class DGWorkflowExecutionService(private val blueprintSvcLogicService: BlueprintSvcLogicService)
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
+open class DGWorkflowExecutionService(private val blueprintSvcLogicService: BlueprintSvcLogicService) :
+ BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
private val log = LoggerFactory.getLogger(DGWorkflowExecutionService::class.java)
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
+ override suspend fun executeBluePrintWorkflow(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ executionServiceInput: ExecutionServiceInput,
+ properties: MutableMap<String, Any>
+ ): ExecutionServiceOutput {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
@@ -47,8 +48,10 @@ open class DGWorkflowExecutionService(private val blueprintSvcLogicService: Blue
log.info("Executing workflow($workflowName) directed graph NodeTemplate($nodeTemplateName)")
// Get the DG file info
- val artifactDefinition = bluePrintContext.nodeTemplateArtifactForArtifactType(nodeTemplateName,
- WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH)
+ val artifactDefinition = bluePrintContext.nodeTemplateArtifactForArtifactType(
+ nodeTemplateName,
+ WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH
+ )
// Populate the DG Path
val dgFilePath = normalizedPathName(bluePrintContext.rootPath, artifactDefinition.file)
@@ -59,10 +62,10 @@ open class DGWorkflowExecutionService(private val blueprintSvcLogicService: Blue
val graph = SvcGraphUtils.getSvcGraphFromFile(dgFilePath)
// Execute the DG
- return blueprintSvcLogicService.execute(graph,
+ return blueprintSvcLogicService.execute(
+ graph,
bluePrintRuntimeService,
- executionServiceInput) as ExecutionServiceOutput
-
+ executionServiceInput
+ ) as ExecutionServiceOutput
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
index d296ec6e6..ebd9d553d 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
@@ -21,23 +21,35 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInpu
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType
-import org.onap.ccsdk.cds.controllerblueprints.core.*
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.cds.controllerblueprints.core.asGraph
+import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.data.EdgeLabel
import org.onap.ccsdk.cds.controllerblueprints.core.data.Graph
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintWorkflowExecutionService
-import org.onap.ccsdk.cds.controllerblueprints.core.service.*
+import org.onap.ccsdk.cds.controllerblueprints.core.logger
+import org.onap.ccsdk.cds.controllerblueprints.core.service.AbstractBluePrintWorkFlowService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintWorkFlowService
+import org.onap.ccsdk.cds.controllerblueprints.core.service.NodeExecuteMessage
+import org.onap.ccsdk.cds.controllerblueprints.core.service.NodeSkipMessage
+import org.onap.ccsdk.cds.controllerblueprints.core.service.WorkflowExecuteMessage
import org.springframework.beans.factory.config.ConfigurableBeanFactory
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Service
@Service("imperativeWorkflowExecutionService")
class ImperativeWorkflowExecutionService(
- private val imperativeBluePrintWorkflowService: BluePrintWorkFlowService<ExecutionServiceInput, ExecutionServiceOutput>)
- : BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
+ private val imperativeBluePrintWorkflowService: BluePrintWorkFlowService<ExecutionServiceInput, ExecutionServiceOutput>
+) :
+ BluePrintWorkflowExecutionService<ExecutionServiceInput, ExecutionServiceOutput> {
- override suspend fun executeBluePrintWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>,
- executionServiceInput: ExecutionServiceInput,
- properties: MutableMap<String, Any>): ExecutionServiceOutput {
+ override suspend fun executeBluePrintWorkflow(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ executionServiceInput: ExecutionServiceInput,
+ properties: MutableMap<String, Any>
+ ): ExecutionServiceOutput {
val bluePrintContext = bluePrintRuntimeService.bluePrintContext()
@@ -45,23 +57,29 @@ class ImperativeWorkflowExecutionService(
val graph = bluePrintContext.workflowByName(workflowName).asGraph()
- return imperativeBluePrintWorkflowService.executeWorkflow(graph, bluePrintRuntimeService,
- executionServiceInput)
+ return imperativeBluePrintWorkflowService.executeWorkflow(
+ graph, bluePrintRuntimeService,
+ executionServiceInput
+ )
}
}
@Service
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionService: NodeTemplateExecutionService)
- : AbstractBluePrintWorkFlowService<ExecutionServiceInput, ExecutionServiceOutput>() {
+open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionService: NodeTemplateExecutionService) :
+ AbstractBluePrintWorkFlowService<ExecutionServiceInput, ExecutionServiceOutput>() {
+
val log = logger(ImperativeBluePrintWorkflowService::class)
lateinit var bluePrintRuntimeService: BluePrintRuntimeService<*>
lateinit var executionServiceInput: ExecutionServiceInput
lateinit var workflowName: String
- override suspend fun executeWorkflow(graph: Graph, bluePrintRuntimeService: BluePrintRuntimeService<*>,
- input: ExecutionServiceInput): ExecutionServiceOutput {
+ override suspend fun executeWorkflow(
+ graph: Graph,
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ input: ExecutionServiceInput
+ ): ExecutionServiceOutput {
this.graph = graph
this.bluePrintRuntimeService = bluePrintRuntimeService
this.executionServiceInput = input
@@ -103,8 +121,8 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
}
}
- override suspend fun prepareNodeExecutionMessage(node: Graph.Node)
- : NodeExecuteMessage<ExecutionServiceInput, ExecutionServiceOutput> {
+ override suspend fun prepareNodeExecutionMessage(node: Graph.Node):
+ NodeExecuteMessage<ExecutionServiceInput, ExecutionServiceOutput> {
val nodeOutput = ExecutionServiceOutput().apply {
commonHeader = executionServiceInput.commonHeader
actionIdentifiers = executionServiceInput.actionIdentifiers
@@ -112,8 +130,8 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
return NodeExecuteMessage(node, executionServiceInput, nodeOutput)
}
- override suspend fun prepareNodeSkipMessage(node: Graph.Node)
- : NodeSkipMessage<ExecutionServiceInput, ExecutionServiceOutput> {
+ override suspend fun prepareNodeSkipMessage(node: Graph.Node):
+ NodeSkipMessage<ExecutionServiceInput, ExecutionServiceOutput> {
val nodeOutput = ExecutionServiceOutput().apply {
commonHeader = executionServiceInput.commonHeader
actionIdentifiers = executionServiceInput.actionIdentifiers
@@ -121,15 +139,18 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
return NodeSkipMessage(node, executionServiceInput, nodeOutput)
}
- override suspend fun executeNode(node: Graph.Node, nodeInput: ExecutionServiceInput,
- nodeOutput: ExecutionServiceOutput): EdgeLabel {
+ override suspend fun executeNode(
+ node: Graph.Node,
+ nodeInput: ExecutionServiceInput,
+ nodeOutput: ExecutionServiceOutput
+ ): EdgeLabel {
log.info("Executing workflow($workflowName[${this.workflowId}])'s step($${node.id})")
val step = bluePrintRuntimeService.bluePrintContext().workflowStepByName(this.workflowName, node.id)
checkNotEmpty(step.target) { "couldn't get step target for workflow(${this.workflowName})'s step(${node.id})" }
val nodeTemplateName = step.target!!
/** execute node template */
val executionServiceOutput = nodeTemplateExecutionService
- .executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeInput)
+ .executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeInput)
return when (executionServiceOutput.status.message) {
BluePrintConstants.STATUS_FAILURE -> EdgeLabel.FAILURE
@@ -137,18 +158,27 @@ open class ImperativeBluePrintWorkflowService(private val nodeTemplateExecutionS
}
}
- override suspend fun skipNode(node: Graph.Node, nodeInput: ExecutionServiceInput,
- nodeOutput: ExecutionServiceOutput): EdgeLabel {
+ override suspend fun skipNode(
+ node: Graph.Node,
+ nodeInput: ExecutionServiceInput,
+ nodeOutput: ExecutionServiceOutput
+ ): EdgeLabel {
return EdgeLabel.SUCCESS
}
- override suspend fun cancelNode(node: Graph.Node, nodeInput: ExecutionServiceInput,
- nodeOutput: ExecutionServiceOutput): EdgeLabel {
+ override suspend fun cancelNode(
+ node: Graph.Node,
+ nodeInput: ExecutionServiceInput,
+ nodeOutput: ExecutionServiceOutput
+ ): EdgeLabel {
TODO("not implemented")
}
- override suspend fun restartNode(node: Graph.Node, nodeInput: ExecutionServiceInput,
- nodeOutput: ExecutionServiceOutput): EdgeLabel {
+ override suspend fun restartNode(
+ node: Graph.Node,
+ nodeInput: ExecutionServiceInput,
+ nodeOutput: ExecutionServiceOutput
+ ): EdgeLabel {
TODO("not implemented")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
index b64177aab..6a304e0c7 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
@@ -23,6 +23,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.cds.controllerblueprints.core.data.Implementation
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
import org.slf4j.LoggerFactory
@@ -33,8 +34,11 @@ open class NodeTemplateExecutionService {
private val log = LoggerFactory.getLogger(NodeTemplateExecutionService::class.java)!!
- suspend fun executeNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, nodeTemplateName: String,
- executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+ suspend fun executeNodeTemplate(
+ bluePrintRuntimeService: BluePrintRuntimeService<*>,
+ nodeTemplateName: String,
+ executionServiceInput: ExecutionServiceInput
+ ): ExecutionServiceOutput {
// Get the Blueprint Context
val blueprintContext = bluePrintRuntimeService.bluePrintContext()
@@ -47,12 +51,14 @@ open class NodeTemplateExecutionService {
val operationName = blueprintContext.nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName)
val nodeTemplateImplementation = blueprintContext
- .nodeTemplateOperationImplementation(nodeTemplateName, interfaceName, operationName)
+ .nodeTemplateOperationImplementation(nodeTemplateName, interfaceName, operationName)
+ ?: Implementation()
- val timeout: Int = nodeTemplateImplementation?.timeout ?: 180
-
- log.info("executing node template($nodeTemplateName) component($componentName) " +
- "interface($interfaceName) operation($operationName) with timeout($timeout) sec.")
+ log.info(
+ "executing node template($nodeTemplateName) component($componentName) " +
+ "interface($interfaceName) operation($operationName) on host (${nodeTemplateImplementation.operationHost}) " +
+ "with timeout(${nodeTemplateImplementation.timeout}) sec."
+ )
// Get the Component Instance
val plugin = BluePrintDependencyService.instance<AbstractComponentFunction>(componentName)
@@ -72,7 +78,6 @@ open class NodeTemplateExecutionService {
stepInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = nodeTemplateName.asJsonPrimitive()
stepInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = interfaceName.asJsonPrimitive()
stepInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = operationName.asJsonPrimitive()
- stepInputs[BluePrintConstants.PROPERTY_CURRENT_TIMEOUT] = timeout.asJsonPrimitive()
val stepInputData = StepData().apply {
name = nodeTemplateName
properties = stepInputs
@@ -82,5 +87,4 @@ open class NodeTemplateExecutionService {
// Get the Request from the Context and Set to the Function Input and Invoke the function
return plugin.applyNB(clonedExecutionServiceInput)
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
index 67f13f760..c1bcc649f 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
@@ -23,9 +23,8 @@ import org.springframework.context.annotation.Configuration
@ComponentScan
open class WorkflowServiceConfiguration
-
class WorkflowServiceConstants {
companion object {
const val ARTIFACT_TYPE_DIRECTED_GRAPH = "artifact-directed-graph"
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index b6e767503..8c4e2d215 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -31,14 +31,14 @@ import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@Service
-open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService: NodeTemplateExecutionService)
- : ExecuteNodeExecutor() {
+open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService: NodeTemplateExecutionService) :
+ ExecuteNodeExecutor() {
private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
@Throws(SvcLogicException::class)
- override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext)
- : SvcLogicNode = runBlocking {
+ override fun execute(svc: SvcLogicServiceBase, node: SvcLogicNode, svcLogicContext: SvcLogicContext):
+ SvcLogicNode = runBlocking {
var outValue: String
@@ -48,15 +48,16 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService
val executionInput = ctx.getRequest() as ExecutionServiceInput
- try { // Get the Request from the Context and Set to the Function Input and Invoke the function
- val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(ctx.getBluePrintService(),
- nodeTemplateName, executionInput)
+ try { // Get the Request from the Context and Set to the Function Input and Invoke the function
+ val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
+ ctx.getBluePrintService(),
+ nodeTemplateName, executionInput
+ )
ctx.setResponse(executionOutput)
outValue = executionOutput.status.message
ctx.status = executionOutput.status.message
-
} catch (e: Exception) {
log.error("Could not execute plugin($nodeTemplateName) : ", e)
outValue = "failure"
@@ -65,5 +66,4 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService
getNextNode(node, outValue)
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
index 8f9579230..86934f29a 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
@@ -32,4 +32,4 @@ object SvcGraphUtils {
val svcLogicParser = SvcLogicParser()
return svcLogicParser.parse(fileName).first
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
index 436de1b56..330056221 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BluePrintWorkflowExecutionServiceImplTest.kt
@@ -40,7 +40,6 @@ import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
-
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = [WorkflowServiceConfiguration::class])
class BluePrintWorkflowExecutionServiceImplTest {
@@ -62,36 +61,48 @@ class BluePrintWorkflowExecutionServiceImplTest {
@Test
fun testBluePrintWorkflowExecutionService() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json",
- ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
+ "execution-input/resource-assignment-input.json",
+ ExecutionServiceInput::class.java
+ )!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
- assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ assertEquals(
+ BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ "failed to get successful response"
+ )
}
}
@Test
fun testImperativeBluePrintWorkflowExecutionService() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/imperative-test-input.json",
- ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
+ "execution-input/imperative-test-input.json",
+ ExecutionServiceInput::class.java
+ )!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
- assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ assertEquals(
+ BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ "failed to get successful response"
+ )
}
}
@@ -99,16 +110,20 @@ class BluePrintWorkflowExecutionServiceImplTest {
fun `Blueprint fails on missing workflowName-parameters with a useful message`() {
assertFailsWith(exceptionClass = BluePrintProcessorException::class) {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
- //service input will have a mislabeled input params, we are expecting to get an error when that happens with a useful error message
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input-missing-resource_assignment_request.json",
- ExecutionServiceInput::class.java)!!
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
+ // service input will have a mislabeled input params, we are expecting to get an error when that happens with a useful error message
+ val executionServiceInput =
+ JacksonUtils.readValueFromClassPathFile(
+ "execution-input/resource-assignment-input-missing-resource_assignment_request.json",
+ ExecutionServiceInput::class.java
+ )!!
val executionServiceOutput = bluePrintWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
}
}
}
-
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
index 12fd9c7c4..3d44894ee 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
@@ -54,47 +54,51 @@ class BlueprintServiceLogicTest {
@Test
fun testExecuteGraphWithSingleComponent() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput = JacksonReactorUtils
- .readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
// Assign Workflow inputs Mock
val input = executionServiceInput.payload.get("resource-assignment-request")
bluePrintRuntimeService.assignWorkflowInputs("resource-assignment", input)
val executionServiceOutput = dgWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
- assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ assertEquals(
+ BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ "failed to get successful response"
+ )
}
-
-
}
@Test
fun testExecuteGraphWithMultipleComponents() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput = JacksonReactorUtils
- .readValueFromClassPathFile("execution-input/assign-activate-input.json", ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile("execution-input/assign-activate-input.json", ExecutionServiceInput::class.java)!!
// Assign Workflow inputs Mock
val input = executionServiceInput.payload.get("assign-activate-request")
bluePrintRuntimeService.assignWorkflowInputs("assign-activate", input)
-
val executionServiceOutput = dgWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, mutableMapOf())
assertNotNull(executionServiceOutput, "failed to get response")
- assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ assertEquals(
+ BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ "failed to get successful response"
+ )
}
-
}
@Test
@@ -118,5 +122,4 @@ class BlueprintServiceLogicTest {
assertEquals(stepName1, proto1.stepName, " Failed to match the step1 name")
assertEquals(stepName2, proto2.stepName, " Failed to match the step2 name")
}
-
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
index 3ac5cd864..86d3be26b 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionServiceTest.kt
@@ -44,7 +44,6 @@ class DGWorkflowExecutionServiceTest {
@Autowired
lateinit var dgWorkflowExecutionService: DGWorkflowExecutionService
-
@Before
fun init() {
BluePrintDependencyService.inject(applicationContext)
@@ -54,25 +53,28 @@ class DGWorkflowExecutionServiceTest {
fun testExecuteDirectedGraph() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
val executionServiceInput = JacksonReactorUtils
- .readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
// Assign Workflow inputs Mock
val input = executionServiceInput.payload.get("resource-assignment-request")
bluePrintRuntimeService.assignWorkflowInputs("resource-assignment", input)
- val executionServiceOutput = dgWorkflowExecutionService.executeBluePrintWorkflow(bluePrintRuntimeService,
- executionServiceInput, mutableMapOf())
+ val executionServiceOutput = dgWorkflowExecutionService.executeBluePrintWorkflow(
+ bluePrintRuntimeService,
+ executionServiceInput, mutableMapOf()
+ )
assertNotNull(executionServiceOutput, "failed to get response")
- assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ assertEquals(
+ BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ "failed to get successful response"
+ )
}
-
}
-
-
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
index b7fcae1d1..415f11d58 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionServiceTest.kt
@@ -56,18 +56,36 @@ class ImperativeWorkflowExecutionServiceTest {
}
fun mockServiceTemplate(): ServiceTemplate {
- return serviceTemplate("imperative-test", "1.0.0",
- "brindasanth@onap.com", "tosca") {
+ return serviceTemplate(
+ "imperative-test", "1.0.0",
+ "brindasanth@onap.com", "tosca"
+ ) {
topologyTemplate {
- nodeTemplate(mockNodeTemplateComponentScriptExecutor("resolve-config",
- "cba.wt.imperative.test.ResolveConfig"))
- nodeTemplate(mockNodeTemplateComponentScriptExecutor("activate-config",
- "cba.wt.imperative.test.ActivateConfig"))
- nodeTemplate(mockNodeTemplateComponentScriptExecutor("activate-config-rollback",
- "cba.wt.imperative.test.ActivateConfigRollback"))
- nodeTemplate(mockNodeTemplateComponentScriptExecutor("activate-licence",
- "cba.wt.imperative.test.ActivateLicence"))
+ nodeTemplate(
+ mockNodeTemplateComponentScriptExecutor(
+ "resolve-config",
+ "cba.wt.imperative.test.ResolveConfig"
+ )
+ )
+ nodeTemplate(
+ mockNodeTemplateComponentScriptExecutor(
+ "activate-config",
+ "cba.wt.imperative.test.ActivateConfig"
+ )
+ )
+ nodeTemplate(
+ mockNodeTemplateComponentScriptExecutor(
+ "activate-config-rollback",
+ "cba.wt.imperative.test.ActivateConfigRollback"
+ )
+ )
+ nodeTemplate(
+ mockNodeTemplateComponentScriptExecutor(
+ "activate-licence",
+ "cba.wt.imperative.test.ActivateLicence"
+ )
+ )
workflow("imperative-test-wf", "Test Imperative flow") {
step("resolve-config", "resolve-config", "") {
@@ -95,17 +113,19 @@ class ImperativeWorkflowExecutionServiceTest {
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("12345", bluePrintContext)
val executionServiceInput = JacksonUtils
- .readValueFromClassPathFile("execution-input/imperative-test-input.json",
- ExecutionServiceInput::class.java)!!
+ .readValueFromClassPathFile(
+ "execution-input/imperative-test-input.json",
+ ExecutionServiceInput::class.java
+ )!!
val bluePrintWorkFlowService = ImperativeBluePrintWorkflowService(NodeTemplateExecutionService())
val imperativeWorkflowExecutionService = ImperativeWorkflowExecutionService(bluePrintWorkFlowService)
val output = imperativeWorkflowExecutionService
- .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
+ .executeBluePrintWorkflow(bluePrintRuntimeService, executionServiceInput, hashMapOf())
assertNotNull(output, "failed to get imperative workflow output")
assertNotNull(output.status, "failed to get imperative workflow output status")
assertEquals(output.status.message, BluePrintConstants.STATUS_SUCCESS)
assertEquals(output.status.eventType, EventType.EVENT_COMPONENT_EXECUTED.name)
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt
index 24d96629e..1f51a6aae 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt
@@ -38,6 +38,7 @@ import kotlin.test.assertNotNull
@ContextConfiguration(classes = [WorkflowServiceConfiguration::class])
class NodeTemplateExecutionServiceTest {
+
@Before
fun init() {
mockkObject(BluePrintDependencyService)
@@ -52,11 +53,15 @@ class NodeTemplateExecutionServiceTest {
@Test
fun testExecuteNodeTemplate() {
runBlocking {
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(
+ "1234",
+ "./../../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
+ )
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json",
- ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile(
+ "execution-input/resource-assignment-input.json",
+ ExecutionServiceInput::class.java
+ )!!
// Assign Workflow inputs Mock
val input = executionServiceInput.payload.get("resource-assignment-request")
@@ -65,11 +70,13 @@ class NodeTemplateExecutionServiceTest {
val nodeTemplate = "resource-assignment"
val nodeTemplateExecutionService = NodeTemplateExecutionService()
val executionServiceOutput = nodeTemplateExecutionService
- .executeNodeTemplate(bluePrintRuntimeService, nodeTemplate, executionServiceInput)
+ .executeNodeTemplate(bluePrintRuntimeService, nodeTemplate, executionServiceInput)
assertNotNull(executionServiceOutput, "failed to get response")
- assertEquals(BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
- "failed to get successful response")
+ assertEquals(
+ BluePrintConstants.STATUS_SUCCESS, executionServiceOutput.status.message,
+ "failed to get successful response"
+ )
}
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
index 44751b5b5..9c3727288 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
@@ -29,8 +29,10 @@ import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Scope
import org.springframework.stereotype.Component
-fun mockNodeTemplateComponentScriptExecutor(id: String, script: String) = BluePrintTypes.nodeTemplateComponentScriptExecutor(id,
- "mock($id) component function") {
+fun mockNodeTemplateComponentScriptExecutor(id: String, script: String) = BluePrintTypes.nodeTemplateComponentScriptExecutor(
+ id,
+ "mock($id) component function"
+) {
definedOperation("") {
inputs {
type("kotlin")
@@ -55,8 +57,10 @@ class MockComponentFunction : AbstractComponentFunction() {
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
log.info("Processing component : $operationInputs")
- bluePrintRuntimeService.setNodeTemplateAttributeValue(nodeTemplateName,
- "assignment-params", "params".asJsonPrimitive())
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ nodeTemplateName,
+ "assignment-params", "params".asJsonPrimitive()
+ )
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
@@ -92,4 +96,4 @@ class PrototypeComponentFunction : AbstractComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Recovering component..")
}
-} \ No newline at end of file
+}
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index b8bf82093..b80639725 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -266,11 +266,31 @@
<version>${grpc.version}</version>
</dependency>
<dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty-shaded</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-grpclb</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ <version>${protobuff.java.version}</version>
+ </dependency>
+ <dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuff.java.utils.version}</version>
</dependency>
<dependency>
+ <groupId>com.github.marcoferrer.krotoplus</groupId>
+ <artifactId>kroto-plus-coroutines</artifactId>
+ <version>${kroto-plus.version}</version>
+ </dependency>
+ <dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty-ssl}</version>
@@ -469,6 +489,11 @@
<artifactId>config-snapshots</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
+ <artifactId>message-prioritizaion</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- Diff capability providers for config-snapshots -->
<dependency>
@@ -484,24 +509,24 @@
<!-- Controller Blueprints Application Dependency -->
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>resource-dict</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-core</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-proto</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-proto</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- <version>${project.version}</version>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
+ <artifactId>blueprint-validation</artifactId>
+ <version>${project.version}</version>
</dependency>
<!-- Database -->
@@ -667,6 +692,18 @@
<artifactId>grpc-stub</artifactId>
</dependency>
<dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty-shaded</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-grpclb</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
</dependency>
diff --git a/ms/command-executor/src/main/python/command_executor_handler.py b/ms/command-executor/src/main/python/command_executor_handler.py
index c920dda89..3219a974b 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -31,7 +31,7 @@ import json
REQUIREMENTS_TXT = "requirements.txt"
-class CommandExecutorHandler():
+class CommandExecutorHandler:
def __init__(self, request):
self.request = request
@@ -81,9 +81,17 @@ class CommandExecutorHandler():
payload_section = []
is_payload_section = False
+ ### extract the original header request into sys-env variables
+ ### RequestID
+ request_id = request.requestId
+ ### Sub-requestID
+ subrequest_id = request.correlationId
+ request_id_map = {'CDS_REQUEST_ID':request_id, 'CDS_CORRELATION_ID':subrequest_id}
+ updated_env = { **os.environ, **request_id_map }
+
try:
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
- shell=True, bufsize=1, universal_newlines=True) as newProcess:
+ shell=True, bufsize=1, universal_newlines=True, env=updated_env) as newProcess:
while True:
output = newProcess.stdout.readline()
if output == '' and newProcess.poll() is not None:
diff --git a/ms/controllerblueprints/README.md b/ms/controllerblueprints/README.md
deleted file mode 100755
index 0cb7a131b..000000000
--- a/ms/controllerblueprints/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Application VM Arguments :
-
--DappName=ControllerBluePrints
--Dms_name=org.onap.ccsdk.cds.controllerblueprints
--DappVersion=1.0.0
--Dlogging.config=etc/logback.xml
--Dspring.config.location=opt/app/onap/config/
--Dspring.datasource.url=jdbc:mysql://127.0.0.1:3306/sdnctl
--Dspring.datasource.username=sdnctl
--Dspring.datasource.password=sdnctl
--Dcontrollerblueprints.loadInitialData=true
--Dspring.profiles.active=dev
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
deleted file mode 100644
index d3013402b..000000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/data/BluePrintExpressionData.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 - 2019 IBM, Bell Canada.
- *
- * 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.
- */
-@file:Suppress("unused")
-
-package org.onap.ccsdk.cds.controllerblueprints.core.data
-
-import com.fasterxml.jackson.databind.JsonNode
-import com.fasterxml.jackson.databind.node.ObjectNode
-/**
- *
- *
- * @author Brinda Santh
- */
-data class ExpressionData(
- var isExpression: Boolean = false,
- var valueNode: JsonNode,
- var expressionNode: ObjectNode? = null,
- var dslExpression: DSLExpression? = null,
- var inputExpression: InputExpression? = null,
- var propertyExpression: PropertyExpression? = null,
- var attributeExpression: AttributeExpression? = null,
- var artifactExpression: ArtifactExpression? = null,
- var operationOutputExpression: OperationOutputExpression? = null,
- var command: String? = null
-)
-
-data class InputExpression(
- var propertyName: String
-)
-
-data class PropertyExpression(
- var modelableEntityName: String = "SELF",
- var reqOrCapEntityName: String? = null,
- var propertyName: String,
- var subPropertyName: String? = null
-)
-
-data class AttributeExpression(
- var modelableEntityName: String = "SELF",
- var reqOrCapEntityName: String? = null,
- var attributeName: String,
- var subAttributeName: String? = null
-)
-
-data class ArtifactExpression(
- val modelableEntityName: String = "SELF",
- val artifactName: String,
- val location: String? = "LOCAL_FILE",
- val remove: Boolean? = false
-)
-
-data class OperationOutputExpression(
- val modelableEntityName: String = "SELF",
- val interfaceName: String,
- val operationName: String,
- val propertyName: String,
- var subPropertyName: String? = null
-)
-
-data class DSLExpression(
- val propertyName: String
-)
-
-
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
deleted file mode 100644
index 01c6a13be..000000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSL.kt
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * 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.controllerblueprints.core.dsl
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
-import org.onap.ccsdk.cds.controllerblueprints.core.data.*
-import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
-
-// CDS DSLs
-fun blueprint(name: String, version: String, author: String, tags: String,
- block: DSLBluePrintBuilder.() -> Unit): DSLBluePrint {
- return DSLBluePrintBuilder(name, version, author, tags).apply(block).build()
-}
-
-// TOSCA DSLs
-fun serviceTemplate(name: String, version: String, author: String, tags: String,
- block: ServiceTemplateBuilder.() -> Unit): ServiceTemplate {
- return ServiceTemplateBuilder(name, version, author, tags).apply(block).build()
-}
-
-fun workflow(id: String, description: String, block: WorkflowBuilder.() -> Unit): Workflow {
- return WorkflowBuilder(id, description).apply(block).build()
-}
-
-fun nodeTemplate(id: String, type: String, description: String,
- block: NodeTemplateBuilder.() -> Unit): NodeTemplate {
- return NodeTemplateBuilder(id, type, description).apply(block).build()
-}
-
-fun nodeType(id: String, version: String, derivedFrom: String, description: String,
- block: NodeTypeBuilder.() -> Unit): NodeType {
- return NodeTypeBuilder(id, version, derivedFrom, description).apply(block).build()
-}
-
-fun dataType(id: String, version: String, derivedFrom: String, description: String,
- block: DataTypeBuilder.() -> Unit): DataType {
- return DataTypeBuilder(id, version, derivedFrom, description).apply(block).build()
-}
-
-fun artifactType(id: String, version: String, derivedFrom: String, description: String,
- block: ArtifactTypeBuilder.() -> Unit): ArtifactType {
- return ArtifactTypeBuilder(id, version, derivedFrom, description).apply(block).build()
-}
-
-fun relationshipType(id: String, version: String, derivedFrom: String, description: String,
- block: RelationshipTypeBuilder.() -> Unit): RelationshipType {
- return RelationshipTypeBuilder(id, version, derivedFrom, description).apply(block).build()
-}
-
-// DSL Function
-fun dslExpression(key: String): JsonNode {
- return ("*$key").asJsonPrimitive()
-}
-// Input Function
-
-fun getInput(inputKey: String, jsonPath: String? = null): JsonNode {
- return """{"get_input": "$inputKey"}""".jsonAsJsonType()
-}
-
-fun getAttribute(attributeId: String, jsonPath: String? = null): JsonNode {
- return getNodeTemplateAttribute("SELF", attributeId, jsonPath)
-}
-
-fun getNodeTemplateAttribute(nodeTemplateId: String, attributeId: String): JsonNode {
- return getNodeTemplateAttribute(nodeTemplateId, attributeId, null)
-}
-
-fun getNodeTemplateAttribute(nodeTemplateId: String, attributeId: String, jsonPath: String?): JsonNode {
- return if (jsonPath.isNullOrEmpty() || jsonPath.isNullOrBlank()) {
- """{"get_attribute": ["$nodeTemplateId", "$attributeId"]}""".jsonAsJsonType()
- } else {
- """{"get_attribute": ["$nodeTemplateId", "$attributeId", "$jsonPath"]}""".jsonAsJsonType()
- }
-}
-
-// Property Function
-
-fun getProperty(propertyId: String, jsonPath: String? = null): JsonNode {
- return getNodeTemplateProperty("SELF", propertyId, jsonPath)
-}
-
-fun getNodeTemplateProperty(nodeTemplateName: String, propertyId: String): JsonNode {
- return getNodeTemplateProperty(nodeTemplateName, propertyId, null)
-}
-
-fun getNodeTemplateProperty(nodeTemplateName: String, propertyId: String, jsonPath: String?): JsonNode {
- return if (jsonPath.isNullOrEmpty() || jsonPath.isNullOrBlank()) {
- """{"get_property": ["$nodeTemplateName", "$propertyId"]}""".jsonAsJsonType()
- } else {
- """{"get_property": ["$nodeTemplateName", "$propertyId", "$jsonPath"]}""".jsonAsJsonType()
- }
-}
-
-// Artifact Function
-
-fun getArtifact(artifactId: String): JsonNode {
- return getNodeTemplateArtifact("SELF", artifactId)
-}
-
-fun getNodeTemplateArtifact(nodeTemplateName: String, artifactId: String): JsonNode {
- return """{"get_artifact": ["$nodeTemplateName", "$artifactId"]}""".jsonAsJsonType()
-}
-
-// Operation Function
-
-fun getNodeTemplateOperationOutput(nodeTemplateName: String, interfaceName: String, propertyId: String,
- jsonPath: String? = null): JsonNode {
- return """{"get_operation_output": ["$nodeTemplateName", "$interfaceName", "process","$propertyId","$jsonPath" ]}""".trimMargin().jsonAsJsonType()
-}
-
-/** Blueprint Type Extensions */
-
-fun BluePrintTypes.nodeTypeComponent(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default Component Node") {
- }
-}
-
-fun BluePrintTypes.nodeTypeWorkflow(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default Workflow Node") {
- }
-}
-
-fun BluePrintTypes.nodeTypeVnf(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_VNF,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default VNF Node") {
- }
-}
-
-fun BluePrintTypes.nodeTypeResourceSource(): NodeType {
- return nodeType(id = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
- description = "This is default Resource Source Node") {
- }
-}
-
-/** Artifacts */
-
-fun BluePrintTypes.artifactTypeTemplateVelocity(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Velocity Artifact") {
- fileExt("vtl")
- }
-}
-
-fun BluePrintTypes.artifactTypeTempleJinja(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Jinja Artifact") {
- fileExt("jinja")
- }
-}
-
-fun BluePrintTypes.artifactTypeMappingResource(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Mapping Resource Artifact") {
- fileExt("json")
- }
-}
-
-fun BluePrintTypes.artifactTypeScriptJython(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Jython Script Artifact") {
- fileExt("py")
- }
-}
-
-fun BluePrintTypes.artifactTypeScriptKotlin(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Kotlin Script Artifact") {
- fileExt("kts")
- }
-}
-
-fun BluePrintTypes.artifactTypeDirectedGraph(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Directed Graph Artifact") {
- fileExt("xml", "json")
- }
-}
-
-fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType {
- return artifactType(id = BluePrintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
- description = "Component Artifact") {
- fileExt("jar")
- }
-}
-
-/** Relationship Types */
-
-fun BluePrintTypes.relationshipTypeConnectsTo(): RelationshipType {
- return relationshipType(id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- description = "Relationship connects to") {
- }
-}
-
-fun BluePrintTypes.relationshipTypeDependsOn(): RelationshipType {
- return relationshipType(id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
- description = "Relationship depends on") {
- }
-}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt
deleted file mode 100644
index e01ba805d..000000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/utils/DateUtils.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * 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.controllerblueprints.core.utils
-
-import java.time.LocalDateTime
-import java.time.ZoneId
-import java.time.format.DateTimeFormatter
-
-fun currentTimestamp(): String {
- val now = LocalDateTime.now(ZoneId.systemDefault())
- val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
- return formatter.format(now)
-}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
deleted file mode 100644
index c24ed0327..000000000
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/annotations/BluePrintsAnnotationsTest.kt
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2019 IBM.
- *
- * 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.controllerblueprints.core.annotations
-
-import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.asBluePrintsDataTypes
-import org.onap.ccsdk.cds.controllerblueprints.core.asPropertyDefinitionMap
-import kotlin.test.Test
-import kotlin.test.assertNotNull
-
-class BluePrintsAnnotationsTest {
-
- @Test
- fun testBluePrintWorkflowData() {
- val wfInput = TestBluePrintsWorkflowInput::class.asPropertyDefinitionMap()
- //println(wfInput.asJsonString(true))
- assertNotNull(wfInput, "failed to generate wfInput property map")
-
- val wfOutput = TestBluePrintsWorkflowOutput::class.asPropertyDefinitionMap()
- //println(wfOutput.asJsonString(true))
- assertNotNull(wfInput, "failed to generate wfOutput property map")
- }
-
- @Test
- fun testBluePrintDataType() {
- val dataTypes = TestBluePrintsDataType::class.asBluePrintsDataTypes()
- //println(dataTypes.asJsonString(true))
- assertNotNull(dataTypes, "failed to generate dataTypes definition")
- }
-}
-
-@BluePrintsDataType(name = "dt-test-datatype", description = "I am test",
- version = "1.0.0", derivedFrom = "tosca.datatypes.root")
-data class TestBluePrintsDataType(
- @BluePrintsProperty(description = "this stringData")
- var stringData: String,
- @BluePrintsProperty(description = "this stringDataWithValue")
- @PropertyDefaultValue(value = "USA")
- val stringDataWithValue: String,
- @BluePrintsProperty(description = "this intDataWithValue")
- @PropertyDefaultValue(value = "30")
- val intDataWithValue: Int,
- @BluePrintsProperty(description = "this booleanDataWithValue")
- @PropertyDefaultValue(value = "true")
- val booleanDataWithValue: Boolean,
- @BluePrintsProperty(description = "this anyData")
- val anyData: Any,
- @BluePrintsProperty(description = "this jsonDataWithValue")
- @PropertyDefaultValue(value = """{"data" : "1234"}""")
- val jsonDataWithValue: JsonNode?,
- @BluePrintsProperty(description = "listData")
- val listData: MutableList<String>,
- @BluePrintsProperty(description = "this mapData")
- val mapData: MutableMap<String, String> = hashMapOf(),
- @BluePrintsProperty(description = "this complexData")
- val complexData: TestBluePrintsChildDataType?,
- @BluePrintsProperty(description = "this complexDataList")
- val complexDataList: MutableList<TestBluePrintsChildDataType>
-)
-
-data class TestBluePrintsChildDataType(val name: String)
-
-
-@BluePrintsWorkflowInput
-data class TestBluePrintsWorkflowInput(
- @BluePrintsProperty(description = "this sample name")
- @PropertyDefaultValue(value = "Brinda")
- var name: String,
- @BluePrintsProperty(description = "this sample name")
- val place: String
-)
-
-@BluePrintsWorkflowOutput
-data class TestBluePrintsWorkflowOutput(
- @BluePrintsProperty(description = "this is dslExpression")
- @DSLExpression("field1")
- var dslExpression: String,
-
- @BluePrintsProperty(description = "this is withNodeAttributeExpression")
- @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data")
- var withNodeAttributeExpression: String,
-
- @BluePrintsProperty(description = "this is withNodeAttributeExpressionSubAttribute")
- @AttributeExpression(modelableEntityName = "sample-node", attributeName = "response-data",
- subAttributeName = ".\$field1")
- var withNodeAttributeExpressionSubAttribute: String,
-
- @BluePrintsProperty(description = "this is withAttributeExpressionSubAttribute")
- @AttributeExpression(attributeName = "response-data", subAttributeName = ".\$field1")
- var withAttributeExpressionSubAttribute: String,
-
- @BluePrintsProperty(description = "this is withAttributeExpression")
- @AttributeExpression(attributeName = "response-data")
- var withAttributeExpression: String,
-
- @BluePrintsProperty(description = "this is withAArtifactExpression")
- @ArtifactExpression(modelableEntityName = "test-node", artifactName = "content-template")
- var withAArtifactExpression: String,
-
- @BluePrintsProperty(description = "this status")
- val status: String = "success"
-) \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
deleted file mode 100644
index 028e28bf0..000000000
--- a/ms/controllerblueprints/modules/pom.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~ Modifications Copyright © 2018 IBM.
- ~
- ~ 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.controllerblueprints</groupId>
- <artifactId>parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <relativePath>../parent</relativePath>
- </parent>
-
- <artifactId>modules</artifactId>
- <packaging>pom</packaging>
-
- <name>Controller Blueprints Modules</name>
-
- <modules>
- <module>blueprint-core</module>
- <module>resource-dict</module>
- <module>blueprint-validation</module>
- <module>blueprint-proto</module>
- </modules>
-
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- </dependency>
- <!-- Test Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.projectreactor</groupId>
- <artifactId>reactor-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <!-- <skip>${skip.compile}</skip>-->
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
deleted file mode 100644
index a0d083b2e..000000000
--- a/ms/controllerblueprints/parent/pom.xml
+++ /dev/null
@@ -1,453 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Modifications Copyright © 2018 - 2019 IBM, Bell Canada
- ~
- ~ 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</groupId>
- <artifactId>controllerblueprints</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>parent</artifactId>
- <packaging>pom</packaging>
-
- <name>Controller Blueprints Parent</name>
-
- <properties>
- <eelf.version>1.0.0</eelf.version>
- <guava.version>27.0.1-jre</guava.version>
- <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
- <h2database.version>1.4.197</h2database.version>
- <onap.logger.slf4j>1.2.2</onap.logger.slf4j>
- <powermock.version>1.7.4</powermock.version>
-
- <jinja.version>2.5.1</jinja.version>
- <velocity.version>1.7</velocity.version>
- <json-smart.version>2.3</json-smart.version>
- <commons-io-version>2.6</commons-io-version>
- <commons-lang3-version>3.2.1</commons-lang3-version>
- <commons-collections-version>3.2.2</commons-collections-version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <!-- Spring boot -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${spring.boot.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-logging</artifactId>
- <version>${spring.boot.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!--Swagger Dependencies -->
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>${springfox.swagger2.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- <version>${springfox.swagger2.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang3-version}</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>${commons-collections-version}</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons-io-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity</artifactId>
- <version>${velocity.version}</version>
- </dependency>
- <dependency>
- <groupId>com.hubspot.jinjava</groupId>
- <artifactId>jinjava</artifactId>
- <version>${jinja.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava.version}</version>
- </dependency>
- <dependency>
- <groupId>net.minidev</groupId>
- <artifactId>json-smart</artifactId>
- <version>${json-smart.version}</version>
- </dependency>
-
- <!-- Kotlin Dependencies -->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-common</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <!--Use kotlin-compiler-embeddable instead koltin-compiler wrap-->
- <!--guava dependency inside kotlin-compiler creating classpath issues at runtime-->
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-scripting-jvm-host</artifactId>
- <version>${kotlin.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compile</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-compiler-embeddable</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-runtime</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-core</artifactId>
- <version>${kotlin.couroutines.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- <version>${kotlin.couroutines.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-reflect</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk7</artifactId>
- <version>${kotlin.version}</version>
- </dependency>
-
- <!-- GRPC Dependencies -->
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-core</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- <version>${grpc.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- <version>${protobuff.java.utils.version}</version>
- </dependency>
- <dependency>
- <groupId>com.github.marcoferrer.krotoplus</groupId>
- <artifactId>kroto-plus-coroutines</artifactId>
- <version>${kroto-plus.version}</version>
- </dependency>
-
- <!-- Database -->
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2database.version}</version>
- </dependency>
-
- <!-- Application Components -->
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Testing Dependencies -->
- <dependency>
- <groupId>io.mockk</groupId>
- <artifactId>mockk</artifactId>
- <version>${mockk.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-test-junit</artifactId>
- <version>${kotlin.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-test</artifactId>
- <version>${kotlin.couroutines.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-testing</artifactId>
- <version>${grpc.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>com.jayway.jsonpath</groupId>
- <artifactId>json-path</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>net.minidev</groupId>
- <artifactId>json-smart</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.springfox</groupId>
- <artifactId>springfox-swagger-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-script-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-stdlib-jdk8</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jetbrains.kotlinx</groupId>
- <artifactId>kotlinx-coroutines-reactor</artifactId>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-kotlin</artifactId>
- </dependency>
- <!-- GRPC Dependencies -->
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-netty</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-protobuf</artifactId>
- </dependency>
- <dependency>
- <groupId>io.grpc</groupId>
- <artifactId>grpc-stub</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java-util</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>3.0.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.jetbrains.kotlin</groupId>
- <artifactId>kotlin-maven-plugin</artifactId>
- <version>${kotlin.maven.version}</version>
- <executions>
- <execution>
- <id>compile</id>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
- <sourceDir>${project.basedir}/src/main/java</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- <execution>
- <id>test-compile</id>
- <goals>
- <goal>test-compile</goal>
- </goals>
- <configuration>
- <sourceDirs>
- <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
- <sourceDir>${project.basedir}/src/test/java</sourceDir>
- </sourceDirs>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.5.1</version>
- <configuration>
- <source>${maven.compiler.source}</source>
- <target>${maven.compiler.target}</target>
- </configuration>
- <executions>
- <!-- Replacing default-compile as it is treated specially by maven -->
- <execution>
- <id>default-compile</id>
- <phase>none</phase>
- </execution>
- <!-- Replacing default-testCompile as it is treated specially by maven -->
- <execution>
- <id>default-testCompile</id>
- <phase>none</phase>
- </execution>
- <execution>
- <id>java-compile</id>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>java-test-compile</id>
- <phase>test-compile</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/ms/controllerblueprints/pom.xml b/ms/controllerblueprints/pom.xml
deleted file mode 100644
index 611741a88..000000000
--- a/ms/controllerblueprints/pom.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ 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</groupId>
- <artifactId>ms</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>controllerblueprints</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <name>Controller Blueprints Root</name>
-
- <modules>
- <module>parent</module>
- <module>modules</module>
- </modules>
-
- <properties>
- <service.name>ControllerBlueprints</service.name>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
- <build.number>${maven.build.timestamp}</build.number>
- <java.version>1.8</java.version>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
- <ccsdk.project.version>${project.version}</ccsdk.project.version>
- </properties>
-</project>
diff --git a/ms/pom.xml b/ms/pom.xml
index 5e8761be8..7ec3f39a2 100644
--- a/ms/pom.xml
+++ b/ms/pom.xml
@@ -5,9 +5,9 @@
* 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.
@@ -32,7 +32,6 @@
<description>Micro-services</description>
<modules>
- <module>controllerblueprints</module>
<module>blueprintsprocessor</module>
<module>py-executor</module>
<module>command-executor</module>
diff --git a/ms/py-executor/README b/ms/py-executor/README
deleted file mode 100644
index 919795a3c..000000000
--- a/ms/py-executor/README
+++ /dev/null
@@ -1,5 +0,0 @@
-
-Generate Server Certificates
-------------------------------
-
-openssl req -x509 -newkey rsa:4096 -keyout py-executor-key.pem -out py-executor-chain.pem -days 3650 -nodes -subj '/CN=localhost' \ No newline at end of file
diff --git a/ms/py-executor/README.md b/ms/py-executor/README.md
new file mode 100644
index 000000000..58b4fc5c9
--- /dev/null
+++ b/ms/py-executor/README.md
@@ -0,0 +1,35 @@
+
+## Install virtual environments
+
+```bash
+python3 -m pip install --user virtualenv # Install virtualenv
+
+python3 -m venv venv # Create virtual environment under py-executor path
+
+source env/bin/activate # Activate the current virtualenv
+
+pip install -r requirements.txt # Install the pip packages defined in requirements.txt file
+
+```
+## Generate TLS certificates
+
+```bash
+# Generate Server Certificates( chain and private keys ) using config file
+openssl req -config py-executor.conf -new -x509 -newkey rsa:4096 -nodes -keyout py-executor-key.pem -days 3650 -out py-executor-chain.pem
+
+# Verify the certificates generated
+openssl x509 -in py-executor-chain.pem -text -noout
+```
+
+## Generate Python GRPC bindings from Proto file
+
+```bash
+cd blueprints_grpc/proto
+
+# Remove Python generated files
+rm *pb2*.py
+
+#Generate proto python
+python3 -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. *.proto
+```
+fix the python import package issues.
diff --git a/ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2.py b/ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2.py
new file mode 100644
index 000000000..a2e0ec227
--- /dev/null
+++ b/ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2.py
@@ -0,0 +1,528 @@
+# Copyright © 2018-2019 AT&T Intellectual Property.
+#
+# 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.
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: BluePrintManagement.proto
+
+import sys
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+from google.protobuf.internal import enum_type_wrapper
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import message as _message
+from google.protobuf import reflection as _reflection
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
+from blueprints_grpc.proto import BluePrintCommon_pb2 as BluePrintCommon__pb2
+
+
+DESCRIPTOR = _descriptor.FileDescriptor(
+ name='BluePrintManagement.proto',
+ package='org.onap.ccsdk.cds.controllerblueprints.management.api',
+ syntax='proto3',
+ serialized_options=_b('P\001'),
+ serialized_pb=_b('\n\x19\x42luePrintManagement.proto\x12\x36org.onap.ccsdk.cds.controllerblueprints.management.api\x1a\x1cgoogle/protobuf/struct.proto\x1a\x15\x42luePrintCommon.proto\"\xd3\x02\n\x14\x42luePrintUploadInput\x12V\n\x0c\x63ommonHeader\x18\x01 \x01(\x0b\x32@.org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader\x12T\n\tfileChunk\x18\x02 \x01(\x0b\x32\x41.org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk\x12`\n\x11\x61\x63tionIdentifiers\x18\x03 \x01(\x0b\x32\x45.org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers\x12+\n\nproperties\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\"\xff\x01\n\x16\x42luePrintDownloadInput\x12V\n\x0c\x63ommonHeader\x18\x01 \x01(\x0b\x32@.org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader\x12`\n\x11\x61\x63tionIdentifiers\x18\x02 \x01(\x0b\x32\x45.org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers\x12+\n\nproperties\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct\"\xfd\x01\n\x14\x42luePrintRemoveInput\x12V\n\x0c\x63ommonHeader\x18\x01 \x01(\x0b\x32@.org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader\x12`\n\x11\x61\x63tionIdentifiers\x18\x02 \x01(\x0b\x32\x45.org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers\x12+\n\nproperties\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct\"\xb9\x01\n\x17\x42luePrintBootstrapInput\x12V\n\x0c\x63ommonHeader\x18\x01 \x01(\x0b\x32@.org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader\x12\x0f\n\x07loadCBA\x18\x02 \x01(\x08\x12\x15\n\rloadModelType\x18\x03 \x01(\x08\x12\x1e\n\x16loadResourceDictionary\x18\x04 \x01(\x08\"\xc2\x02\n\x19\x42luePrintManagementOutput\x12V\n\x0c\x63ommonHeader\x18\x01 \x01(\x0b\x32@.org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader\x12T\n\tfileChunk\x18\x02 \x01(\x0b\x32\x41.org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk\x12J\n\x06status\x18\x03 \x01(\x0b\x32:.org.onap.ccsdk.cds.controllerblueprints.common.api.Status\x12+\n\nproperties\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\"\x1a\n\tFileChunk\x12\r\n\x05\x63hunk\x18\x01 \x01(\x0c*4\n\x0e\x44ownloadAction\x12\n\n\x06SEARCH\x10\x00\x12\x0b\n\x07STARTER\x10\x01\x12\t\n\x05\x43LONE\x10\x02*@\n\x0cUploadAction\x12\t\n\x05\x44RAFT\x10\x00\x12\n\n\x06\x45NRICH\x10\x01\x12\x0c\n\x08VALIDATE\x10\x02\x12\x0b\n\x07PUBLISH\x10\x03*\x1b\n\x0cRemoveAction\x12\x0b\n\x07\x44\x45\x46\x41ULT\x10\x00\x32\xfa\x05\n\x1a\x42luePrintManagementService\x12\xb6\x01\n\x11\x64ownloadBlueprint\x12N.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput\x1aQ.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput\x12\xb2\x01\n\x0fuploadBlueprint\x12L.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput\x1aQ.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput\x12\xb2\x01\n\x0fremoveBlueprint\x12L.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput\x1aQ.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput\x12\xb8\x01\n\x12\x62ootstrapBlueprint\x12O.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput\x1aQ.org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutputB\x02P\x01\x62\x06proto3')
+ ,
+ dependencies=[google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,BluePrintCommon__pb2.DESCRIPTOR,])
+
+_DOWNLOADACTION = _descriptor.EnumDescriptor(
+ name='DownloadAction',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.DownloadAction',
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name='SEARCH', index=0, number=0,
+ serialized_options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='STARTER', index=1, number=1,
+ serialized_options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='CLONE', index=2, number=2,
+ serialized_options=None,
+ type=None),
+ ],
+ containing_type=None,
+ serialized_options=None,
+ serialized_start=1535,
+ serialized_end=1587,
+)
+_sym_db.RegisterEnumDescriptor(_DOWNLOADACTION)
+
+DownloadAction = enum_type_wrapper.EnumTypeWrapper(_DOWNLOADACTION)
+_UPLOADACTION = _descriptor.EnumDescriptor(
+ name='UploadAction',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction',
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name='DRAFT', index=0, number=0,
+ serialized_options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='ENRICH', index=1, number=1,
+ serialized_options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='VALIDATE', index=2, number=2,
+ serialized_options=None,
+ type=None),
+ _descriptor.EnumValueDescriptor(
+ name='PUBLISH', index=3, number=3,
+ serialized_options=None,
+ type=None),
+ ],
+ containing_type=None,
+ serialized_options=None,
+ serialized_start=1589,
+ serialized_end=1653,
+)
+_sym_db.RegisterEnumDescriptor(_UPLOADACTION)
+
+UploadAction = enum_type_wrapper.EnumTypeWrapper(_UPLOADACTION)
+_REMOVEACTION = _descriptor.EnumDescriptor(
+ name='RemoveAction',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.RemoveAction',
+ filename=None,
+ file=DESCRIPTOR,
+ values=[
+ _descriptor.EnumValueDescriptor(
+ name='DEFAULT', index=0, number=0,
+ serialized_options=None,
+ type=None),
+ ],
+ containing_type=None,
+ serialized_options=None,
+ serialized_start=1655,
+ serialized_end=1682,
+)
+_sym_db.RegisterEnumDescriptor(_REMOVEACTION)
+
+RemoveAction = enum_type_wrapper.EnumTypeWrapper(_REMOVEACTION)
+SEARCH = 0
+STARTER = 1
+CLONE = 2
+DRAFT = 0
+ENRICH = 1
+VALIDATE = 2
+PUBLISH = 3
+DEFAULT = 0
+
+
+
+_BLUEPRINTUPLOADINPUT = _descriptor.Descriptor(
+ name='BluePrintUploadInput',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name='commonHeader', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput.commonHeader', index=0,
+ number=1, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='fileChunk', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput.fileChunk', index=1,
+ number=2, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='actionIdentifiers', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput.actionIdentifiers', index=2,
+ number=3, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='properties', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput.properties', index=3,
+ number=4, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ serialized_options=None,
+ is_extendable=False,
+ syntax='proto3',
+ extension_ranges=[],
+ oneofs=[
+ ],
+ serialized_start=139,
+ serialized_end=478,
+)
+
+
+_BLUEPRINTDOWNLOADINPUT = _descriptor.Descriptor(
+ name='BluePrintDownloadInput',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name='commonHeader', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput.commonHeader', index=0,
+ number=1, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='actionIdentifiers', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput.actionIdentifiers', index=1,
+ number=2, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='properties', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput.properties', index=2,
+ number=3, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ serialized_options=None,
+ is_extendable=False,
+ syntax='proto3',
+ extension_ranges=[],
+ oneofs=[
+ ],
+ serialized_start=481,
+ serialized_end=736,
+)
+
+
+_BLUEPRINTREMOVEINPUT = _descriptor.Descriptor(
+ name='BluePrintRemoveInput',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name='commonHeader', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput.commonHeader', index=0,
+ number=1, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='actionIdentifiers', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput.actionIdentifiers', index=1,
+ number=2, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='properties', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput.properties', index=2,
+ number=3, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ serialized_options=None,
+ is_extendable=False,
+ syntax='proto3',
+ extension_ranges=[],
+ oneofs=[
+ ],
+ serialized_start=739,
+ serialized_end=992,
+)
+
+
+_BLUEPRINTBOOTSTRAPINPUT = _descriptor.Descriptor(
+ name='BluePrintBootstrapInput',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name='commonHeader', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput.commonHeader', index=0,
+ number=1, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='loadCBA', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput.loadCBA', index=1,
+ number=2, type=8, cpp_type=7, label=1,
+ has_default_value=False, default_value=False,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='loadModelType', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput.loadModelType', index=2,
+ number=3, type=8, cpp_type=7, label=1,
+ has_default_value=False, default_value=False,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='loadResourceDictionary', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput.loadResourceDictionary', index=3,
+ number=4, type=8, cpp_type=7, label=1,
+ has_default_value=False, default_value=False,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ serialized_options=None,
+ is_extendable=False,
+ syntax='proto3',
+ extension_ranges=[],
+ oneofs=[
+ ],
+ serialized_start=995,
+ serialized_end=1180,
+)
+
+
+_BLUEPRINTMANAGEMENTOUTPUT = _descriptor.Descriptor(
+ name='BluePrintManagementOutput',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name='commonHeader', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput.commonHeader', index=0,
+ number=1, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='fileChunk', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput.fileChunk', index=1,
+ number=2, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='status', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput.status', index=2,
+ number=3, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ _descriptor.FieldDescriptor(
+ name='properties', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput.properties', index=3,
+ number=4, type=11, cpp_type=10, label=1,
+ has_default_value=False, default_value=None,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ serialized_options=None,
+ is_extendable=False,
+ syntax='proto3',
+ extension_ranges=[],
+ oneofs=[
+ ],
+ serialized_start=1183,
+ serialized_end=1505,
+)
+
+
+_FILECHUNK = _descriptor.Descriptor(
+ name='FileChunk',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk',
+ filename=None,
+ file=DESCRIPTOR,
+ containing_type=None,
+ fields=[
+ _descriptor.FieldDescriptor(
+ name='chunk', full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk.chunk', index=0,
+ number=1, type=12, cpp_type=9, label=1,
+ has_default_value=False, default_value=_b(""),
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ serialized_options=None, file=DESCRIPTOR),
+ ],
+ extensions=[
+ ],
+ nested_types=[],
+ enum_types=[
+ ],
+ serialized_options=None,
+ is_extendable=False,
+ syntax='proto3',
+ extension_ranges=[],
+ oneofs=[
+ ],
+ serialized_start=1507,
+ serialized_end=1533,
+)
+
+_BLUEPRINTUPLOADINPUT.fields_by_name['commonHeader'].message_type = BluePrintCommon__pb2._COMMONHEADER
+_BLUEPRINTUPLOADINPUT.fields_by_name['fileChunk'].message_type = _FILECHUNK
+_BLUEPRINTUPLOADINPUT.fields_by_name['actionIdentifiers'].message_type = BluePrintCommon__pb2._ACTIONIDENTIFIERS
+_BLUEPRINTUPLOADINPUT.fields_by_name['properties'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
+_BLUEPRINTDOWNLOADINPUT.fields_by_name['commonHeader'].message_type = BluePrintCommon__pb2._COMMONHEADER
+_BLUEPRINTDOWNLOADINPUT.fields_by_name['actionIdentifiers'].message_type = BluePrintCommon__pb2._ACTIONIDENTIFIERS
+_BLUEPRINTDOWNLOADINPUT.fields_by_name['properties'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
+_BLUEPRINTREMOVEINPUT.fields_by_name['commonHeader'].message_type = BluePrintCommon__pb2._COMMONHEADER
+_BLUEPRINTREMOVEINPUT.fields_by_name['actionIdentifiers'].message_type = BluePrintCommon__pb2._ACTIONIDENTIFIERS
+_BLUEPRINTREMOVEINPUT.fields_by_name['properties'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
+_BLUEPRINTBOOTSTRAPINPUT.fields_by_name['commonHeader'].message_type = BluePrintCommon__pb2._COMMONHEADER
+_BLUEPRINTMANAGEMENTOUTPUT.fields_by_name['commonHeader'].message_type = BluePrintCommon__pb2._COMMONHEADER
+_BLUEPRINTMANAGEMENTOUTPUT.fields_by_name['fileChunk'].message_type = _FILECHUNK
+_BLUEPRINTMANAGEMENTOUTPUT.fields_by_name['status'].message_type = BluePrintCommon__pb2._STATUS
+_BLUEPRINTMANAGEMENTOUTPUT.fields_by_name['properties'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT
+DESCRIPTOR.message_types_by_name['BluePrintUploadInput'] = _BLUEPRINTUPLOADINPUT
+DESCRIPTOR.message_types_by_name['BluePrintDownloadInput'] = _BLUEPRINTDOWNLOADINPUT
+DESCRIPTOR.message_types_by_name['BluePrintRemoveInput'] = _BLUEPRINTREMOVEINPUT
+DESCRIPTOR.message_types_by_name['BluePrintBootstrapInput'] = _BLUEPRINTBOOTSTRAPINPUT
+DESCRIPTOR.message_types_by_name['BluePrintManagementOutput'] = _BLUEPRINTMANAGEMENTOUTPUT
+DESCRIPTOR.message_types_by_name['FileChunk'] = _FILECHUNK
+DESCRIPTOR.enum_types_by_name['DownloadAction'] = _DOWNLOADACTION
+DESCRIPTOR.enum_types_by_name['UploadAction'] = _UPLOADACTION
+DESCRIPTOR.enum_types_by_name['RemoveAction'] = _REMOVEACTION
+_sym_db.RegisterFileDescriptor(DESCRIPTOR)
+
+BluePrintUploadInput = _reflection.GeneratedProtocolMessageType('BluePrintUploadInput', (_message.Message,), {
+ 'DESCRIPTOR' : _BLUEPRINTUPLOADINPUT,
+ '__module__' : 'BluePrintManagement_pb2'
+ # @@protoc_insertion_point(class_scope:org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput)
+ })
+_sym_db.RegisterMessage(BluePrintUploadInput)
+
+BluePrintDownloadInput = _reflection.GeneratedProtocolMessageType('BluePrintDownloadInput', (_message.Message,), {
+ 'DESCRIPTOR' : _BLUEPRINTDOWNLOADINPUT,
+ '__module__' : 'BluePrintManagement_pb2'
+ # @@protoc_insertion_point(class_scope:org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintDownloadInput)
+ })
+_sym_db.RegisterMessage(BluePrintDownloadInput)
+
+BluePrintRemoveInput = _reflection.GeneratedProtocolMessageType('BluePrintRemoveInput', (_message.Message,), {
+ 'DESCRIPTOR' : _BLUEPRINTREMOVEINPUT,
+ '__module__' : 'BluePrintManagement_pb2'
+ # @@protoc_insertion_point(class_scope:org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintRemoveInput)
+ })
+_sym_db.RegisterMessage(BluePrintRemoveInput)
+
+BluePrintBootstrapInput = _reflection.GeneratedProtocolMessageType('BluePrintBootstrapInput', (_message.Message,), {
+ 'DESCRIPTOR' : _BLUEPRINTBOOTSTRAPINPUT,
+ '__module__' : 'BluePrintManagement_pb2'
+ # @@protoc_insertion_point(class_scope:org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintBootstrapInput)
+ })
+_sym_db.RegisterMessage(BluePrintBootstrapInput)
+
+BluePrintManagementOutput = _reflection.GeneratedProtocolMessageType('BluePrintManagementOutput', (_message.Message,), {
+ 'DESCRIPTOR' : _BLUEPRINTMANAGEMENTOUTPUT,
+ '__module__' : 'BluePrintManagement_pb2'
+ # @@protoc_insertion_point(class_scope:org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput)
+ })
+_sym_db.RegisterMessage(BluePrintManagementOutput)
+
+FileChunk = _reflection.GeneratedProtocolMessageType('FileChunk', (_message.Message,), {
+ 'DESCRIPTOR' : _FILECHUNK,
+ '__module__' : 'BluePrintManagement_pb2'
+ # @@protoc_insertion_point(class_scope:org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk)
+ })
+_sym_db.RegisterMessage(FileChunk)
+
+
+DESCRIPTOR._options = None
+
+_BLUEPRINTMANAGEMENTSERVICE = _descriptor.ServiceDescriptor(
+ name='BluePrintManagementService',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService',
+ file=DESCRIPTOR,
+ index=0,
+ serialized_options=None,
+ serialized_start=1685,
+ serialized_end=2447,
+ methods=[
+ _descriptor.MethodDescriptor(
+ name='downloadBlueprint',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService.downloadBlueprint',
+ index=0,
+ containing_service=None,
+ input_type=_BLUEPRINTDOWNLOADINPUT,
+ output_type=_BLUEPRINTMANAGEMENTOUTPUT,
+ serialized_options=None,
+ ),
+ _descriptor.MethodDescriptor(
+ name='uploadBlueprint',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService.uploadBlueprint',
+ index=1,
+ containing_service=None,
+ input_type=_BLUEPRINTUPLOADINPUT,
+ output_type=_BLUEPRINTMANAGEMENTOUTPUT,
+ serialized_options=None,
+ ),
+ _descriptor.MethodDescriptor(
+ name='removeBlueprint',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService.removeBlueprint',
+ index=2,
+ containing_service=None,
+ input_type=_BLUEPRINTREMOVEINPUT,
+ output_type=_BLUEPRINTMANAGEMENTOUTPUT,
+ serialized_options=None,
+ ),
+ _descriptor.MethodDescriptor(
+ name='bootstrapBlueprint',
+ full_name='org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService.bootstrapBlueprint',
+ index=3,
+ containing_service=None,
+ input_type=_BLUEPRINTBOOTSTRAPINPUT,
+ output_type=_BLUEPRINTMANAGEMENTOUTPUT,
+ serialized_options=None,
+ ),
+])
+_sym_db.RegisterServiceDescriptor(_BLUEPRINTMANAGEMENTSERVICE)
+
+DESCRIPTOR.services_by_name['BluePrintManagementService'] = _BLUEPRINTMANAGEMENTSERVICE
+
+# @@protoc_insertion_point(module_scope)
diff --git a/ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2_grpc.py b/ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2_grpc.py
new file mode 100644
index 000000000..423a46003
--- /dev/null
+++ b/ms/py-executor/blueprints_grpc/proto/BluePrintManagement_pb2_grpc.py
@@ -0,0 +1,111 @@
+# Copyright © 2018-2019 AT&T Intellectual Property.
+#
+# 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.
+
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+import grpc
+
+from blueprints_grpc.proto import BluePrintManagement_pb2 as BluePrintManagement__pb2
+
+
+class BluePrintManagementServiceStub(object):
+ # missing associated documentation comment in .proto file
+ pass
+
+ def __init__(self, channel):
+ """Constructor.
+
+ Args:
+ channel: A grpc.Channel.
+ """
+ self.downloadBlueprint = channel.unary_unary(
+ '/org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService/downloadBlueprint',
+ request_serializer=BluePrintManagement__pb2.BluePrintDownloadInput.SerializeToString,
+ response_deserializer=BluePrintManagement__pb2.BluePrintManagementOutput.FromString,
+ )
+ self.uploadBlueprint = channel.unary_unary(
+ '/org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService/uploadBlueprint',
+ request_serializer=BluePrintManagement__pb2.BluePrintUploadInput.SerializeToString,
+ response_deserializer=BluePrintManagement__pb2.BluePrintManagementOutput.FromString,
+ )
+ self.removeBlueprint = channel.unary_unary(
+ '/org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService/removeBlueprint',
+ request_serializer=BluePrintManagement__pb2.BluePrintRemoveInput.SerializeToString,
+ response_deserializer=BluePrintManagement__pb2.BluePrintManagementOutput.FromString,
+ )
+ self.bootstrapBlueprint = channel.unary_unary(
+ '/org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService/bootstrapBlueprint',
+ request_serializer=BluePrintManagement__pb2.BluePrintBootstrapInput.SerializeToString,
+ response_deserializer=BluePrintManagement__pb2.BluePrintManagementOutput.FromString,
+ )
+
+
+class BluePrintManagementServiceServicer(object):
+ # missing associated documentation comment in .proto file
+ pass
+
+ def downloadBlueprint(self, request, context):
+ # missing associated documentation comment in .proto file
+ pass
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def uploadBlueprint(self, request, context):
+ # missing associated documentation comment in .proto file
+ pass
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def removeBlueprint(self, request, context):
+ # missing associated documentation comment in .proto file
+ pass
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def bootstrapBlueprint(self, request, context):
+ # missing associated documentation comment in .proto file
+ pass
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+
+def add_BluePrintManagementServiceServicer_to_server(servicer, server):
+ rpc_method_handlers = {
+ 'downloadBlueprint': grpc.unary_unary_rpc_method_handler(
+ servicer.downloadBlueprint,
+ request_deserializer=BluePrintManagement__pb2.BluePrintDownloadInput.FromString,
+ response_serializer=BluePrintManagement__pb2.BluePrintManagementOutput.SerializeToString,
+ ),
+ 'uploadBlueprint': grpc.unary_unary_rpc_method_handler(
+ servicer.uploadBlueprint,
+ request_deserializer=BluePrintManagement__pb2.BluePrintUploadInput.FromString,
+ response_serializer=BluePrintManagement__pb2.BluePrintManagementOutput.SerializeToString,
+ ),
+ 'removeBlueprint': grpc.unary_unary_rpc_method_handler(
+ servicer.removeBlueprint,
+ request_deserializer=BluePrintManagement__pb2.BluePrintRemoveInput.FromString,
+ response_serializer=BluePrintManagement__pb2.BluePrintManagementOutput.SerializeToString,
+ ),
+ 'bootstrapBlueprint': grpc.unary_unary_rpc_method_handler(
+ servicer.bootstrapBlueprint,
+ request_deserializer=BluePrintManagement__pb2.BluePrintBootstrapInput.FromString,
+ response_serializer=BluePrintManagement__pb2.BluePrintManagementOutput.SerializeToString,
+ ),
+ }
+ generic_handler = grpc.method_handlers_generic_handler(
+ 'org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementService', rpc_method_handlers)
+ server.add_generic_rpc_handlers((generic_handler,))
diff --git a/ms/py-executor/certs/py-executor/py-executor-chain.pem b/ms/py-executor/certs/py-executor/py-executor-chain.pem
index 30f09dfea..98c4f39ba 100644
--- a/ms/py-executor/certs/py-executor/py-executor-chain.pem
+++ b/ms/py-executor/certs/py-executor/py-executor-chain.pem
@@ -1,27 +1,37 @@
-----BEGIN CERTIFICATE-----
-MIIEpDCCAowCCQDyhR+GR2RUiTANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAls
-b2NhbGhvc3QwHhcNMTkxMDIzMDAwMTA0WhcNMjkxMDIwMDAwMTA0WjAUMRIwEAYD
-VQQDDAlsb2NhbGhvc3QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCs
-c4d6qfbW+GSMp+XURoLXtSAbbehoBXL2beSzqQNW6e+Q9IVtSPZst8VRjUXelFzM
-m7VpS9jhiXOPZ5KKUOD0GVuNQc54VpwtHt7t9L5wS9OvdnLijnMIkc0iUvC6+Rcq
-HSfbNC2Tb+a8jLwojmtRCeY/MyCnmqYpD+U3b6Eue89VpMOIfmDuTqSRRBYNVO72
-hq7FI3UD8+zREg7htfzjJjG14Ec5iVMDxJA1FlwtXFnZxDHgbLjEVjTTR/9Wm1eU
-aJ4oWRt3gG/vnJNa+GwN4w/My+j/5/n/YpNh6GeQrHxBl/SL/SAFBshlwozr4K4K
-av5MqRKyhCACV4SsdhKJUEDtvrtukJvh/ZDW8jdNbFJAljm8UucZGbJrZl6G7XB3
-WteI7rezo0mL0NMBZIT3nQSMEpefKUFZFiE5lYvIk3UuChqIM0xdgV4INwLRHZdc
-1TtiGaBJV05y3Klo5gaUgNGbHP26zfub5TydiMrOA5W2mUvMkG2oit9aqnbaZBLD
-t17cCKzpzcVF5uNUng3j6sQvpTt3S4L28TvKUMAfpecQqvxMoxG0/9HZuv2z+U+L
-LVVsS07yJPIGMLcq1LMM++8LwD1MupcoShjNOq/lUOL6hIMfLOIfxt8Kv8WykVzv
-6yjKEIurjkwMipq4kvr9J7FFi54kGr7uvXWQRHDFJwIDAQABMA0GCSqGSIb3DQEB
-CwUAA4ICAQB7gJzvaOIP3/S2jrObz67g0jiz1cfb4I9KQwpwb6JUWbYm1QjBcGm4
-IhNbdPMD6dpwBc/A4JctA5E+/fArvl14UtK1jkaaE/GCumL0VUSZeAM6CK/63brt
-LplqCunv8ePHmiwjJBnhu+ewe1+mDMVDMw0iot/q+pOM3vqNS1Fipja+xFK1JQZx
-JmkjW/Ug3NHk/SSTfO+VNmlI5bBBApMqKmd9picsyDZ7dTBtZvbqV5eQsPZvv14G
-oEvWnvvom+D5GojroSO+OMHNDR3bzK6p0Cu8AiTy9Ls6J2e4GXJz3Cg/kuF9tNlR
-3X62zDT+CUipuYyTvmjbSyNMGwU7BIZTKFPuTtjh7EwT2g6S8RV9PmT98CQW6kTT
-RJbL7nMIOF0WusysAT5wj1HJ0QKBQCXK+L6WTKTTovaEE7JSVrYe7wVF8Q9SyBIM
-4CPVZt+GMyQKJ9SRnVgTDEMb7sj9HPaoVeDc6LQTv8Q//wFeTdZIWXQhpVJCQCEG
-qkRk9r3isF60ISOXXIYhqE+hx3QXY9M2UyHDtKXPZ7X370vADi2ebBMF8MpIZYl5
-628dME9JhOhLhD5qPJeva2Nq4gLpK+rO6t7ML0Us4edoKyoScowXAh80q1GW3EO3
-IxTK123651C/S0kDqLqZ9rknEdpwSujrT2UW95jUlfo5OKDrPpdOBw==
+MIIGXTCCBEWgAwIBAgIJALA8s9WVhurtMA0GCSqGSIb3DQEBCwUAMH8xCzAJBgNV
+BAYTAlVTMRMwEQYDVQQIDApOZXcgSmVyc2V5MRMwEQYDVQQHDApNaWRkbGV0b3du
+MRcwFQYDVQQKDA5PTkFQIENvbW11bml0eTEOMAwGA1UEAwwFQ0NTREsxHTAbBgkq
+hkiG9w0BCQEWDmJzMjc5NkBhdHQuY29tMB4XDTE5MTEyOTIwNTUzNFoXDTI5MTEy
+NjIwNTUzNFowfzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCk5ldyBKZXJzZXkxEzAR
+BgNVBAcMCk1pZGRsZXRvd24xFzAVBgNVBAoMDk9OQVAgQ29tbXVuaXR5MQ4wDAYD
+VQQDDAVDQ1NESzEdMBsGCSqGSIb3DQEJARYOYnMyNzk2QGF0dC5jb20wggIiMA0G
+CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDMb8yqD/lu3IHffa1H+LnCTKCijZDC
+85sPta8nH9cQxqRLJyjkOZs+K1z5i6Qn1AH8jOYqG1dRO0Y3pTqu0q5s5Q5Qg2ZF
+xZPW0772HL2Id1WAL62ymPcAp4/JPgeFqcVtRcxx+MPKTohjSY9l+cAPuAQ3izmz
+ValxYVvI8s3qRnvp9sjaOTm4vz/9/7mci9hDKn4B8K7u8fUPKkqYQOOaiv31rYVG
+sw7CIGvHGQMz89loWtB7A4ioZmveZdRdRs5kXbGwvuZQOnc6e8wYO211wkPEJ/go
+sulWwMqcwN9L6712g6ZnoFD+gtut+OLIlrZGS/5MEzMnvmX9NzXiKOP9Zp+Qj4jM
+3pa1pt33LxoBYux7r9154wi9kCXLI2XUTA5TbaufXv6/tn3R9fzMYEUeUdLeEEtr
+NBTEpviTaAxgkpLhGbrSd6F3wbvnBh/gPrBW/0HrAnpMuV5V8JFP1SrT2EbguaW5
+G4keckBMkcOPpz/qvYuXW2FD/XO5yz1keJqXs4HSSM0/ZYcNk89wn50I4GLUY0Q5
+hnk9Twdf8zglSRUDHLCrsA88wJXHBL6W6xVQjQFikY94YOVyvcqXvnmlhOhLamr2
+72bbjrVPvZw4nUYZeg/WpdalmpJb4M9MVLLFo11O150PRRUqnHTHHKGXv7C2mCAO
+MIEPr/WJpS50WwIDAQABo4HbMIHYMB0GA1UdDgQWBBT+kmcpEJ/kS/kW9rGc0uom
+T0VqBDAfBgNVHSMEGDAWgBT+kmcpEJ/kS/kW9rGc0uomT0VqBDAJBgNVHRMEAjAA
+MAsGA1UdDwQEAwIF4DATBgNVHSUEDDAKBggrBgEFBQcDATA7BgNVHREENDAyghBj
+ZHMtY29udHJvbGxlci0qgg1weS1leGVjdXRvci0qgglsb2NhbGhvc3SHBH8AAAEw
+LAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMA0G
+CSqGSIb3DQEBCwUAA4ICAQCdquyIETbOWFtXpzL/SQ8jB0yzBmErA3vQPm847qSz
+r8QNXsEyPq7lo06xJTfhlmfpOBzCVdpP+/3pvJfKJ8/wC/D3B8E88Ozzz/yCZPuG
+SNcv+SSnki729ptc1bx6It0FQFahXGywm2ASHGMz4zfmMtnjIfBEuMBCD+V4liwr
+oCEw8E1d+fxArv72LMbNYxPQ+HfrasYhINgVnYSpftqIGpi0PGaEoCVrosQnB0Gk
+5kHWvTXqMC+G9Q1MSQk8vs3lnp9Y4gXbdeaMu3YSmM9nVAY1uZiZRBHVbMadIDFO
+NQmDBKfyN6uK3uBV1S84woC0o5iqIR5EF3u4NeCX5jRWR1Uu4zAG70TpcLmyP1do
+Kt49m9sVrxoCgzjzRd1yZ50BZ1/5550OeF55swQv/ncGriD8uxaQu49NbUo2Rw8R
+Af5TMMW9+0KN6zDOUIVfK5a6NGqnylN3drB2jIjGyTOVycm5paL+iuKEg7euxvZ8
+51Z6QWe3F3+wVYVWtDeN3/9FUm3FzonmZvoChYkz7NTifQpS7/46BpBa5DoblcUu
+MMXWMYieVv3wLIvtFFi2CoNh0tyD7TcNsAB4hLbbBxtXmAB82tgjQhOdkQErm+qi
+Gq5AwlI8k3hhkLDcWH4hUx4YTLJLdTeQGKyM6dB+NBZATyzOrY5j86j7vITLeG8t
+3w==
-----END CERTIFICATE-----
diff --git a/ms/py-executor/certs/py-executor/py-executor-key.pem b/ms/py-executor/certs/py-executor/py-executor-key.pem
index 830a3ae21..9407765b5 100644
--- a/ms/py-executor/certs/py-executor/py-executor-key.pem
+++ b/ms/py-executor/certs/py-executor/py-executor-key.pem
@@ -1,52 +1,52 @@
-----BEGIN PRIVATE KEY-----
-MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCsc4d6qfbW+GSM
-p+XURoLXtSAbbehoBXL2beSzqQNW6e+Q9IVtSPZst8VRjUXelFzMm7VpS9jhiXOP
-Z5KKUOD0GVuNQc54VpwtHt7t9L5wS9OvdnLijnMIkc0iUvC6+RcqHSfbNC2Tb+a8
-jLwojmtRCeY/MyCnmqYpD+U3b6Eue89VpMOIfmDuTqSRRBYNVO72hq7FI3UD8+zR
-Eg7htfzjJjG14Ec5iVMDxJA1FlwtXFnZxDHgbLjEVjTTR/9Wm1eUaJ4oWRt3gG/v
-nJNa+GwN4w/My+j/5/n/YpNh6GeQrHxBl/SL/SAFBshlwozr4K4Kav5MqRKyhCAC
-V4SsdhKJUEDtvrtukJvh/ZDW8jdNbFJAljm8UucZGbJrZl6G7XB3WteI7rezo0mL
-0NMBZIT3nQSMEpefKUFZFiE5lYvIk3UuChqIM0xdgV4INwLRHZdc1TtiGaBJV05y
-3Klo5gaUgNGbHP26zfub5TydiMrOA5W2mUvMkG2oit9aqnbaZBLDt17cCKzpzcVF
-5uNUng3j6sQvpTt3S4L28TvKUMAfpecQqvxMoxG0/9HZuv2z+U+LLVVsS07yJPIG
-MLcq1LMM++8LwD1MupcoShjNOq/lUOL6hIMfLOIfxt8Kv8WykVzv6yjKEIurjkwM
-ipq4kvr9J7FFi54kGr7uvXWQRHDFJwIDAQABAoICADepPmRAMbTnDYU8t/jRHXBE
-PO29htL0V0vk4nl+pt5JuZJe6iYA89DZa+3LnG6gEmfUJjSrT4BUXiE+O9U7D7CZ
-8qvgPqUmx1fk6+2AHmuefd/XanNnqQduD/jxLlQbC/gC2xdsev1ok9/tyNmKRmcs
-u81QUkzmpJUCVWiUNkELozswaBBJQj4I0iM1B60b6dlWVVi5/g3dkGVW38jIdaxX
-apoansKaaVoA+s63vd7CPRoFsleOoAB3FqvPREIO97CmJ848HJpwsTB0qDcnkbDV
-xgbDFhxrIozko09ptOvEUILXag45EDmvG8WEivmjVml0aUoTFD7cWHyJBQCpR4fU
-5W9mYd4Rrzbmpb+LGYdNyrp3wo3C7dJ7/ffBMQxmXTdMZkcxorxj4BRG3oACRQ1u
-Ff1iUruZzIIDtEkrC9hc5QpLlDf9b1obm8L9sxf1QmTt59o5oFG40GPwPP19GXwE
-l2faHwho2jYLM9rhuSsK/5sSmUshPNQYmfMnbWzTtghMPE/g0Cfpt8qbspq+G1bk
-z3M97JlFMF83ccRotDElX9E/ttjU7Lehoz+1sOyHiVW1E4oqKer4t+nI2bp6VYZm
-W94qptW7kb4o0DsvPCaoTPBxLJ1ag2WBlqoFkVI0YaxZiZ8OTR55Ovi4z5xWBO1q
-NkCKgdAUQvQVzVtASVGBAoIBAQDSw2nvPFN4gGZ6OI+8j2gWtPcsrhSHS9ykxBeB
-mB/HExYIe8k3EvClf2rnfwzuKgKyVMp7Ev7nH2jS/PGZq37QyXrw0NBGRnvJY0Ez
-YB1KTgf9xaHMGMut5efNvv/cPwYriqosgJ0pdt0vvUAIQ6EBv+iDXXqJ1lQUSRYk
-wKjFABi6TeJY4t9vC474KoXTDaHlwn9+TwnuRBk85wrZzlhK90J0iVa9/Eqeddsc
-Z3CuTlc+NmcP3qvniYODq8nyVc0pKw+28AVYYEd3aJfgm+dpcB21L0oz7CaxH/Rz
-FNONuQRaOzJrcuJsde/KG2X+MHs6hVMXXXWciPrJ2l+Cq7dnAoIBAQDRdwZDcgem
-tJHLihCRzUl9PKip4ZA5757ZyTy6WMLR3wMS2cNTK8+bTrUa0SSC4WSI28pybFA7
-QdSR08c5Nd7jXcIrtqspgZKhb0E60i8VQHhh6ba/kyQjsEz9c/G1WquPK13j2vZ0
-79bomDwFJPsFzABU+sC0/F42ZVQzy9qXkjngjtmaGfrCc7X+pV28nEGtyxHci3L4
-XXfE2dOb+GBVZPLBVXwcthdRYsFuU9GMy2GH0zVtWPOcGRnlpx53Tqg7NIeR0Nm1
-K35EaK8PH92PsAr0Xza7vQHY4cPRz+RhDzjyGQtnhKf96U6gzzt4ZVbQ/UuzDBcL
-PQ2DvUH+sqxBAoIBAEW5kiUsDu0xhTVv2tVll+jTK2ZjnLT5ut/jY2djHTgtrz9V
-PEb1BBmsIoC9PljYGxZGCMpYiW2KrZIHTiIpYwXNcdeTLSPik3cXV+2YIXiAghJJ
-PHKZzWAVS+97/YcubmsfL5cTYWrjQN9XO4TAYtaCV3iGB1DsT9p6J1I3Tl4F3yhb
-NcN0IrjI2R5uauFchC/PfYAaw81ISBUm1iciJYF/dUO6X7DwcvsjQD6QVe3ESwZw
-1v2gC7zIeHKp9WAvVHUHIubBVvNavqnZN01+JjtydNGI+IJe4Jn+WU9tF2OuTqtP
-JCn50sBQ7+gr0j0aatn8W3XCXHNRua3niWtgRYcCggEAT7OzfWxhPuyMYV9qiKAN
-a4ruPp3mjDUCQ6pP4jQuBT+PYtfbe8U63MSpIsgb1XVAFNdVBA70xGd7I/XqY3l9
-ExS08n8yR7vW+Hhl4KTjZ3m9lLwiXmj1omLOGM7KVRBoITUGJ9JEXyB3rM9oXyjA
-H2eNZMh5FSTGEHqj/IV/6paoUSrp37os8VqoEHoJ3d+zGhcf98RT/e9KyGt+GmX6
-+eNMf4YwkJg07THfmkRoguNMfCtAtBfZsjbW5MyfShRy7PxC7ZgDju06wXr3yZB9
-dNQuhufH4s27azQUl7w8ETaCm5QuA7i1V2c0FPpljZ052JHZAQsDpbIYd11HREvm
-QQKCAQEA0W7xNYoFvnyikdG0t266LLv1EkWDFdgkelGx/eGe/JZ+au3uTM94EssC
-ni64XX2P8vK/te+c3jItYO4MRgnDJ7GW+bRnJFu2kBE0W4chx7vga0XApVCP+Ugg
-owv5yf9cOAHFulvPefsU0snYStD3gNq77XDg0CwoyUkpeq+GiupoQ8tquMSsrEwp
-ve5DtDip3cLHz2oVLB3mR4kKVwVwmOgO5RKq6N/H6Jxtf/Zk1I260dKr+Dv2MnDh
-dysO4zH5YEt2ML3oY4zY8lu+I5bHCBR1updSny0B31WrXAJyfZpMx+HOwETFKa3B
-v9AGKz0Jc2GOIRKHrCQ/WkZePetaYQ==
+MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDMb8yqD/lu3IHf
+fa1H+LnCTKCijZDC85sPta8nH9cQxqRLJyjkOZs+K1z5i6Qn1AH8jOYqG1dRO0Y3
+pTqu0q5s5Q5Qg2ZFxZPW0772HL2Id1WAL62ymPcAp4/JPgeFqcVtRcxx+MPKTohj
+SY9l+cAPuAQ3izmzValxYVvI8s3qRnvp9sjaOTm4vz/9/7mci9hDKn4B8K7u8fUP
+KkqYQOOaiv31rYVGsw7CIGvHGQMz89loWtB7A4ioZmveZdRdRs5kXbGwvuZQOnc6
+e8wYO211wkPEJ/gosulWwMqcwN9L6712g6ZnoFD+gtut+OLIlrZGS/5MEzMnvmX9
+NzXiKOP9Zp+Qj4jM3pa1pt33LxoBYux7r9154wi9kCXLI2XUTA5TbaufXv6/tn3R
+9fzMYEUeUdLeEEtrNBTEpviTaAxgkpLhGbrSd6F3wbvnBh/gPrBW/0HrAnpMuV5V
+8JFP1SrT2EbguaW5G4keckBMkcOPpz/qvYuXW2FD/XO5yz1keJqXs4HSSM0/ZYcN
+k89wn50I4GLUY0Q5hnk9Twdf8zglSRUDHLCrsA88wJXHBL6W6xVQjQFikY94YOVy
+vcqXvnmlhOhLamr272bbjrVPvZw4nUYZeg/WpdalmpJb4M9MVLLFo11O150PRRUq
+nHTHHKGXv7C2mCAOMIEPr/WJpS50WwIDAQABAoICAE70ksfPeZc+ZI5LPIRCZIPN
+EnEVWaZhbS6pDad/nZEmFsfLrPhP40wkdTkPnGuhbs76H959RsDhsqHFF5/zUFhQ
+MrIXvYUO5KUgjG0C9pRg+k2SnHQQrby7+kVPxpnx0oT8YxRVblCQ+g3WmCJbTbkE
+aeSFydggKlvWrRsz4yEq7aqTnEjjtw5KFs3jWO1D+VcfbyESso0oN2wO+lZJIV5L
+df/Pb1y5xOZmnRl86IbFE99Ay6nm2H2paNmw3E7WDNoocXsAj3TGz8tvioiFUyYa
+zA9THH2jc4kE1nup5dOtjTPbboYxHXbeVTegmv27b1RA/0qkU6py13LvQslA36QK
+jl7my7AM165FtzpuAJqcvalgrfMZOOOFPi4MB20C2rT+xze3CJ9Vn6A3zrSj27Hv
+krZK74hWk2m7UwtWmvb1ykJATj2MsnaGv0HwKDcikm5dKcejaRy4yFgYj74nrR64
+qDyYXNhu9NewIBTSK8Liq0SsvMkGDarfdfs3+foORPUzyAnfaeReSn+CkmalpjIy
+YX/za74G1gp39Ls2NOqy+vknkzYVyJZg0OBoa348OsB3igo6hmF3YRT1/48Vl58h
+TwZy8e07aZGlE6iDZUlDt6vM1RQH9ZB5L8D4SiaJP9pk2AtsfbnDlwPkdnyRTVzr
+ePKchCjMVhhF8iJFIF0RAoIBAQDtMIZ231lzMzPIJxbq62WbfQZdWmHaPObOePCq
+BYQ01K5nkhIQo+dnCBrsSjEHKDHQEkHpzt1d8IWYXU/F5dpyiTzQvpNEb8oDwKRO
+30UdTer5ziQZuNv3TKfhdtP1TXeT7PhRr2Xtuhb3znf7lzysYUWKWLJTmL/PieI2
+OW2ZPBiLnJzZwlKfUxzKvfPOja6vjcVasDipw7h0erz2ZWhWKBM/ANwsm4nAaBV7
+t1XHIQGKxPzoETsovcKbytfR9DryMrT/GVwVeYtrdqUG1SiE4gWg4FHxw74sZzcz
+eAOevNUr7DAuSvuOCGHFK4MfiSwmy8O4PcetJ4/43HvL5VU5AoIBAQDcplGkcaw3
+IacYpLB0S30HSI7WQY5mHBuNRtQpJ+fZ5UilZ/ZURKvD2q0kTxGTwGlag08sxOsR
+YgKwLDQsIAPJRBIo6x1rU99ZnE1AKAaLjrE/MVGXyLYSVaNo4373FYU7Tz60T0f8
+C02e1nonNva0NeMB9+vZV5JwZTptq1qLl96i5szWpQRB679gf6tSNaLTMCn1UFCT
+ha0BzOuy9UI8EIHWn5St6iJ3CaoeWub3GRtp0fpiqEiryO9YepXod+V9zT9BaXPM
+CDnuNoyfrcfmdTdAxroLk2FMcg/z5XDKCyRqgvLH2pNNXn37KEhuUHDEar+UsoiI
+jzq3RARWvEozAoIBAQCKfqoVIQc+/+e9eC2mkDqtFsyvl8XJQ4RVjUKhVEVE/+ay
+LRWFR98nRxFJZWzJTAwB/ZclKZgScQ3g0KNy32q1NDMhhBXDgS7JECQgtbfKi6On
+p1lm94zhEo54VQUgl9I5usWoFK2EqQMeQR3H9yADW2zagj3mGCvvyAghN1kqf2+p
+nZHsiM3roAEQ1OdWdV5JvZM+B+WeIt1CjiRmDwJkRFQwlpT5Kvy9L0lUCtH4Sup2
+l91AuEb93AeVJlTskBoXL8qFpc4h7+2bmxRzL+XP6ZX1wOW4MF6L2NzfnbUnbAVg
+9zGO5lOKNJS6J1USBeuU36fxnYlJLu+fFUbn4InpAoIBADwtmEKzRfbbVMlh0UZG
+eFkOLva8dmve6pzDXoXC/nbtE70Y95PQDtChyWsHrZGQfqtS+LsLEdlx063cwHXw
+XVf9Gr7SMPnerCGygVcoE3Dof+ruNoShFxc1CBZJRY157xZX7JAct1NEee0CLdqY
+IPzRXZJh3Y8vVR8WXLMgctdzmiLvs5ou81RPSai16THIsxnKHwdq2i8B3EeLbhUm
+0uOy1NaGO3SbUL8Kgb05qZhm3pUj0ZgqsXc4nB6TgGMgoBSJb+EVM6HH9JTFh+Dc
+8pImEeW2zXLuxTCmQzePsg1IsKvj/vcG4/nL9awUNnzvr3HCc3HIp3gnKCpngI9v
+VwUCggEAW+m7BDMuVQhGfbk62Pe+w54532JMsUdlmgI43wOXBi8NbxMaZiv/pyeF
+nAnxL6Ar+DhR0OG45ZFtEXU5KqGvS9e/nf+Y8dpbEhSpSa7XIEXV57aChgxwTBVl
+k1go0u9Kh12bl0X6aD42+nEIa/aL/8nycCzyvf+oU3CgJS8iRbmsz0BaKGrBVIU9
+IpsQIeosSH592o3n16jFtIkzIjWu16HC2Dny9uUdjLTjHPCqv34mW2EH0xD+VevW
+wh+ezl41sqniYR0U2/a90HyWz1DRASUMLGAiyqghUc9DANjh072tU58yzuott0L7
+lZqnHGyRAFqP6UxZgtwu30KuKIZBlg==
-----END PRIVATE KEY-----
diff --git a/ms/py-executor/certs/py-executor/py-executor.conf b/ms/py-executor/certs/py-executor/py-executor.conf
new file mode 100644
index 000000000..a74b39fdc
--- /dev/null
+++ b/ms/py-executor/certs/py-executor/py-executor.conf
@@ -0,0 +1,43 @@
+[req]
+default_bits = 4096
+default_keyfile = py-executor-key.pem
+distinguished_name = subject
+req_extensions = extensions
+x509_extensions = extensions
+string_mask = utf8only
+
+[ subject ]
+countryName = Country Name (2 letter code)
+countryName_default = US
+
+stateOrProvinceName = State or Province Name (full name)
+stateOrProvinceName_default = New Jersey
+
+localityName = Locality Name (eg, city)
+localityName_default = Middletown
+
+organizationName = Organization Name (eg, company)
+organizationName_default = ONAP Community
+
+commonName = Common Name (e.g. server FQDN or YOUR name)
+commonName_default = CCSDK
+
+emailAddress = Email Address
+emailAddress_default = bs2796@att.com
+
+[ extensions ]
+
+subjectKeyIdentifier = hash
+authorityKeyIdentifier = keyid,issuer
+
+basicConstraints = CA:FALSE
+keyUsage = nonRepudiation, digitalSignature, keyEncipherment
+extendedKeyUsage = serverAuth
+subjectAltName = @alt_names
+nsComment = "OpenSSL Generated Certificate"
+
+[alt_names]
+DNS.1 = cds-controller-*
+DNS.2 = py-executor-*
+DNS.3 = localhost
+IP.1 = 127.0.0.1
diff --git a/ms/py-executor/configuration-local.ini b/ms/py-executor/configuration-local.ini
new file mode 100644
index 000000000..c98746afe
--- /dev/null
+++ b/ms/py-executor/configuration-local.ini
@@ -0,0 +1,13 @@
+[scriptExecutor]
+port=50052
+authType=tls-auth
+# For TLS Auth
+certChain=certs/py-executor/py-executor-chain.pem
+privateKey=certs/py-executor/py-executor-key.pem
+logFile=application.log
+maxWorkers=20
+
+[blueprintsprocessor]
+blueprintDeployPath=test/resources
+blueprintArchivePath=target/blueprints/archive
+blueprintWorkingPath=target/blueprints/work
diff --git a/ms/py-executor/requirements.txt b/ms/py-executor/requirements.txt
index 6c406bfaf..14b4c29a0 100644
--- a/ms/py-executor/requirements.txt
+++ b/ms/py-executor/requirements.txt
@@ -1,5 +1,5 @@
-grpcio==1.23.0
-grpcio-tools==1.23.0
+grpcio==1.25.0
+grpcio-tools==1.25.0
configparser==4.0.2
requests==2.22.0
ncclient==0.6.6
diff --git a/ms/sdclistener/application/pom.xml b/ms/sdclistener/application/pom.xml
index 5f359575f..39fa259c1 100644
--- a/ms/sdclistener/application/pom.xml
+++ b/ms/sdclistener/application/pom.xml
@@ -53,8 +53,6 @@
<scope>test</scope>
</dependency>
-
-
<dependency>
<groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>health-api-common</artifactId>
@@ -78,29 +76,38 @@
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
- <version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
- <version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
- <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty-shaded</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-grpclb</artifactId>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-testing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>blueprint-proto</artifactId>
</dependency>
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
index 253b576d2..2ec241d75 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener;
import org.springframework.boot.SpringApplication;
@@ -25,4 +26,5 @@ public class SdcListenerApplication {
public static void main(String[] args) {
SpringApplication.run(SdcListenerApplication.class, args);
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java
index 06e2a0342..686f0aa10 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java
@@ -13,13 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener;
-import java.util.List;
import org.onap.sdc.api.consumer.IConfiguration;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import java.util.List;
+
/**
* In order to initiate a SDC distribution client we need to supply some pre-configuration values that
* distribution client needs.
@@ -139,5 +141,6 @@ public class SdcListenerConfiguration implements IConfiguration {
public Boolean isUseHttpsWithDmaap() {
return isUseHttpsWithDmaap;
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
index d5f156e55..f379e60a6 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java
@@ -13,14 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener;
-import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
-import java.io.File;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.Objects;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.service.ListenerService;
import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus;
@@ -40,6 +35,14 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Objects;
+
+import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
+
@ConfigurationProperties("listenerservice")
@Component
@ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto")
@@ -70,13 +73,13 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
private void processNotification(INotificationData notificationData) {
final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient();
notificationData.getServiceArtifacts()
- .forEach(artifactInfo -> downloadCsarArtifacts(artifactInfo, distributionClient));
+ .forEach(artifactInfo -> downloadCsarArtifacts(artifactInfo, distributionClient));
}
/**
* Download the TOSCA CSAR artifact and process it.
*
- * @param info - Artifact information
+ * @param info - Artifact information
* @param distributionClient - SDC distribution client
*/
private void downloadCsarArtifacts(IArtifactInfo info, IDistributionClient distributionClient) {
@@ -93,14 +96,14 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
final String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url,
- result.getDistributionActionResult());
+ result.getDistributionActionResult());
listenerStatus
- .sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR, errorMessage,
- url, NotificationType.DOWNLOAD);
+ .sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR, errorMessage,
+ url, NotificationType.DOWNLOAD);
LOGGER.error(errorMessage);
} else {
listenerStatus.sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_OK, null, url,
- NotificationType.DOWNLOAD);
+ NotificationType.DOWNLOAD);
LOGGER.info("Trying to write CSAR artifact to file with URL {} and UUID {}", url, id);
processCsarArtifact(result);
}
@@ -128,4 +131,5 @@ public class SdcListenerNotificationCallback implements INotificationCallback {
listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc());
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/actuator/indicator/SDCListenerCustomIndicator.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/actuator/indicator/SDCListenerCustomIndicator.java
index 11fd2c24c..1a5bafcc8 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/actuator/indicator/SDCListenerCustomIndicator.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/actuator/indicator/SDCListenerCustomIndicator.java
@@ -16,7 +16,6 @@
package org.onap.ccsdk.cds.sdclistener.actuator.indicator;
-
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse;
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus;
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.SDCListenerHealthCheck;
@@ -24,25 +23,28 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health.Builder;
import org.springframework.stereotype.Component;
+
/**
* Health Indicator for SDCListener.
+ *
* @author Shaaban Ebrahim
* @version 1.0
*/
@Component
public class SDCListenerCustomIndicator extends AbstractHealthIndicator {
- @Autowired
- private SDCListenerHealthCheck sDCListenerHealthCheck;
+ @Autowired
+ private SDCListenerHealthCheck sDCListenerHealthCheck;
- @Override
- protected void doHealthCheck(Builder builder) {
- HealthApiResponse healthAPIResponse = sDCListenerHealthCheck.retrieveEndpointExecutionStatus();
- if (healthAPIResponse.getStatus() == HealthCheckStatus.UP) {
- builder.up();
- } else {
- builder.down();
+ @Override
+ protected void doHealthCheck(Builder builder) {
+ HealthApiResponse healthAPIResponse = sDCListenerHealthCheck.retrieveEndpointExecutionStatus();
+ if (healthAPIResponse.getStatus() == HealthCheckStatus.UP) {
+ builder.up();
+ } else {
+ builder.down();
+ }
+ builder.withDetail("Services", healthAPIResponse.getChecks());
}
- builder.withDetail("Services", healthAPIResponse.getChecks());
- }
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
index b981b806c..5389dccc0 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java
@@ -13,10 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.client;
-import io.grpc.*;
+import io.grpc.CallOptions;
+import io.grpc.Channel;
+import io.grpc.ClientCall;
+import io.grpc.ClientInterceptor;
+import io.grpc.ForwardingClientCall;
+import io.grpc.Metadata;
import io.grpc.Metadata.Key;
+import io.grpc.MethodDescriptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@@ -36,7 +43,7 @@ public class SdcListenerAuthClientInterceptor implements ClientInterceptor {
CallOptions callOptions, Channel channel) {
Key<String> authHeader = Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER);
return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(
- channel.newCall(methodDescriptor, callOptions)) {
+ channel.newCall(methodDescriptor, callOptions)) {
@Override
public void start(Listener<RespT> responseListener, Metadata headers) {
headers.put(authHeader, basicAuth);
@@ -44,4 +51,5 @@ public class SdcListenerAuthClientInterceptor implements ClientInterceptor {
}
};
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java
index 973f950bc..030200924 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.client;
-import java.util.Optional;
import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration;
-import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.SdcListenerNotificationCallback;
+import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.exceptions.SdcListenerException;
import org.onap.sdc.api.IDistributionClient;
import org.onap.sdc.api.results.IDistributionClientResult;
@@ -32,6 +32,8 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
+import java.util.Optional;
+
@Component
@ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto")
public class SdcListenerClient {
@@ -57,7 +59,7 @@ public class SdcListenerClient {
LOG.info("Initialize the SDC distribution client");
distributionClient = Optional.of(DistributionClientFactory.createDistributionClient())
- .orElseThrow(() -> new SdcListenerException("Could not able to create SDC Distribution client"));
+ .orElseThrow(() -> new SdcListenerException("Could not able to create SDC Distribution client"));
listenerDto.setManagedChannelForGrpc();
@@ -70,7 +72,7 @@ public class SdcListenerClient {
private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws SdcListenerException {
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
throw new SdcListenerException(
- "SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
+ "SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
}
LOG.info("Initialization of the SDC distribution client is complete");
@@ -80,7 +82,7 @@ public class SdcListenerClient {
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
throw new SdcListenerException(
- "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult());
+ "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult());
}
}
@@ -89,7 +91,8 @@ public class SdcListenerClient {
IDistributionClientResult status = this.distributionClient.stop();
if (status.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
throw new SdcListenerException(
- "Failed to close the SDC distribution client due to : " + status.getDistributionMessageResult());
+ "Failed to close the SDC distribution client due to : " + status.getDistributionMessageResult());
}
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
index 44245752f..39d03c5bd 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java
@@ -13,6 +13,7 @@
* 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;
@@ -31,4 +32,5 @@ public class HealthCheck {
Mono<String> ping() {
return Mono.just("{\"status\":\"UP\"}");
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
index a59022c3f..19e700153 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.dto;
import io.grpc.ManagedChannel;
@@ -61,9 +62,9 @@ public class SdcListenerDto {
public void setManagedChannelForGrpc() {
managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort)
- .usePlaintext()
- .intercept(sdcListenerAuthClientInterceptor)
- .build();
+ .usePlaintext()
+ .intercept(sdcListenerAuthClientInterceptor)
+ .build();
}
public ManagedChannel getManagedChannelForGrpc() {
@@ -77,4 +78,5 @@ public class SdcListenerDto {
public void setArtifactUrl(String artifactUrl) {
this.artifactUrl = artifactUrl;
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java
index 23f669f1e..458d667f3 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.exceptions;
public class SdcListenerException extends Exception {
@@ -26,9 +27,10 @@ public class SdcListenerException extends Exception {
/**
* @param message The message to dump
- * @param cause The Throwable cause object
+ * @param cause The Throwable cause object
*/
public SdcListenerException(final String message, final Throwable cause) {
super(message, cause);
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java
index 96b2ff081..584713a50 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.handler;
import io.grpc.ManagedChannel;
@@ -37,8 +38,9 @@ public class BluePrintProcesssorHandler implements AutoCloseable {
/**
* Sending CBA archive to CDS backend to store into its Database.
*
- * @param request BluePrintManagementInput object holds CBA archive, its version and blueprints.
+ * @param request BluePrintManagementInput object holds CBA archive, its version and blueprints.
* @param managedChannel - ManagedChannel object helps to access the server or application end point.
+ *
* @return A response object
*/
public Status sendRequest(BluePrintUploadInput request, ManagedChannel managedChannel) {
@@ -61,4 +63,5 @@ public class BluePrintProcesssorHandler implements AutoCloseable {
}
LOGGER.info("Stopping GRPC connection to CDS backend");
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
index bc72c8f98..9f0acd544 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java
@@ -13,35 +13,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.service;
import io.grpc.ManagedChannel;
-import java.nio.file.Path;
import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import java.nio.file.Path;
+
public interface ListenerService {
/**
* Get the controller blueprint archive from CSAR package.
*
* @param csarArchivePath The path where CSAR archive is stored.
- * @param cbaArchivePath The destination path where CBA will be stored.
+ * @param cbaArchivePath The destination path where CBA will be stored.
*/
void extractBluePrint(String csarArchivePath, String cbaArchivePath);
/**
* Store the Zip file into CDS database.
*
- * @param path path where zip file exists.
+ * @param path path where zip file exists.
* @param managedChannel To access the blueprint processor application end point
*/
- void saveBluePrintToCdsDatabase(Path path, ManagedChannel managedChannel);
+ void saveBluePrintToCdsDatabase(Path path, ManagedChannel managedChannel);
/**
* Extract and store the csar package to local disk.
*
- * @param result - IDistributionClientDownloadResult contains payload.
+ * @param result - IDistributionClientDownloadResult contains payload.
* @param csarArchivePath The destination path where CSAR will be stored.
*/
void extractCsarAndStore(IDistributionClientDownloadResult result, Path csarArchivePath);
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
index 1937af75c..810f131df 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.service;
import com.google.protobuf.ByteString;
@@ -38,7 +39,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
-import java.io.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -101,16 +106,16 @@ public class ListenerServiceImpl implements ListenerService {
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);
+ .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);
+ artifactUrl, SDC_LISTENER_COMPONENT);
}
} catch (Exception e) {
final String errorMessage = format("Failed to extract blueprint %s", e.getMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage,
- artifactUrl, SDC_LISTENER_COMPONENT);
+ artifactUrl, SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
}
}
@@ -121,7 +126,7 @@ public class ListenerServiceImpl implements ListenerService {
File targetZipFile = new File(targetLocation.toString());
try {
- if (! targetZipFile.createNewFile()) {
+ if (!targetZipFile.createNewFile()) {
LOGGER.warn("Overwriting zip file {}", targetLocation);
}
} catch (IOException e) {
@@ -129,7 +134,7 @@ public class ListenerServiceImpl implements ListenerService {
}
try (InputStream inputStream = zipFile.getInputStream(entry); OutputStream out = new FileOutputStream(
- targetZipFile)) {
+ targetZipFile)) {
IOUtils.copy(inputStream, out);
LOGGER.info("Successfully store the CBA archive {} at this location", targetZipFile);
} catch (Exception e) {
@@ -194,20 +199,20 @@ public class ListenerServiceImpl implements ListenerService {
if (responseStatus.getCode() != SUCCESS_CODE) {
final String errorMessage = format("Failed to store the CBA archive into CDS DB due to %s",
- responseStatus.getErrorMessage());
+ responseStatus.getErrorMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
} else {
LOGGER.info(responseStatus.getMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ SDC_LISTENER_COMPONENT);
}
} catch (Exception e) {
final String errorMessage = format("Failure due to %s", e.getMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
}
});
@@ -236,4 +241,5 @@ public class ListenerServiceImpl implements ListenerService {
private String getArtifactUrl() {
return sdcListenerDto.getArtifactUrl();
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
index 4f31003b0..488c44602 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/ComponentStatusMessage.java
@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.status;
import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
import org.onap.sdc.api.consumer.IDistributionStatusMessage;
import org.onap.sdc.utils.DistributionStatusEnum;
-public class ComponentStatusMessage implements IComponentDoneStatusMessage, IDistributionStatusMessage {
+public class ComponentStatusMessage implements IComponentDoneStatusMessage, IDistributionStatusMessage {
private String componentName;
@@ -94,4 +95,5 @@ public class ComponentStatusMessage implements IComponentDoneStatusMessage, IDi
public void setArtifactUrl(String artifactUrl) {
this.artifactUrl = artifactUrl;
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
index a8e60c29a..a24c0ddad 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.status;
-import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
-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;
@@ -32,6 +31,10 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
+import java.util.Objects;
+
+import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
+
@Component
@ConfigurationProperties("listenerservice")
@ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto")
@@ -46,44 +49,47 @@ public class SdcListenerStatus {
@Autowired
private SdcListenerDto sdcListenerDto;
+
public enum NotificationType {
- DOWNLOAD, SDC_LISTENER_COMPONENT;
+ DOWNLOAD,
+ SDC_LISTENER_COMPONENT;
}
/**
* Send the component status back to SDC.
+ *
* @param distributionID SDC Distribution ID
- * @param status Distribution status
- * @param errorReason Reason of failure if present
- * @param url Artifact URL
- * @param type - NotificationType(Download or Component)
+ * @param status Distribution status
+ * @param errorReason Reason of failure if present
+ * @param url Artifact URL
+ * @param type - NotificationType(Download or Component)
*/
public void sendResponseBackToSdc(String distributionID, DistributionStatusEnum status, String errorReason,
- String url, NotificationType type) {
+ String url, NotificationType type) {
final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient();
switch (type) {
case SDC_LISTENER_COMPONENT:
IComponentDoneStatusMessage componentStatusMessage = buildStatusMessage(distributionID, status, url,
- COMPONENT_NAME);
+ COMPONENT_NAME);
if (errorReason == null) {
checkResponseStatusFromSdc(distributionClient.sendComponentDoneStatus(componentStatusMessage));
} else {
checkResponseStatusFromSdc(
- distributionClient.sendComponentDoneStatus(componentStatusMessage, errorReason));
+ distributionClient.sendComponentDoneStatus(componentStatusMessage, errorReason));
}
break;
case DOWNLOAD:
IDistributionStatusMessage downloadStatusMessage = buildStatusMessage(distributionID, status, url,
- null);
+ null);
if (errorReason == null) {
checkResponseStatusFromSdc(distributionClient.sendDownloadStatus(downloadStatusMessage));
} else {
checkResponseStatusFromSdc(
- distributionClient.sendDownloadStatus(downloadStatusMessage, errorReason));
+ distributionClient.sendDownloadStatus(downloadStatusMessage, errorReason));
}
default:
break;
@@ -91,7 +97,7 @@ public class SdcListenerStatus {
}
private ComponentStatusMessage buildStatusMessage(String distributionId, DistributionStatusEnum status, String url,
- String componentName) {
+ String componentName) {
return new BuilderUtil<>(new ComponentStatusMessage()).build(builder -> {
builder.setDistributionID(distributionId);
builder.setStatus(status);
@@ -105,9 +111,10 @@ public class SdcListenerStatus {
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 {}",
- result.getDistributionMessageResult());
+ result.getDistributionMessageResult());
} else {
LOGGER.info("SDC successfully received the response");
}
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
index a5c4a5c16..992843468 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.util;
import java.util.function.Consumer;
@@ -38,4 +39,5 @@ public class BuilderUtil<T> {
public T create() {
return object;
}
+
}
diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
index 42b795634..f1c1c735d 100644
--- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
+++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.util;
import org.apache.commons.io.FileUtils;
@@ -54,18 +55,20 @@ public final class FileUtil {
* Extract files from the given path
*
* @param path where files reside.
+ *
* @return list of files.
*/
public static List<File> getFilesFromDisk(Path path) {
try (Stream<Path> fileTree = walk(path)) {
// Get the list of files from the path
- return 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 new ArrayList<>();
}
+
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java
index 1e6d7cbae..e08b6134c 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java
@@ -13,9 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener;
-import mockit.*;
+import mockit.Expectations;
+import mockit.Injectable;
+import mockit.Mock;
+import mockit.MockUp;
+import mockit.Tested;
+import mockit.VerificationsInOrder;
import mockit.integration.junit4.JMockit;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,11 +42,11 @@ public class SdcListenerClientTest {
@Test
public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient,
- @Injectable SdcListenerConfiguration configuration,
- @Injectable SdcListenerNotificationCallback notification,
- @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException {
+ @Injectable SdcListenerConfiguration configuration,
+ @Injectable SdcListenerNotificationCallback notification,
+ @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException {
- //Arrange
+ //Arrange
new MockUp<DistributionClientFactory>() {
@Mock
public IDistributionClient createDistributionClient() {
@@ -70,6 +76,7 @@ public class SdcListenerClientTest {
public IDistributionClientResult getResult() {
return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,
- DistributionActionResultEnum.SUCCESS.name());
+ DistributionActionResultEnum.SUCCESS.name());
}
+
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java
index 01ffe1ba9..26757a657 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener;
-import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +23,8 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
+import static org.junit.Assert.assertEquals;
+
@RunWith(SpringRunner.class)
@EnableConfigurationProperties(SdcListenerConfiguration.class)
@SpringBootTest(classes = {SdcListenerConfigurationTest.class})
@@ -45,4 +47,5 @@ public class SdcListenerConfigurationTest {
assertEquals(listenerConfiguration.getConsumerID(), "cds-id-local");
assertEquals(listenerConfiguration.activateServerTLSAuth(), false);
}
+
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
index 7a92c0040..8a4bb2224 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.handler;
import com.google.protobuf.ByteString;
@@ -107,7 +108,6 @@ public class BluePrintProcessorHandlerTest {
byte[] bytes = FileUtils.readFileToByteArray(file);
FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build();
-
return BluePrintUploadInput.newBuilder()
.setCommonHeader(CommonHeader.newBuilder()
.setRequestId(UUID.randomUUID().toString())
@@ -124,4 +124,5 @@ public class BluePrintProcessorHandlerTest {
.setStatus(Status.newBuilder().setMessage(SUCCESS_MSG).setCode(200).build())
.build();
}
+
}
diff --git a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
index 25b5098ab..5d25ac2bf 100644
--- a/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
+++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.service;
import org.apache.commons.io.FileUtils;
@@ -50,8 +51,8 @@ import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
@RunWith(SpringRunner.class)
@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class,
- BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class,
- SdcListenerConfiguration.class})
+ BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class,
+ SdcListenerConfiguration.class})
@SpringBootTest(classes = {ListenerServiceImplTest.class})
public class ListenerServiceImplTest {
@@ -63,7 +64,6 @@ public class ListenerServiceImplTest {
private static final String DISTRIBUTION_ID = "1";
private static final String URL = "/sdc/v1/artifact";
-
private String csarArchivePath;
private Path tempDirectoryPath;
@@ -105,18 +105,18 @@ public class ListenerServiceImplTest {
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);
+ .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);
+ .sendResponseBackToSdc(DISTRIBUTION_ID, COMPONENT_DONE_OK, null, URL, SDC_LISTENER_COMPONENT);
}
@Test
- public void storeCsarArtifactToFileSuccessfully() throws IOException {
+ public void storeCsarArtifactToFileSuccessfully() throws IOException {
// Arrange
DistributionClientDownloadResultStubImpl resultStub = new DistributionClientDownloadResultStubImpl();
@@ -130,11 +130,11 @@ public class ListenerServiceImplTest {
private String checkFileExists(Path path) throws IOException {
return Files.walk(path)
- .filter(Files::isRegularFile)
- .map(Path::toFile)
- .findAny()
- .get()
- .getName();
+ .filter(Files :: isRegularFile)
+ .map(Path :: toFile)
+ .findAny()
+ .get()
+ .getName();
}
public byte[] convertFileToByteArray(File file) {
@@ -147,7 +147,7 @@ public class ListenerServiceImplTest {
}
public class DistributionClientDownloadResultStubImpl extends DistributionClientResultStubImpl implements
- IDistributionClientDownloadResult {
+ IDistributionClientDownloadResult {
public DistributionClientDownloadResultStubImpl() {
}
@@ -164,5 +164,7 @@ public class ListenerServiceImplTest {
public String getArtifactFilename() {
return "MackArtifactName.csar";
}
+
}
+
}
diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml
index 65ca25040..7055a7b8b 100755
--- a/ms/sdclistener/parent/pom.xml
+++ b/ms/sdclistener/parent/pom.xml
@@ -35,8 +35,6 @@
<properties>
<spring.boot.version>2.1.3.RELEASE</spring.boot.version>
<spring.version>5.1.5.RELEASE</spring.version>
- <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>
<guava.version>27.0.1-jre</guava.version>
<onap.logger.slf4j>1.2.2</onap.logger.slf4j>
@@ -110,12 +108,27 @@
<version>${grpc.version}</version>
</dependency>
<dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-netty-shaded</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.grpc</groupId>
+ <artifactId>grpc-grpclb</artifactId>
+ <version>${grpc.version}</version>
+ </dependency>
+ <dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuff.java.utils.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-java-util</artifactId>
+ <version>${protobuff.java.utils.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>blueprint-proto</artifactId>
<version>${project.version}</version>
<exclusions>
@@ -185,27 +198,27 @@
<!-- Controller Blueprints Application Dependency -->
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>resource-dict</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>blueprint-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>blueprint-scripts</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>db-resources</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId>
+ <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId>
<artifactId>blueprint-validation</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/pom.xml b/pom.xml
index d7580f0b0..1e2f62f79 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@ limitations under the License.
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>1.5.0</version>
+ <version>1.5.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -98,6 +98,56 @@ limitations under the License.
</execution>
</executions>
</plugin>
+
+ <!-- Plugin to Format/Validate Kotlin Files -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>validate-kotlin</id>
+ <phase>validate</phase>
+ <configuration>
+ <target name="ktlint">
+ <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true"
+ classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
+ <arg value="src/**/*.kt"/>
+ </java>
+ </target>
+ <skip>${format.skipValidate}</skip>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <!-- Built-in formatter So that you wouldn't have to fix all style violations by hand.-->
+ <id>format-kotlin</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <target name="ktlint">
+ <java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true"
+ classname="com.pinterest.ktlint.Main" classpathref="maven.plugin.classpath">
+ <arg value="-F"/>
+ <arg value="src/**/*.kt"/>
+ </java>
+ </target>
+ <skip>${format.skipExecute}</skip>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.pinterest</groupId>
+ <artifactId>ktlint</artifactId>
+ <version>0.35.0</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
@@ -142,5 +192,6 @@ limitations under the License.
<format.skipExecute>false</format.skipExecute>
</properties>
</profile>
+
</profiles>
</project>