From c5aea4a8bc398fc1c6220875e55b9520fd7f7524 Mon Sep 17 00:00:00 2001 From: "mark.j.leonard" Date: Wed, 6 Jun 2018 14:47:42 +0100 Subject: Refactor for Sonar smells and code coverage Various code formatting and style fixes (to address Sonar code smells). Introduce a BabelServiceClientException to replace the use of the base Exception class. Make both the BabelServiceClient class and its Factory class use an interface, to allow for Spring injection (using annotations) and for simplified mocking. Refactor the Notification Publishing by making this the responsibility of the main Service classes and not the deployment manager. Issue-ID: AAI-1207 Change-Id: I6bf8a504fa7b98e9158c9976fd1d88c6c54027c1 Signed-off-by: mark.j.leonard --- src/test/resources/auth/aai-client-dummy.p12 | Bin 0 -> 2514 bytes .../AAI-SCP-Test-VSP-resource-1.0.xml | 51 +++++++++++++++++++++ .../model-loader-empty-auth-password.properties | 25 ++++++---- .../model-loader-no-auth-password.properties | 25 ++++++---- src/test/resources/model-loader.properties | 12 +++-- .../resources/sdc_test/model-loader.properties | 30 ++++++++++++ 6 files changed, 119 insertions(+), 24 deletions(-) create mode 100644 src/test/resources/auth/aai-client-dummy.p12 create mode 100644 src/test/resources/convertedYmls/AAI-SCP-Test-VSP-resource-1.0.xml create mode 100644 src/test/resources/sdc_test/model-loader.properties (limited to 'src/test/resources') diff --git a/src/test/resources/auth/aai-client-dummy.p12 b/src/test/resources/auth/aai-client-dummy.p12 new file mode 100644 index 0000000..ce363f5 Binary files /dev/null and b/src/test/resources/auth/aai-client-dummy.p12 differ diff --git a/src/test/resources/convertedYmls/AAI-SCP-Test-VSP-resource-1.0.xml b/src/test/resources/convertedYmls/AAI-SCP-Test-VSP-resource-1.0.xml new file mode 100644 index 0000000..bc723c1 --- /dev/null +++ b/src/test/resources/convertedYmls/AAI-SCP-Test-VSP-resource-1.0.xml @@ -0,0 +1,51 @@ + + b2b88a73-5c55-4984-99dd-a35c55935d14 + resource + + + 2e42bac2-318a-410c-b8ff-3b3a31351be7 + SCP-Test-VSP + 1.0 + SCP Test VSP + + + T + unbounded + + + T + unbounded + + + + model-ver + + model-ver.model-version-id + 06258c44-ab48-4b4b-a5db-16892f7d1e76 + + + model.model-invariant-id + 6f288081-b321-47c9-b038-6de70079a3bf + + + + + + + + model-ver + + model-ver.model-version-id + 93a6166f-b3d5-4f06-b4ba-aed48d009ad9 + + + model.model-invariant-id + acc6edd8-a8d4-4b93-afaa-0994068be14c + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/model-loader-empty-auth-password.properties b/src/test/resources/model-loader-empty-auth-password.properties index 91fd527..fabd855 100644 --- a/src/test/resources/model-loader-empty-auth-password.properties +++ b/src/test/resources/model-loader-empty-auth-password.properties @@ -1,22 +1,27 @@ # Model Loader Distribution Client Configuration ml.distribution.ACTIVE_SERVER_TLS_AUTH=false -ml.distribution.ASDC_ADDRESS= +ml.distribution.ASDC_ADDRESS=localhost:8443 +ml.distribution.MSG_BUS_ADDRESSES=localhost ml.distribution.CONSUMER_GROUP=aai-ml-group-test ml.distribution.CONSUMER_ID=aai-ml-id-test -ml.distribution.ENVIRONMENT_NAME= +ml.distribution.ENVIRONMENT_NAME=env ml.distribution.KEYSTORE_PASSWORD= -ml.distribution.KEYSTORE_FILE=asdc-client.jks -ml.distribution.PASSWORD= +ml.distribution.KEYSTORE_FILE= +ml.distribution.PASSWORD=Aa123456 ml.distribution.POLLING_INTERVAL=30 ml.distribution.POLLING_TIMEOUT=20 ml.distribution.USER=ci -ml.distribution.ARTIFACT_TYPES=MODEL_INVENTORY_PROFILE,MODEL_QUERY_SPEC,VNF_CATALOG +ml.distribution.ARTIFACT_TYPES=MODEL_QUERY_SPEC,TOSCA_CSAR -# Model Loader AAI REST Client Configuration -ml.aai.BASE_URL= -ml.aai.MODEL_URL=/aai/v8/service-design-and-creation/models/model/ -ml.aai.NAMED_QUERY_URL=/aai/v8/service-design-and-creation/named-queries/named-query/ -ml.aai.VNF_IMAGE_URL=/aai/v8/service-design-and-creation/vnf-images +# Disable ASDC polling & enable REST interface +ml.distribution.ASDC_CONNECTION_DISABLE=true +ml.debug.INGEST_SIMULATOR=enabled + +# Model Loader Client Configuration for the A&AI REST interface +ml.aai.BASE_URL=https://localhost:8443 +ml.aai.MODEL_URL=/aai/v*/service-design-and-creation/models/model/ +ml.aai.NAMED_QUERY_URL=/aai/v*/service-design-and-creation/named-queries/named-query/ +ml.aai.VNF_IMAGE_URL=/aai/v*/service-design-and-creation/vnf-images ml.aai.KEYSTORE_FILE=aai-client-cert.p12 ml.aai.KEYSTORE_PASSWORD= ml.aai.AUTH_USER=ModelLoader diff --git a/src/test/resources/model-loader-no-auth-password.properties b/src/test/resources/model-loader-no-auth-password.properties index 2f36934..96b24c8 100644 --- a/src/test/resources/model-loader-no-auth-password.properties +++ b/src/test/resources/model-loader-no-auth-password.properties @@ -1,21 +1,26 @@ # Model Loader Distribution Client Configuration ml.distribution.ACTIVE_SERVER_TLS_AUTH=false -ml.distribution.ASDC_ADDRESS= +ml.distribution.ASDC_ADDRESS=localhost:8443 +ml.distribution.MSG_BUS_ADDRESSES=localhost ml.distribution.CONSUMER_GROUP=aai-ml-group-test ml.distribution.CONSUMER_ID=aai-ml-id-test -ml.distribution.ENVIRONMENT_NAME= +ml.distribution.ENVIRONMENT_NAME=env ml.distribution.KEYSTORE_PASSWORD= -ml.distribution.KEYSTORE_FILE=asdc-client.jks -ml.distribution.PASSWORD= +ml.distribution.KEYSTORE_FILE= +ml.distribution.PASSWORD=Aa123456 ml.distribution.POLLING_INTERVAL=30 ml.distribution.POLLING_TIMEOUT=20 ml.distribution.USER=ci -ml.distribution.ARTIFACT_TYPES=MODEL_INVENTORY_PROFILE,MODEL_QUERY_SPEC,VNF_CATALOG +ml.distribution.ARTIFACT_TYPES=MODEL_QUERY_SPEC,TOSCA_CSAR -# Model Loader AAI REST Client Configuration -ml.aai.BASE_URL= -ml.aai.MODEL_URL=/aai/v8/service-design-and-creation/models/model/ -ml.aai.NAMED_QUERY_URL=/aai/v8/service-design-and-creation/named-queries/named-query/ -ml.aai.VNF_IMAGE_URL=/aai/v8/service-design-and-creation/vnf-images +# Disable ASDC polling & enable REST interface +ml.distribution.ASDC_CONNECTION_DISABLE=true +ml.debug.INGEST_SIMULATOR=enabled + +# Model Loader Client Configuration for the A&AI REST interface +ml.aai.BASE_URL=https://localhost:8443 +ml.aai.MODEL_URL=/aai/v*/service-design-and-creation/models/model/ +ml.aai.NAMED_QUERY_URL=/aai/v*/service-design-and-creation/named-queries/named-query/ +ml.aai.VNF_IMAGE_URL=/aai/v*/service-design-and-creation/vnf-images ml.aai.KEYSTORE_FILE=aai-client-cert.p12 ml.aai.KEYSTORE_PASSWORD= diff --git a/src/test/resources/model-loader.properties b/src/test/resources/model-loader.properties index 9f3226a..3ba1519 100644 --- a/src/test/resources/model-loader.properties +++ b/src/test/resources/model-loader.properties @@ -1,20 +1,24 @@ # Model Loader Distribution Client Configuration ml.distribution.ACTIVE_SERVER_TLS_AUTH=false -ml.distribution.ASDC_ADDRESS=localhost +ml.distribution.ASDC_ADDRESS=localhost:8443 ml.distribution.MSG_BUS_ADDRESSES=localhost ml.distribution.CONSUMER_GROUP=aai-ml-group-test ml.distribution.CONSUMER_ID=aai-ml-id-test ml.distribution.ENVIRONMENT_NAME=env ml.distribution.KEYSTORE_PASSWORD= -ml.distribution.KEYSTORE_FILE=asdc-client.jks +ml.distribution.KEYSTORE_FILE= ml.distribution.PASSWORD=Aa123456 ml.distribution.POLLING_INTERVAL=30 ml.distribution.POLLING_TIMEOUT=20 ml.distribution.USER=ci -ml.distribution.ARTIFACT_TYPES=MODEL_INVENTORY_PROFILE,MODEL_QUERY_SPEC,VNF_CATALOG +ml.distribution.ARTIFACT_TYPES=MODEL_QUERY_SPEC,TOSCA_CSAR + +# Disable ASDC polling & enable REST interface +ml.distribution.ASDC_CONNECTION_DISABLE=true +ml.debug.INGEST_SIMULATOR=enabled # Model Loader Client Configuration for the A&AI REST interface -ml.aai.BASE_URL= +ml.aai.BASE_URL=https://localhost:8443 ml.aai.MODEL_URL=/aai/v*/service-design-and-creation/models/model/ ml.aai.NAMED_QUERY_URL=/aai/v*/service-design-and-creation/named-queries/named-query/ ml.aai.VNF_IMAGE_URL=/aai/v*/service-design-and-creation/vnf-images diff --git a/src/test/resources/sdc_test/model-loader.properties b/src/test/resources/sdc_test/model-loader.properties new file mode 100644 index 0000000..ee5c0ed --- /dev/null +++ b/src/test/resources/sdc_test/model-loader.properties @@ -0,0 +1,30 @@ +# Model Loader Distribution Client Configuration +ml.distribution.ACTIVE_SERVER_TLS_AUTH=false +ml.distribution.ASDC_ADDRESS=localhost:8443 +ml.distribution.MSG_BUS_ADDRESSES=localhost +ml.distribution.CONSUMER_GROUP=aai-ml-group-test +ml.distribution.CONSUMER_ID=aai-ml-id-test +ml.distribution.ENVIRONMENT_NAME=env +ml.distribution.KEYSTORE_PASSWORD= +ml.distribution.KEYSTORE_FILE= +ml.distribution.PASSWORD=Aa123456 +ml.distribution.POLLING_INTERVAL=30 +ml.distribution.POLLING_TIMEOUT=20 +ml.distribution.USER=ci +ml.distribution.ARTIFACT_TYPES=MODEL_QUERY_SPEC,TOSCA_CSAR + +# Model Loader Client Configuration for the A&AI REST interface +ml.aai.BASE_URL=https://localhost:8443 +ml.aai.MODEL_URL=/aai/v*/service-design-and-creation/models/model/ +ml.aai.NAMED_QUERY_URL=/aai/v*/service-design-and-creation/named-queries/named-query/ +ml.aai.VNF_IMAGE_URL=/aai/v*/service-design-and-creation/vnf-images +ml.aai.KEYSTORE_FILE=aai-client-cert.p12 +ml.aai.KEYSTORE_PASSWORD= +ml.aai.AUTH_USER=ModelLoader +ml.aai.AUTH_PASSWORD= + +# Model Loader Client Configuration for the Babel Service +ml.babel.BASE_URL= +ml.babel.GENERATE_ARTIFACTS_URL= +ml.babel.KEYSTORE_FILE= +ml.babel.KEYSTORE_PASSWORD= -- cgit